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 201695

Summary: Consider every module to implicitly provide its CNB
Product: platform Reporter: Jesse Glick <jglick>
Component: Module SystemAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews, tstupka
Priority: P2 Keywords: API_REVIEW_FAST
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 59671    
Bug Blocks: 201612, 206365, 211824    
Attachments: Diff with API changes and their usage in OSGi mode
Diff with API changes, test, versioning and usage in core.netigso

Description Jesse Glick 2011-09-06 16:21:56 UTC
A number of provide/require/need/recommend dependencies are in fact on module code name bases, but the providing module is forced to redundantly declare

OpenIDE-Module-Provides: $myowncnb

This is annoying, and impossible in the case of a third-party OSGi bundle.

It would be preferable if the module system considered every module to provide its own CNB automatically, so you could declare a require/need/recommend dep on it without any special work. As part of such a change, the redundant provide declaration should be removed from modules using it now: debugger.jpda.ui, etc.
Comment 1 Jaroslav Tulach 2011-10-13 14:32:39 UTC
Possible, we should probably do it only for new modules. E.g. use ModuleFormat2.
Comment 2 Quality Engineering 2012-01-04 15:42:33 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/38c68cb2fc7a
User: Jesse Glick <jglick@netbeans.org>
Log: CNBs and tokens were getting confused.
Until #201695 is implemented, these are considered unrelated by the module system.
Note that recommend clauses in java.kit and keyring are accordingly wrong.
Comment 3 Jaroslav Tulach 2012-04-16 16:22:13 UTC
Created attachment 118354 [details]
Diff with API changes and their usage in OSGi mode
Comment 4 Jaroslav Tulach 2012-04-18 12:58:43 UTC
Created attachment 118457 [details]
Diff with API changes, test, versioning and usage in core.netigso
Comment 5 Jaroslav Tulach 2012-04-18 13:07:49 UTC
I'll integrate on Friday.
Comment 6 Jaroslav Tulach 2012-04-20 06:20:53 UTC
ergonomics#21aa64230b67
Comment 7 Jesse Glick 2012-04-23 22:11:48 UTC
<class package="org.openide.modules" name="ModuleInfo"/> should be removed since no change to this class's signature was made.


A bunch of things ought to be updated to match this change:

- org.netbeans.nbbuild.ModuleDependencies
- org.netbeans.modules.apisupport.project.api.ManifestManager
- all existing modules explicitly providing their own CNB should have this declaration removed, and all requirers should be modified to ask for "cnb.whatever" syntax

Please either fix these, or file subissues and assign to me. I will tweak org.netbeans.core.osgi.Activator now since that overlaps with bug #210325, and it can be done before 21aa64230b67 has propagated.
Comment 8 Quality Engineering 2012-04-25 09:58:15 UTC
Integrated into 'main-golden', will be available in build *201204250400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/16072c5a1db7
User: Jesse Glick <jglick@netbeans.org>
Log: Using "cnb." prefix for module CNB pseudotokens for consistency with #201695.
Comment 9 Jaroslav Tulach 2012-04-25 11:49:59 UTC
(In reply to comment #7)
> <class package="org.openide.modules" name="ModuleInfo"/> should be removed
> since no change to this class's signature was made.

The behavior of getProvides() method was changed. Imho, that warrants the link to ModuleInfo. I can add some additional info to javadoc if needed.

> A bunch of things ought to be updated to match this change:
> 
> - org.netbeans.nbbuild.ModuleDependencies

Do you mean? 

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -240,6 +240,7 @@
                 addDependencies (depends, file.getManifest (), Dependency.Type.RECOMMENDS, "OpenIDE-Module-Recommends");
                 addDependencies (provides, file.getManifest (), /*irrelevant*/Dependency.Type.REQUIRES, "OpenIDE-Module-Provides");
                 {
+                    provides.add(new Dependency("cnb." + module, Dependency.Type.REQUIRES, false, null));
                     String ideDeps = file.getManifest ().getMainAttributes ().getValue ("OpenIDE-Module-IDE-Dependencies"); // IDE/1 > 4.25
                     if (ideDeps != null) {
                         throw new BuildException("OpenIDE-Module-IDE-Dependencies is obsolete in " + f);

or something else?

> - org.netbeans.modules.apisupport.project.api.ManifestManager

ergonomics#527ee9fcfac4

> - all existing modules explicitly providing their own CNB should have this
> declaration removed, and all requirers should be modified to ask for
> "cnb.whatever" syntax

I am not that sure. Changing the set of provided tokens might be an incompatible change. But for sure, people can now depend on cnb.* tokens.
Comment 10 Quality Engineering 2012-04-26 10:31:48 UTC
Integrated into 'main-golden', will be available in build *201204260400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/21aa64230b67
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #201695: Implicitly provide code name base token. #206365: Mimic OSGi dependencies with recommends/provides
Comment 11 Quality Engineering 2012-04-27 09:59:56 UTC
Integrated into 'main-golden', will be available in build *201204270400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/527ee9fcfac4
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #201695: Imply cnb. token
Comment 12 Jaroslav Tulach 2012-05-02 10:20:25 UTC
Is ergonomics#527ee9fcfac4 enough?