This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Example: public class Example { { FooBar fb = FooBar.FOO; } private enum FooBar { FOO, BAR }; } NetBeans proposes to convert "FooBar.FOO" to a static import, which results in a compilation error because FooBar is private. What's worse, this happens automatically in code completion (typing "FO" and then triggering code completion) when "prefer static imports" is turned on in the options. The same happens for private static methods. Expected behavior: 1) Do not propose a static import for elements in a nested private scope. 2) Have code completion complete to the qualified version for elements in a nested private scope even if "prefer static imports" is active.
You wrote: > NetBeans proposes to convert "FooBar.FOO" to a static import, which results > in a compilation error because FooBar is private. I've tried to make NB display such hint, but failed. Could you please attach example code and your exported Options related to java edititing ? Thanks.
Under Options -> Editor -> Hints -> Language: Java, the hint "JDK Migration Support" -> "Static imports" must be checked. For me it is set to "Warning on Current Line", so you may have to go on the expression "FooBar.FOO" with the caret for the hint to appear. Please try this. If you still can't reproduce it, I'll provide an example source file and exported options.