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.

Bug 188577 - Incorrect enum dependency / visibility in module suite projects
Summary: Incorrect enum dependency / visibility in module suite projects
Status: RESOLVED WONTFIX
Alias: None
Product: apisupport
Classification: Unclassified
Component: Harness (show other bugs)
Version: 6.x
Hardware: PC Linux
: P2 normal with 3 votes (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-12 10:03 UTC by anba
Modified: 2010-07-12 14:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Module suite to show the enum dependency problem (3.38 KB, application/x-gzip)
2010-07-12 10:03 UTC, anba
Details

Note You need to log in before you can comment on or make changes to this bug.
Description anba 2010-07-12 10:03:32 UTC
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).
Comment 1 Jesse Glick 2010-07-12 14:24:00 UTC
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.)