Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321157 - [navigation] 'Open Implementation' should work for private methods seamlessly
Summary: [navigation] 'Open Implementation' should work for private methods seamlessly
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Raksha Vasisht CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-28 13:41 EDT by Kaj Kandler CLA
Modified: 2010-09-14 15:21 EDT (History)
2 users (show)

See Also:


Attachments
Fix (7.44 KB, patch)
2010-08-11 06:53 EDT, Raksha Vasisht CLA
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kaj Kandler CLA 2010-07-28 13:41:27 EDT
Build Identifier: 20100617-1415

The Navigate->Open Implementation call complains ("The operation is not applicable to the current selection. Select an overridable method") about a method that is private. 

This is rather annoying. Instead the call should fall back to open the method directly. That way a user does not have to think about if a given method is an interfaced method or a direct method. Only when you really want to navigate to the Interface you will have to think about Interfaces and Implementations.

This is annoying, because if you navigate code you don't know intimately you won't know before hand if the method is overridable and so have to do multiple clicks before you get where you intended to go. This call is about fast and quick navigation and such de-tours are the opposite of the goal.

Reproducible: Always

Steps to Reproduce:
1. Select the call of a private method in your Java Editor
2. Select Navigate-->Open Implementation
3.
Comment 1 Dani Megert CLA 2010-07-29 02:17:25 EDT
I completely agree. This is just an oversight. Also nee to fix (Ctrl+click > Open Implementation).

Test Case:
public class Test {

	void doit() {
		priv(); // does not work
		pack(); // works
		publi();// works
	}

	private void priv() {}
	void pack() {}
	public void publi() {}
}
Comment 2 Markus Keller CLA 2010-08-02 09:13:54 EDT
Open Implementation should also work for static methods.

I would even let it call Open Declaration if there's no other implementation. That way, Open Implementation could be used as a replacement for people who always want to jump to the implementation directly. Missing functionality could then be added gradually (e.g. bug 294769).
Comment 3 Raksha Vasisht CLA 2010-08-11 06:53:21 EDT
Created attachment 176322 [details]
Fix

The check for overridable method is removed now for both open implementation hyperlink and command and it now works on any method. In case of non-overridable methods it directly opens the method declaration using open action.
Comment 4 Dani Megert CLA 2010-08-13 04:36:10 EDT
The patch looks good except that you inlined the canBeOverriddenMethod(...) code into openImplementations(...). We should keep that code in a separate method (in JavaElementImplementationHyperlink).
Comment 5 Raksha Vasisht CLA 2010-08-15 17:13:27 EDT
(In reply to comment #4)
> The patch looks good except that you inlined the canBeOverriddenMethod(...)
> code into openImplementations(...). We should keep that code in a separate
> method (in JavaElementImplementationHyperlink).

Extracted the method and committed to HEAD.
Comment 6 Markus Keller CLA 2010-09-14 15:21:29 EDT
Verified in I20100914-0100 Cocoa.