Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 27853 - Do not expose public packages transitively from modules
Do not expose public packages transitively from modules
Status: VERIFIED FIXED
Product: platform
Classification: Unclassified
Component: Module System
3.x
PC Linux
: P3 (vote)
: 3.x
Assigned To: Jesse Glick
issues@platform
: API
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-07 18:40 UTC by Jesse Glick
Modified: 2008-12-23 08:36 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2002-10-07 18:40:48 UTC
Currently if A exposes some (or all) public
packages, and B depends on A and maybe exposes
some of its own packages, then if C depends on B,
it can use classes from either A or B. In
practice, this is not desirable because it forces
B's dependency on A to be a part of its effective
API, whether it wants this to be true or not.

This issue proposes to change the semantics, so
that C could only use classes from A if it
declared an explicit dependency on A as well as on B.

For example, the ant module provides a small API
in org.apache.tools.ant.module.api.*. It also
*currently* depends on
org.netbeans.modules.javahelp, so that it can
programmatically show help sometimes. But this
dependency is an implementation detail. It is
undesirable for every module depending on the ant
module to automatically have an "invisible"
dependency on JavaHelp. Currently this could only
be solved by splitting up the intermediate module
(B = ant) into B1 with an ant API and B2 with an
impl of the module, incl. showing help, so that
other modules depending on B1 would not have their
namespaces "polluted" by JavaHelp.

Another example would be a module which both
provides an API and depends on e.g. some Xerces
impl. You definitely do not want modules using
this API to automatically see Xerces - for one
thing, they would be unable to directly use their
own private Xerces impl without classloader tricks.

For compatibility reasons, modules like C with old
API spec dependencies would be assumed to
effectively depend on the transitive closure of
their declared dependencies, permitting C here to
use classes from A until it asks for new APIs, in
which case it would need to either stop using
classes from A or declare that dependency
explicitly. Although the Modules API was never
very clear on this question, for safety it is best
to assume that some modules were depending on the
old behavior.
Comment 1 Jesse Glick 2002-10-07 18:41:33 UTC
Already have a unit test demonstrating the current behavior (with a
failure).
Comment 2 Jesse Glick 2002-10-08 21:19:33 UTC
In directory core:
committed   * Up-To-Date  1.6         core/manifest.mf
In directory core/src:
In directory core/src/org:
In directory core/src/org/netbeans:
committed   * Up-To-Date  1.8        
core/src/org/netbeans/JarClassLoader.java
committed   * Up-To-Date  1.9        
core/src/org/netbeans/ProxyClassLoader.java
In directory core/src/org/netbeans/core:
committed   * Up-To-Date  1.162      
core/src/org/netbeans/core/NbTopManager.java
In directory core/src/org/netbeans/core/modules:
committed   * Up-To-Date  1.38       
core/src/org/netbeans/core/modules/Module.java
committed   * Up-To-Date  1.7        
core/src/org/netbeans/core/modules/ModuleInstaller.java
committed   * Up-To-Date  1.44       
core/src/org/netbeans/core/modules/ModuleManager.java
committed   * Up-To-Date  1.49       
core/src/org/netbeans/core/modules/NbInstaller.java
In directory core/test:
In directory core/test/unit:
In directory core/test/unit/src:
In directory core/test/unit/src/org:
In directory core/test/unit/src/org/netbeans:
In directory core/test/unit/src/org/netbeans/core:
In directory core/test/unit/src/org/netbeans/core/modules:
committed   * Up-To-Date  1.22       
core/test/unit/src/org/netbeans/core/modules/ModuleManagerTest.java
committed   * Up-To-Date  1.4        
core/test/unit/src/org/netbeans/core/modules/NbInstallerTest4.java
committed   * Up-To-Date  1.3        
core/test/unit/src/org/netbeans/core/modules/NbInstallerTest5.java
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/NbInstallerTest7.java
committed   * Up-To-Date  1.14       
core/test/unit/src/org/netbeans/core/modules/build.xml
In directory core/test/unit/src/org/netbeans/core/modules/jars:
committed   * Up-To-Date  1.2        
core/test/unit/src/org/netbeans/core/modules/jars/api-mod-export-api.mf
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-and-exports-api.mf
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-directly-old.mf
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-directly.mf
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-transitively-old.mf
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-transitively.mf
In directory
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-transitively:
In directory
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-transitively/usesapitrans:
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-transitively/usesapitrans/UsesDirectAPI.java
added       * Up-To-Date  1.1        
core/test/unit/src/org/netbeans/core/modules/jars/uses-api-transitively/usesapitrans/UsesIndirectAPI.java
In directory openide:
committed   * Up-To-Date  1.75        openide/openide-spec-vers.properties
In directory openide/api:
In directory openide/api/doc:
In directory openide/api/doc/changes:
committed   * Up-To-Date  1.99       
openide/api/doc/changes/apichanges.xml
In directory openide/api/doc/org:
In directory openide/api/doc/org/openide:
In directory openide/api/doc/org/openide/doc-files:
committed   * Up-To-Date  1.5        
openide/api/doc/org/openide/doc-files/classpath.html
committed   * Up-To-Date  1.37       
openide/api/doc/org/openide/doc-files/upgrade.html
Comment 3 pzajac 2002-11-05 16:13:09 UTC
verified in nb 200210300100. It looks fine. No class loaded on
transitive depedency.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo