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.
Created attachment 100760 [details] Module suite to show the enum dependency problem 1. Define a public enum in a private package in a module of a module suite 2. Use this enum in a package of another module of the module suite -> It is possible to import the enum -> The IDE does not show any error badges -> The compiler compiles it without problems -> Only when starting the program and trying to use the enum an exception appears. Reason for this incorrect behaviour is that the enum is inside the build/public-package-jars/module.jar file. I created an attachment with an example module suite named EnumTest for this problem containing two modules: 1. The first module named LibMod contains two packages a. libmod.api which is public in the module. This package contains the public class ApiTest. b. libmod.priv which is private in the module. This package contains the public enum PrivateEnum. 2. The second module named Main contains one package named test. The module defines a dependency to the LibMod Module. It contains a class named TestClass in which it is possible to define and compile a variable of type ApiTest (which is correct) and of enum PrivateEnum (which is wrong).
Yes, enums are specially exempted from the public package restriction in the harness; this is necessary to work around javac problems. See bug #152562. As to the IDE's code completion and error badges, the editor does not yet support including only a subset of another source root in the effective classpath; see bug #170231. (Although even with that implemented, it is possible that that in the special case of enums from a private package we would still need to export them as far as the editor is concerned, since the editor internally uses javac as well.)