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.
Let's say I have a class (class MyClass) which calls a method on a class (class Doberman) which implements an interface (interface Dog), and the method is defined in the interface (interface Dog). If I go to the line in class MyClass where I call myDog.bark() and I 'Go To Source | Declaration', I get taken to the Dog interface's bark method. There should be a way to go to the Doberman implementation's bark method (e.g. Go To Implementation). NB can figure out that myDog is an implementation of Doberman and take me to the implementation's bark method. This is almost alway what I want to do...rather then go to the interface's bark method. The same can be said for classes that extend abstract classes. public class MyClass { public static void main(String[] args) { Dog myDog = new Doberman(); myDog.bark(); } } public interface Dog { public void bark(); } public class Doberman implements Dog { public void bark() { System.out.println("ruff"); } }
> NB can figure out that myDog is an implementation of Doberman ... In general this is quite tricky to do. It may look simple in your example, but how about code like this one: Dog myDog = Lookup.getDefault().lookup(Dog.class); There is no way how the IDE could guess what the lookup call would return. The only thing you can do is to find all implementations of the Dog interface visible in the scope of this statement and give a user chance to choose one.
There are several "go to implementation" issues. I'm trying to clean them up. Listing all implementations when you Ctrl+click a method name is covered by bug 142112. For reference purposes, if the Debugger is running and myDog is in the current scope, NetBeans *would* know that it was an implementation of Doberman and could navigate to the correct implementation when you Ctrl+click. *** This bug has been marked as a duplicate of bug 142112 ***