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 234970 - Provide error/warning hint for usage of classes from transitive dependencies
Summary: Provide error/warning hint for usage of classes from transitive dependencies
Status: REOPENED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-25 16:17 UTC by markiewb
Modified: 2016-07-10 19:09 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 markiewb 2013-08-25 16:17:21 UTC
Use case: I want to know (hint in code or something) when I accidentally 
use transitive dependencies in my Java code in a regular maven project / it would be a good feature to be able to highlight/hint on transitive dependency usage in your own code

Currently something similar is supported for maven-based NBM/Suites [1]. But this is not supported for regular maven projects. You may also consider to interpret the enforcer-rules [2][3], add some errors/warnings to the task list (like in the screenshot) and remove classes from those banned artifacts from the "go to type"/code completion result set.

See discussion at mailing list [4]

[1] https://netbeans.org/bugzilla/show_bug.cgi?id=201453
[2] http://maven.apache.org/enforcer/enforcer-rules/banTransitiveDependencies.html
[3] http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
[4] http://netbeans-org.1045718.n5.nabble.com/74cat-Blacklist-for-transitive-dependencies-in-regular-maven-project-td5728224.html
Comment 1 Milos Kleint 2013-09-06 06:52:14 UTC
the enforcer rules are of no use here. with them the build will fail even when transitive dependency is not used at all in the code, it's enough to have the dependency in the resolved tree of dependencies.

reworking the MavenWhiteListQueryImpl from org.netbeans.modules.maven.apisupport should not be hard however the challenge will be where to put the options to configure it. It appears to me that  Hints is the right place, but the feature is not implemented via a hint api.
Comment 2 markiewb 2013-09-06 18:13:46 UTC
Yes a hint would be preferable. So i guess http://wiki.netbeans.org/wiki/images/6/6d/Whitelists.png isn't implemented as hint.
Comment 3 Milos Kleint 2013-10-09 08:26:48 UTC
we already have some "fake" hints that store options only eg. org.netbeans.modules.maven.hints.errors.SearchClassDependencyHint


another possible problem point is that current apisupport whitelist implementation precalculates transitive packages, which is likely ok in netbeans module development context but in general we could arrive at situations where a single package is in multiple artifacts.
Comment 4 everflux 2013-12-17 10:52:12 UTC
Any chance to see this in NB 8?
Comment 5 Milos Kleint 2013-12-17 11:33:51 UTC
not anymore. I didn't make it for 8.0, now it's only bug fixing until release
Comment 6 Martin Balin 2016-07-07 08:39:43 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 7 markiewb 2016-07-10 19:09:22 UTC
Still valid in 8.2 dev 
Product Version: NetBeans IDE Dev (Build 201607100002)