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 153093 - Use of annotations in debugger SPIs
Summary: Use of annotations in debugger SPIs
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Martin Entlicher
URL: http://wiki.netbeans.org/DeclarativeR...
Keywords: API, API_REVIEW_FAST
Depends on: 147393 156687
Blocks: 150804 157767
  Show dependency tree
 
Reported: 2008-11-12 23:34 UTC by Jesse Glick
Modified: 2009-02-19 20:38 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
The API changes associated with the introduction of annotations for debugger services (37.12 KB, text/plain)
2009-01-25 19:11 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2008-11-12 23:34:38 UTC
For whatever reason, the original debugger-related SPIs began to use their own object registration system. I guess this
was before Lookups.forPath and META-INF/namedservices, or maybe there was simply a reluctance to rely on
org.openide.util.Lookup.

Anyway, there are now hundreds of objects registered using this system, and module developers would benefit from being
able to use annotations to register them. See the wiki link for ideas.

Please consider defining appropriate annotations and matching processors in the debugger SPIs, and updating netbeans.org
modules to use the new annotations. It should not be much work (need API_REVIEW_FAST of course).
Comment 1 Jaroslav Tulach 2008-11-13 10:04:23 UTC
Proper declarative registration could prevent needless classloading (register providers to some file mime-type, 
provide declarative names for Attach, Breakpoint, etc. types to prevent the object classes from being loaded unless 
really needed, and probably more). Moreover annotations are nicer for its users and can shield them from gory details 
of the actual registration.
Comment 2 Jesse Glick 2008-11-13 16:30:27 UTC
This issue is simply about offering annotations as a convenience for creating registrations via the existing SPI. If
there is indeed any potential performance gain in making the debugger registration SPIs even lazier than they already
are (which from a casual inspection I doubt), wonderful, but that would be an entirely separate effort. Please do not
conflate the two.
Comment 3 Jaroslav Tulach 2008-11-20 11:46:12 UTC
It will be wonderful to fix both issues (beatification as well as performance) at once.
Comment 4 Martin Entlicher 2008-11-21 11:04:08 UTC
Referencing the dependent issues and scheduling for 7.0.
Comment 5 Jesse Glick 2008-11-21 17:59:31 UTC
Issue #149136 is probably not relevant, since debugger registrations do not use the SFS.
Comment 6 Jaroslav Tulach 2008-11-21 23:18:20 UTC
Actually, from my point of view, a little cooperation with system file system would not be bad. Maybe the 
DebuggerManager.lookup:
http://bits.netbeans.org/dev/javadoc/org-netbeans-api-debugger/org/netbeans/api/debugger/DebuggerManager.html#lookup(java.lang.String, 
java.lang.Class)
could be changed to do what it does now, plus delegate to Lookups.forPath("Debugger/" + folder), with such change, we 
would keep compatibility + we could rewrite all our modules to use the common infrastructure of SFS, Annotations and 
forPath.

Rationale: For http://wiki.netbeans.org/FitnessForever we need to dynamically register AttachType providers. This is 
much easier to do with SFS than META-INF/something entries.
Comment 7 Martin Entlicher 2009-01-13 14:24:01 UTC
The definition of annotations and matching processors is really a separate issue from changing the debugger lookup to
delegate to Lookups.forPath(). I'm going to submit a separate issue for that, because things are not so trivial.

org.netbeans.api.debugger.Lookup does much more things than org.openide.util.lookup.MetaInfServicesLookup.
It uses "-hidden" concept inside of files listing the services, factory methods, lazy instantiation.
Using of org.openide.util.lookup.MetaInfServicesLookup in it's current form would be a step back and if we rewrite some
of our modules to use it, "-hidden" concept would stop working, therefore it would be an incompatible change.

A possible solution could be to just add org.openide.loaders.FolderLookup to the current debugger lookup, or better,
create DebuggerMetaInfServicesLookup - copy of org.openide.util.lookup.MetaInfServicesLookup with the logic of
org.netbeans.api.debugger.Lookup.MetaInf and compose it together in the same way as
org.netbeans.modules.settings.RecognizeInstanceObjects.
Comment 8 Martin Entlicher 2009-01-13 14:29:30 UTC
Please see issue #156687 for the functional improvements to o.n.a.d.Lookup.
Comment 9 Martin Entlicher 2009-01-25 19:10:01 UTC
This actually depends on the changes in the debugger's lookup system - issue #156687.
Comment 10 Martin Entlicher 2009-01-25 19:11:28 UTC
Created attachment 76210 [details]
The API changes associated with the introduction of annotations for debugger services
Comment 11 Martin Entlicher 2009-01-25 19:13:46 UTC
Please review this change.
See http://www.netbeans.org/nonav/issues/showattachment.cgi/76208/156687_153093_ALL_CHANGE.diff or issue #156687 for the
list of all changes associated with this change.
Attachment 153093 [details]_API_CHANGE.diff attached here contains just the API part of the annotations introduction.
Comment 12 Martin Entlicher 2009-01-30 14:34:04 UTC
Thanks for the review.
I plan to commit this on Sunday, together with issue #156687. With complete Javadoc and at least some services
registered through the new annotations.
Comment 13 Martin Entlicher 2009-02-02 12:30:45 UTC
Thanks for the review.
Comment 14 Martin Entlicher 2009-02-02 12:33:36 UTC
Integrated together with issue #156687.
Mainly in changesets:
http://hg.netbeans.org/main/rev/96d7b0b3803c
http://hg.netbeans.org/main/rev/5f3aa6b76a52
http://hg.netbeans.org/main/rev/afa36905aafa
Comment 15 Martin Entlicher 2009-02-02 12:40:12 UTC
FYI: I've created issue #157767 to actually use these annotations to register all debugger services.
Comment 16 Quality Engineering 2009-02-03 08:32:54 UTC
Integrated into 'main-golden', will be available in build *200902030229* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/96d7b0b3803c
User: mentlicher@netbeans.org
Log: #153093 - After Lookups.forPath() was added to debugger's Lookup.MetaInf, generate declarative registration of debugger services into module layer via annotations. Tests added.
Comment 17 Martin Entlicher 2009-02-09 16:19:37 UTC
FYI: One small addition was integrated to this. "position" attribute was added to AttachType and BreakpointType annotations:
http://hg.netbeans.org/main/rev/26a28ce42b30
Comment 18 Quality Engineering 2009-02-18 10:48:07 UTC
Integrated into 'main-golden', will be available in build *200902180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/26a28ce42b30
User: mentlicher@netbeans.org
Log: #153093 - position attribute added to AttachType and BreakpointType annotations.
Comment 19 Jaroslav Tulach 2009-02-18 12:23:12 UTC
position attribute is good, but don't forget to use it. At least in JPDA.