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
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).
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.
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.
It will be wonderful to fix both issues (beatification as well as performance) at once.
Referencing the dependent issues and scheduling for 7.0.
Issue #149136 is probably not relevant, since debugger registrations do not use the SFS.
Actually, from my point of view, a little cooperation with system file system would not be bad. Maybe the
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
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.
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
Please see issue #156687 for the functional improvements to o.n.a.d.Lookup.
This actually depends on the changes in the debugger's lookup system - issue #156687.
Created attachment 76210 [details]
The API changes associated with the introduction of annotations for debugger services
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.
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.
Thanks for the review.
Integrated together with issue #156687.
Mainly in changesets:
FYI: I've created issue #157767 to actually use these annotations to register all debugger services.
Integrated into 'main-golden', will be available in build *200902030229* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
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.
FYI: One small addition was integrated to this. "position" attribute was added to AttachType and BreakpointType annotations:
Integrated into 'main-golden', will be available in build *200902180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #153093 - position attribute added to AttachType and BreakpointType annotations.
position attribute is good, but don't forget to use it. At least in JPDA.