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.
[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.
Created attachment 112764 [details] Testcase.
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.
core-main #e714bfe933e4
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