Categories
Coding

Static Imports

Okay , I admit defeat. Static imports are not that bad. Particularly when you are using libraries like ASM and you have to deal with tons and tons of constants. It’s nice to be able to CTRL-SPACE in Eclipse and get the constant name without having to explicitly type the enclosing interface name every time, just by adding the static modifier to the import:

import static org.objectweb.asm.Constants.*;

That saves quite a bit of typing in the average ASM client program.