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 190080 - Allow to set position and multiple paths in debugger service registration
Summary: Allow to set position and multiple paths in debugger service registration
Status: RESOLVED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 157767 186517
  Show dependency tree
 
Reported: 2010-09-01 16:06 UTC by Martin Entlicher
Modified: 2010-09-11 03:38 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
The proposed API change including test. (35.74 KB, patch)
2010-09-01 17:17 UTC, Martin Entlicher
Details | Diff
Modified API change that keeps binary compatibility of annotations. (44.23 KB, patch)
2010-09-07 13:44 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2010-09-01 16:06:54 UTC
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.
Comment 1 Martin Entlicher 2010-09-01 17:17:48 UTC
Created attachment 101810 [details]
The proposed API change including test.
Comment 2 Martin Entlicher 2010-09-01 17:23:06 UTC
@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.
Comment 3 Jaroslav Tulach 2010-09-01 19:04:44 UTC
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})
})
Comment 4 Martin Entlicher 2010-09-02 20:57:16 UTC
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()
Comment 5 Jaroslav Tulach 2010-09-06 14:41:25 UTC
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.
Comment 6 Quality Engineering 2010-09-07 03:12:38 UTC
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.
Comment 7 Martin Entlicher 2010-09-07 13:44:31 UTC
Created attachment 101915 [details]
Modified API change that keeps binary compatibility of annotations.
Comment 8 Martin Entlicher 2010-09-07 13:46:54 UTC
Y01) Thanks for your comments, I've attached modified API change that introduces the compound annotations.
Comment 9 Quality Engineering 2010-09-08 03:28:54 UTC
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.
Comment 10 Martin Entlicher 2010-09-09 15:11:47 UTC
Thanks for the review, I'll push that change tomorrow.
Comment 11 Martin Entlicher 2010-09-10 17:04:07 UTC
Pushed as changeset:   177346:56b812ba092b
http://hg.netbeans.org/main/rev/56b812ba092b
Comment 12 Quality Engineering 2010-09-11 03:38:17 UTC
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.