Is there any editor for Java that is capable of highlighting all inherited members? It seems to be a very useful feature to aid in understanding the structure of the derived class that accesses members of the base class(es). I'm personally using Intellij-IDEA
and if you are aware of any way to that there, please do share. All other editors are welcome!
For example you can sometimes see the following scenario (and please do not consider this example serious).
class A {
...
protected int a;
protected int x;
...
}
class B extends A {
...
protected int b;
void isntThatCoolIfSomeoneOverridesA() {
a = b;
x = b * b;
}
...
}
UPDATE: extended the example
The usage of a
and x
in class B
needs to be highlighted, because both are the inherited data members of class A
.
Eclipse:
It is possible to highlight invocations of inherited methods, but not for fields. You may turn this on in Preferences dialog, under Java -> Editor -> Syntax Coloring. In elements list view, choose Java -> Inherited method invocations, check Enable and edit how it should be highlighted.
NetBeans: Right-click -> Navigate -> Inspect hieararchy
You can also switch the logic - top-down or bottom-up
Non-editor options:
IntelliJ:
If the classes are defined in the same source file, the normal variable highlighting does this. You can highlight on demand using Search
-> Highlight Usages in File
. Alternatively, enable Settings
-> Editor
-> Highlight usages of element at caret
) to always highlight the element in which the editor caret is placed.
Search
-> Find Usages
is often more useful, as it searches a scope (typically the project sources) for usages of a variable, field, member, class ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With