Community
Participate
Working Groups
The Java editor marks false errors when using an interface with default (package) access. The errors are not shown in Tasks or Package Explorer and the code can be compiled and run normally. How to reproduce: create a project containing package cz.netkit.test and 3 files: SomethingFactory.java, SomethingImpl.java and TestBug.java. File content: // SomethingFactory.java package cz.netkit.test; interface ISomething { } public class SomethingFactory { public static ISomething getIt() { return new SomethingImpl(); } } // SomethingImpl.java package cz.netkit.test; public class SomethingImpl implements ISomething // MARKED FALSE ERROR { } // TestBug.java package cz.netkit.test; public class TestBug { public static void main(String[] args) { ISomething it = SomethingFactory.getIt(); // MARKED FALSE ERROR } }
This error is an artifact which only occurs in editor while typing. As you observed, it goes away when compiling the code (though the editor still shows it). It only occurs in presence of secondary types. The workaround is to define each type in its own file.
*** This bug has been marked as a duplicate of 36032 ***