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.
I am finally getting a chance to test a recent 6.7 build. I've created a simple suite with a few simple modules. What I expected: One of these modules does not use the Utilities API, but I wanted to use a public class (Lookup) from Utilities API in my unit test. I right-clicked Unit Test Library, chose "Add Unit Test Dependency," selected Utilities API and clicked OK. I expected this would allow me to use that class in my unit test. What I found: I tried to call Lookup.getDefault(), but this reference gave "red squigglies" in the source editor for my unit test. The Quick Fix suggestion was to create a class called Lookup, rather then to import the one from the Utilities API. Sometimes it takes the editor a second or two to catch up, os I waited and tried again, but it still did not give me the option of importing this class. I rebuilt the module and then the entire suite, but this did not fix it either, nor could I manually type the class name in as an import statemen (doing so showed "red squigglies" on the import statement as if this API's JAR file was not in the compile-time classpath). Eventually I tried adding a regular dependency on the Utilities API from my module (i.e. not a unit test dependency as before). This allowed me to import the Lookup class in my unit test. I removed the regular dependency from my module, but left the unit test dependency. This still allowed me to use the class. I was later able to reproduce this by adding a unit test dependency on the Window System API and attempting to use the TopComponent class in my unit test, when the module containing the test did not have a regular dependency on the Window System API. Here are the relevant details of the configuration under which I experienced this: Product Version: NetBeans IDE Dev (Build 200905120201) Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01 System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
I have also found that restarting the IDE will correct the classpath (i.e. let me use the reference without "red squigglies") without having the add the regular dependency to my module and then remove it again. Both of these workarounds are annoying (particularly for someone who writes a lot of tests), but they do seem to work in all cases.
This also seems to affect qa-functional tests as well; see this issue for more details: http://www.netbeans.org/issues/show_bug.cgi?id=165109
*** Issue 165444 has been marked as a duplicate of this issue. ***
core-main #7448ebb20b8a issue #165712 remains when removing library.
impl. note: adding test dep was probably redundantly performed under project write lock, removing it seems safe: 1) code works with its own copy of project.xml fragment and putConfigurationData() enters write lock itself 2) adding regular dep works in the same manner without the lock 3) it doesn't break any test :)
Integrated into 'main-golden', will be available in build *200905220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/7448ebb20b8a User: Richard Michalsky <rmichalsky@netbeans.org> Log: #165098: fixing propagation of unit test classpath change
Verified in JavaSE version of nightly build #200905221401