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 156387

Summary: "Add as profiling root method" refuses to work in most positions
Product: profiler Reporter: Jesse Glick <jglick>
Component: BaseAssignee: Petr Cyhelsky <cyhelsky>
Status: NEW ---    
Severity: blocker CC: jlahoda
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Jesse Glick 2009-01-07 00:01:04 UTC
090105. If I open, say, JarClassLoader.java from o.n.bootstrap, and place the caret inside the body of
initializeCache(), and choose Profiling > Add as Profiling Root Method from the context menu, the IDE says "No method
found at current position".

It seems that it only works if the caret is actually on the identifier of the method name or right after the opening
parenthesis. This is in contrast to other IDE functions which are much more forgiving. I guess
SourceUtils.resolveMethodAtPosition is at fault: TreeUtilities.getPathFor is right (*) but should be asked to traverse
upwards, as in contrib/java.gotoimpl/src/org/netbeans/modules/java/gotoimpl/GoToImplementation.java, which it seems
should be made into some kind of convenience API.

(*) This class has little Javadoc so it is hard to know for sure.
Comment 1 Jiri Sedlacek 2009-03-23 12:50:18 UTC
This is not a defect, the feature works (already several years) as designed -> changing to ENHANCEMENT.

I agree that resolving the root method should be more user-friendly: if there's no method at the caret, the profiler
should try to resolve an enclosing method. However, there's a potential usability issue with this approach - whereas for
example Find Usages action immediately displays a dialog with highlighted resolved element, the profiler uses a
different workflow and doesn't display this information.

It's not a good idea to continue with some guessed element without letting know the user. Implementing this enhancement
requires some UI & workflow changes, not for 6.7.
Comment 2 Quality Engineering 2009-03-25 09:27:36 UTC
Integrated into 'main-golden', will be available in build *200903250219* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/97e9ab05b19b
User: Jaroslav Bachorik <yardus@netbeans.org>
Log: #156387 - improved handling of GoToSource for java files in live profiling results
Comment 3 Tomas Hurka 2009-04-08 12:55:15 UTC
Milestone cleanup: future->next
Comment 4 J Bachorik 2012-08-01 08:33:57 UTC
changing owner