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 201453 - Blacklist transitive dependencies in Java editor
Summary: Blacklist transitive dependencies in Java editor
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1
Hardware: All All
: P1 normal (vote)
Assignee: Milos Kleint
URL:
Keywords: PLAN
: 203354 (view as bug list)
Depends on: 201340
Blocks:
  Show dependency tree
 
Reported: 2011-08-30 19:25 UTC by Jesse Glick
Modified: 2013-05-04 01:46 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-08-30 19:25:21 UTC
While Maven forces all transitive dependencies to be in the Java classpath during compilation, nbm-maven-plugin verifies that only direct dependencies are actually used in bytecode. Using the new whitelist API this could be enforced also in the editor, so you do not need to wait for a build failure.

This should also limit usages to classes in public packages. (The same could be done for apisupport.ant, too.)
Comment 1 Jesse Glick 2011-10-28 19:48:26 UTC
*** Bug 203354 has been marked as a duplicate of this bug. ***
Comment 2 Milos Kleint 2012-07-20 09:55:56 UTC
And most likely also applies to OSGI related projects.
Comment 3 Jesse Glick 2013-01-15 14:58:41 UTC
Possible general Maven projects as well, though I am not sure how to characterize them. The Enforcer rule [1] would I guess force you to <exclude> those dependencies, in which case the NB classpath would not contain them anyway. Is there a rule that lets you leave them nominally in place but checks that you are not making use of them during compilation? If so, that would be perfect for the blacklist.


[1] http://maven.apache.org/enforcer/enforcer-rules/banTransitiveDependencies.html
Comment 4 Quality Engineering 2013-01-31 03:12:16 UTC
Integrated into 'main-golden', will be available in build *201301310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/82c534ed211f
User: Milos Kleint <mkleint@netbeans.org>
Log: #201453 a basic implementation of whitelistquery for nbm projects, no caching, no osgi
Comment 5 Jesse Glick 2013-01-31 16:08:00 UTC
I bet if you ran FindBugs it would have something interesting to say about the line

if (mp.getProperties() == null && mp.getProperties().getProperty("enable.whitelist") == null) {
Comment 6 Milos Kleint 2013-01-31 16:29:07 UTC
good catch, it's outright wrong and would throw null pointer exception at times.. temporary code but still worth fixing I guess..

(In reply to comment #5)
> I bet if you ran FindBugs it would have something interesting to say about the
> line
> 
> if (mp.getProperties() == null &&
> mp.getProperties().getProperty("enable.whitelist") == null) {
Comment 7 Martin Kozeny 2013-02-20 09:04:21 UTC
https://hg.netbeans.org/core-main/rev/2f22116ce20e
Comment 8 Milos Kleint 2013-02-20 09:21:50 UTC
let's keep this open until we remove the current enablement triggers.
Comment 9 Quality Engineering 2013-02-23 04:10:17 UTC
Integrated into 'main-golden', will be available in build *201302222300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e39516c52c57
User: Martin Kozeny <mkozeny@netbeans.org>
Log: #201453: Initial finding of private packages in dependent modules.
Comment 10 Milos Kleint 2013-03-08 11:48:32 UTC
enabled for maven projects - http://hg.netbeans.org/core-main/rev/7bee3e8703eb
Comment 11 Quality Engineering 2013-03-09 01:56:58 UTC
Integrated into 'main-golden', will be available in build *201303082300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7bee3e8703eb
User: Milos Kleint <mkleint@netbeans.org>
Log: #201453 enable whitelists for maven projects, add index refresh when the private/transitive packages change upon project reload.
Comment 12 Quality Engineering 2013-04-28 02:18:08 UTC
Integrated into 'main-golden', will be available in build *201304272301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/486b99169e85
User: Martin Kozeny <mkozeny@netbeans.org>
Log: #201453: Turning on this functionality.
Comment 13 Quality Engineering 2013-05-04 01:46:39 UTC
Integrated into 'main-golden', will be available in build *201305032300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/76518cc50bd9
User: Martin Kozeny <mkozeny@netbeans.org>
Log: #201453: Turning off this functionality.