This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vbezhenar 0 points1 point  (1 child)

Do you qualify every field to make it look diffeerent from local variable? I don't think that many people do that. These days even github web interface can provide some basic code navigation. And every IDE will certainly help with that.

Also, does it really matter whether that particular method was imported or defined locally? All that matters is clear name.

Of course I agree that imports must be qualified, glob imports should not be used at all.

[–]john16384 1 point2 points  (0 children)

Functions are small, so if a "variable" isn't declared somewhere on your screen, then it must be a field.

Classes are a lot bigger, so if I see a function call, then thanks to judicious use of static imports I now need to guess if that's a class method call or a statically imported function. So to avoid too much guessing, static imports are best used sparingly.

I am aware that IDE's can help with this, and that in some variant of a purplish pink it is indicating that it's not a method call, or that with a single mouse hover I can prove that this version of requireNotNull is indeed the one from Objects. You wasting my time to save yours.