Does eclipse have a tool that can create Merged
from A
and B
?
public class A {
int a;
public int getA(){
return A;
}
}
public class B extends A {
int b;
public int getB(){
return b;
}
}
public class Merged {
int a;
int b;
public int getA(){
return A;
}
public int getB(){
return b;
}
}
Press Ctrl+Shift+H -or- from the Menu Bar go to Navigate | Open Type in Hierarchy. The "Open Type in Hierarchy" dialog is displayed.
You can ctrl-click on the variable name and you get to the variable declaration. And then you can ctrl-click on the type to get to the class definition.
Step 1: Open Eclipse and click File > New > Java Project. Step 2: Provide the Project Name and click on the Finish button. Step 3: In the Package Explorer (left-hand side of the window) select the project which you have created. Step 4: Right-click on the src folder, select New > Class from the submenu.
I don't think so. It's not so simple task. Your example is simple, but consider this:
class A {
private int a;
public void foo(){
System.out.println(a);
}
}
class AA extends A {
private int a; //its not the same 'a'!!
public void foo(){ //ok, we override, so we can 'overwrite', but...
super.foo(); //... what with this?
System.out.println(a);
}
}
As you can see, its hard to automate. And what if some class in this hierarchy extends some lib class, for which you don't have sources? So, merging is hard, and very very bad, thats why I don't think anyone wrote such tool.
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