Class methods (static methods) not shown in code insight for instances?
Answered
Have an instance of GridPane, let's call that instance gridPane.
When I use auto-complete to select a method to invoke on gridPane, the static methods of class GridPane are NOT presented! I don't remember things being this way. Is this new or is it a bug? They do show up if I type GridPane. . (GridPane dot).
I can't think of a reason why I should not see all the methods available to my instance, which certainly includes the static methods of the class.
Any idea what's going on? Couldn't find a configuration checkbox, something like "show static methods for instance auto-complete" or such like.
Please sign in to leave a comment.
There is a hidden Registry setting for that, add `-Dide.java.completion.suggest.static.after.instance=true` in Help | Edit Custom VM Options.
Using static methods after instance is considered a bad practice and you should avoid it (many languages don't allow it at all), see here why:
http://stackoverflow.com/questions/610458/why-isnt-calling-a-static-method-by-way-of-an-instance-an-error-for-the-java-co
http://stackoverflow.com/questions/7884004/is-calling-static-methods-via-an-object-bad-form-why