I'm not a newbie of Java and Eclipse, this question is not as easy as Alt
+ Shift
+ R
or Refactor
> Rename
Assume there is a method in utils.jar
.
public class A {
public void taste() {}
}
Then I used it in current project.
public class taste {
public static void taste() {
A taste = new A();
return taste.taste();
}
}
OK, now I found taste
in utils.jar
is not the word I want, then I changed the utils.jar
to test
:
public class A {
public void test() {}
}
So, after that, how could I change A.taste()
to A.test()
precisely just like use Alt
+ Shift
+ R
?
public class taste {
public static void taste() {
A taste = new A();
return taste.test(); // only change function A.taste to test
}
}
I found that Search
> Java
can find the A.taste
function precisely, but I have no idea how to replace all of it to test
.
在这种情况下, Alt + Shift + R可能很有用。
Put the old source code of A
in your project. Eg src/some_package/A.java
This overrides the class from the library utils.jar
Use the refactoring tool to rename the method.
You can do this now, because the source code of A
is available
A
from your project utils.jar
to your project
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.