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.
When I put the annotation on a method that returns TopComponent, I get attached exception during compilation. After going to the source code to see what's wrong, I've found that the code looks for @Description annotation on the element. But @Description can not be added to methods. Therefore @Registration annotation can not be used on methods.
no exception message attached...
Created attachment 109388 [details] NullPointerException
The exception is not really important here, although the requirement of the @Description annotation could be expressed in a better way.
reassigning to the author of the processor
ergonomics#0f5a34096965
I fixed the NPE and modified the test to show how to use @Registration on a method. But I am not sure, you'll be very pleased...
The fix does not make much sense; there is no point in using factory methods if they all must share the same preferredId. Better to admit that @TC.R is useless on methods and just remove that target from the annotation declaration. Due to this NPE, nobody could be using it in that capacity yet anyway, so it would not be an incompatible change.
Integrated into 'main-golden', will be available in build *201107170600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/0f5a34096965 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #200048: @TopComponent.Registration annotation can not be used on methods. Don't throw NPE when registering TopComponent via factory method
OK, removed in ergonomics#6de28830a6c6
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/6de28830a6c6 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #200048: Changing the @Target of TopComponent.Registration. Generally it makes sense only on types