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 207003 - Need proper API for accessing SelfSamplerAction
Summary: Need proper API for accessing SelfSamplerAction
Status: RESOLVED DUPLICATE of bug 206859
Alias: None
Product: profiler
Classification: Unclassified
Component: Ide (show other bugs)
Version: 7.2
Hardware: All All
: P4 normal (vote)
Assignee: issues@profiler
URL:
Keywords: API
Depends on:
Blocks: 205798
  Show dependency tree
 
Reported: 2012-01-06 20:54 UTC by Jesse Glick
Modified: 2012-01-06 22:19 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-01-06 20:54:53 UTC
While checking for possible uses of the API in bug #205798 I found a number of cases where code scattered across the IDE is looking up @ActionID(id="org.netbeans.modules.profiler.actions.SelfSamplerAction", category="Profile") using various code idioms and then asking its eager delegate for various logger-* attributes which get cast to Runnable.

main$ hg locate -r . -0 \*\*.java | xargs -0 grep -l SelfSamplerAction
core.ui/src/org/netbeans/core/ui/sampler/SelfSamplerAction.java
editor.completion/src/org/netbeans/modules/editor/completion/CompletionImplProfile.java
jumpto/src/org/netbeans/modules/jumpto/type/GoToTypeAction.java
o.n.core/src/org/netbeans/core/TimableEventQueue.java
parsing.api/src/org/netbeans/modules/parsing/impl/SelfProfile.java
performance/src/org/netbeans/modules/performance/utilities/PerformanceTestCase.java
profiler/test/unit/src/org/netbeans/modules/profiler/actions/SelfSamplerActionTest.java

It is unclear from reading code what this is supposed to do, and seems quite fragile. Recommend introducing and using a proper API for working with the self-sampler, perhaps along the lines of:

package TBD;
public abstract class SelfSampler {
  public static void run(String label) {
    SelfSampler s = Lookup.getDefault().lookup(SelfSampler.class);
    if (s != null) s.doRun(label);
  }
  protected abstract void doRun(String label);
}
Comment 1 Jesse Glick 2012-01-06 22:19:55 UTC
Weird, I just happened to come across this issue at about the same time as you. :-)

*** This bug has been marked as a duplicate of bug 206859 ***