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.
Registration of debugger services is done via @DebuggerServiceRegistration annotation. however, this annotation does not allow to specify the order of the service (which is necessary in the case of view filters) and does not allow to specify multiple paths (for the case that one service is reused in multiple views). Also, in some cases we need to be able to define multiple different registrations for a single instance. Therefore we need a way how to provide multiple @DebuggerServiceRegistration annotations.
Created attachment 101810 [details] The proposed API change including test.
@DebuggerServiceRegistrations annotation is introduced as a wrapper of several @DebuggerServiceRegistration annotations. In @DebuggerServiceRegistration we change String path() default ""; to String[] path() default {""}; which should be compatible from the API users point of view. Also we add int position() default Integer.MAX_VALUE; Similarly we change "String path()" to "String[] path()" in ActionsProvider.Registration and ColumnModelRegistration.
Y01 Don't change type of an attribute. Changing type of attribute is source compatible, but code like: String value = annotation.path(); would no longer compiler and link. So the change is not binary compatible. I don't think you need this change anyway. Instead of @DebuggerServiceRegistrations({ @DebuggerServiceRegistration(path="unittest/annotated1", types=TreeModel.class), @DebuggerServiceRegistration(path={"unittest/annotated2", "unittest/annotated3"}, types={NodeModel.class, TableModel.class}) }) you can write: @DebuggerServiceRegistrations({ @DebuggerServiceRegistration(path="unittest/annotated1", types=TreeModel.class), @DebuggerServiceRegistration(path="unittest/annotated3", types={NodeModel.class, TableModel.class}), @DebuggerServiceRegistration(path="unittest/annotated2", types={NodeModel.class, TableModel.class}) })
Y01: Using @DebuggerServiceRegistrations for multiple paths is possible, though not very practical, mainly in case of ActionsProvider.Registration.path() and ColumnModelRegistration.path() we'd need also ActionsProvider.Registrations and ColumnModelRegistrations. I do not think that binary compatibility is a real problem in annotations that are processed by compiler. IMHO calling annotation.path(); in a 3rd party code is really a corner case. But if we insist on binary compatibility in this case, I can think of adding something like: /** * Optional paths relative to {@link #path()} to register this implementation in. * Usually the session ID, view name, etc. * @since 1.28 */ String[] relativePaths() default {}; In fact path() itself is relative to "/Debugger" path already. Thus relativePaths() would be relative to "/Debugger"+path()
The usage of special relpath is acceptable solution. Its only drawback is that it would be unique for debugger. I'd like to re-advocate @SomeAnnotations (with s at the end). That is how we generally solve the issues of multiple annotations on an element - thus users will see consistency and consistency is good. We already have: http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-lib2/org/netbeans/api/editor/EditorActionRegistrations.html http://bits.netbeans.org/dev/javadoc/org-openide-util-lookup/org/openide/util/lookup/ServiceProviders.html http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/ActionReferences.html I think it would be consistent and beneficial to have also DebuggerServiceRegistrations, ActionsProvider.Registrations and ColumnModelRegistrations.
Integrated into 'main-golden', will be available in build *201009070000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/04d674b90c8a User: mentlicher@netbeans.org Log: #190080 Adapt views to various extensions of TreeModel and NodeModel, for correct lookup result.
Created attachment 101915 [details] Modified API change that keeps binary compatibility of annotations.
Y01) Thanks for your comments, I've attached modified API change that introduces the compound annotations.
Integrated into 'main-golden', will be available in build *201009080000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/04d674b90c8a User: mentlicher@netbeans.org Log: #190080 Adapt views to various extensions of TreeModel and NodeModel, for correct lookup result.
Thanks for the review, I'll push that change tomorrow.
Pushed as changeset: 177346:56b812ba092b http://hg.netbeans.org/main/rev/56b812ba092b
Integrated into 'main-golden', will be available in build *201009110000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/56b812ba092b User: mentlicher@netbeans.org Log: #190080 Allow multiple debugger service registrations and position order.