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.
Noticing an unnecessarily complex idiom in PlatformInstallTest.java, I tried to write a rule to simplify it: diff --git a/nbjunit/src/META-INF/upgrade/NbModuleSuite.hint b/nbjunit/src/META-INF/upgrade/NbModuleSuite.hint --- a/nbjunit/src/META-INF/upgrade/NbModuleSuite.hint +++ b/nbjunit/src/META-INF/upgrade/NbModuleSuite.hint @@ -2,3 +2,8 @@ => $c.suite() ;; + +org.netbeans.junit.NbModuleSuite.emptyConfiguration().addTest($c) :: $c instanceof java.lang.Class<? extends junit.framework.TestCase> +=> +org.netbeans.junit.NbModuleSuite.createConfiguration($c) +;; diff --git a/nbjunit/test/unit/src/META-INF/upgrade/NbModuleSuite.test b/nbjunit/test/unit/src/META-INF/upgrade/NbModuleSuite.test --- a/nbjunit/test/unit/src/META-INF/upgrade/NbModuleSuite.test +++ b/nbjunit/test/unit/src/META-INF/upgrade/NbModuleSuite.test @@ -12,3 +12,20 @@ return org.netbeans.junit.NbModuleSuite.createConfiguration(SomeTest.class).gui(false).suite(); } } +%%TestCase createConfiguration +package test; +public class SomeTest extends org.netbeans.junit.NbTestCase { + public static junit.framework.Test suite() { + return org.netbeans.junit.NbModuleSuite.emptyConfiguration().addTest(SomeTest.class).gui(false).suite(); + } +} +%%=> +package test; + +import org.netbeans.junit.NbModuleSuite; + +public class SomeTest extends org.netbeans.junit.NbTestCase { + public static junit.framework.Test suite() { + return NbModuleSuite.createConfiguration(SomeTest.class).gui(false).suite(); + } +} Unfortunately the *.test says "incorrect output" and when it offers to put "actual output" into golden section, it just writes ... %%=> NbModuleSuite:addTest Also in the actual source file, the hint offers no fix, and the warning says just "NbModuleSuite". I also see in my log file: INFO [org.netbeans.api.java.source.ElementHandle]: Cannot resolve: ElementHandle[kind=CLASS; sigs=$.$ ] If I comment out the "<? extends junit.framework.TestCase>" qualifier, then the test passes and the hint works. Unfortunately that is not safe in this case, since addTest(Class<? extends Test>) is a different overload that behaves differently and cannot be rewritten using this rule.
Workaround: place a space between "<" and "?". I'll see if this can be fixed, or if this workaround must be documented as the only way to express wildcards.
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