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 200048

Summary: @TopComponent.Registration annotation can not be used on methods.
Product: platform Reporter: Martin Entlicher <mentlicher>
Component: Window SystemAssignee: Jaroslav Tulach <jtulach>
Severity: normal CC: jglick, saubrecht
Priority: P3 Keywords: API
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 191407    
Attachments: NullPointerException

Description Martin Entlicher 2011-07-11 13:43:56 UTC
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.
Comment 1 Stanislav Aubrecht 2011-07-12 09:06:02 UTC
no exception message attached...
Comment 2 Martin Entlicher 2011-07-12 09:32:23 UTC
Created attachment 109388 [details]
Comment 3 Martin Entlicher 2011-07-12 09:34:20 UTC
The exception is not really important here, although the requirement of the @Description annotation could be expressed in a better way.
Comment 4 Stanislav Aubrecht 2011-07-12 09:36:22 UTC
reassigning to the author of the processor
Comment 5 Jaroslav Tulach 2011-07-14 09:25:49 UTC
Comment 6 Jaroslav Tulach 2011-07-14 09:26:50 UTC
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...
Comment 7 Jesse Glick 2011-07-14 11:22:00 UTC
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.
Comment 8 Quality Engineering 2011-07-17 13:59:05 UTC
Integrated into 'main-golden', will be available in build *201107170600* on (upload may still be in progress)
User: Jaroslav Tulach <>
Log: #200048: @TopComponent.Registration annotation can not be used on methods.
Don't throw NPE when registering TopComponent via factory method
Comment 9 Jaroslav Tulach 2011-07-27 12:29:51 UTC
OK, removed in ergonomics#6de28830a6c6
Comment 10 Quality Engineering 2011-07-30 13:47:48 UTC
Integrated into 'main-golden'
User: Jaroslav Tulach <>
Log: #200048: Changing the @Target of TopComponent.Registration. Generally it makes sense only on types