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 204615 - NbModuleProviderImpl.getDependencyVersion and addDependency do not work correctly
Summary: NbModuleProviderImpl.getDependencyVersion and addDependency do not work corre...
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 206885
Blocks:
  Show dependency tree
 
Reported: 2011-11-03 09:58 UTC by Jan Lahoda
Modified: 2012-01-03 23:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Testcase. (5.93 KB, patch)
2011-11-03 09:59 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Lahoda 2011-11-03 09:58:31 UTC
[recent sources]

With recent addition of Jackpot scripts, a dependency issue arises: e.g. when an obsolete Utilities.loadImage is replaced, the project needs to depend on org.openide.util version 7.15 or newer. If it does not, various problems with autoupdate will occur. Another usecase is that to resolve some method deprecations, it is necessary to add new project dependencies (e.g. removing calls to java.source's UiUtils typically requires dependency on java.sourceui).

The Jackpot infrastructure contains provisions to ensure the correct dependencies, but it obviously needs support from the projects. It was suggested that the NbModuleProvider.addDependency should be able to update the dependency for NetBeans projects. Sadly, it does not appear to be the case.

I am attaching a testcase for NbModuleProviderImpl that shows what is needed. Note that not only the addDependency is unable to update the dependency, but also getDependencyVersion does not correctly report the current dependency version, but rather reports the version from the ModuleList, which is unusable in this case (the dependency obviously must not be touched when it is sufficient). The patch contains a possible fix for this problem.

Also, I would like to ask that the addDependency (when it is fixed to update the dependency) does not "downgrade" impl. dependencies - otherwise accepting a hint might lead to uncompilable code.

In a long-term view, even this might not be enough, as when the changes are done through Inspect&Refactor, the changes should not physically happen until the user presses Refactor, but should be visible in the preview. But automatically upgrading the dependencies is probably acceptable in the mean time.
Comment 1 Jan Lahoda 2011-11-03 09:59:38 UTC
Created attachment 112764 [details]
Testcase.
Comment 2 Jesse Glick 2011-11-10 21:57:36 UTC
Patch as attached would be a regression, since this method is most commonly used by wizards to determine what version _would_ be added if one were added; with the patch, this would become null.
Comment 3 Jesse Glick 2011-11-10 22:34:09 UTC
core-main #e714bfe933e4
Comment 4 Quality Engineering 2011-11-12 16:31:01 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/e714bfe933e4
User: Jesse Glick <jglick@netbeans.org>
Log: #204615: NbModuleProviderImpl.getDependencyVersion and addDependency do not work correctly