参数由long替换为Long,redefine后报NoSuchMethodError
- Dominant language
- Java
- Stars
- 37.5k
- Forks
- 7.6k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 4
Description
- [x] 我已经在 [issues](https://github.com/alibaba/arthas/issues) 里搜索,没有重复的issue。
### 环境信息
* `arthas-boot.jar` 或者 `as.sh` 的版本:`3.1.4`
* Arthas 版本: `3.1.4`
* 操作系统版本: `macOS 10.15`(并且在Linux上能重现)
* 目标进程的JVM版本: `1.8.0_222`
* 执行`arthas-boot`的版本: `1.8.0_222`
### 重现问题的步骤
1. 用旧代码启动进程
旧代码
public class Main {
private static void test(long val) {
System.out.println(val);
}
public static void main(String[] args) throws InterruptedException {
while (true) {
Thread.sleep(1000);
test(1L);
}
}
}
2. 编译新代码,得到Main.class
新代码
public class Main {
private static void test(Long val) {
System.out.println(val);
}
public static void main(String[] args) throws InterruptedException {
while (true) {
Thread.sleep(1000);
test(1L);
}
}
}
3. 启动arthas,执行命令`redefine /path/to/Main.class`
### 期望的结果
`redefine error! java.lang.UnsupportedOperationException: class redefinition failed: attempted to delete a method`
*这也是java11下的表现*
### 实际运行的结果
*java8下*
`redefine success, size: 1`
说明重定义成功,但是主进程报错:
```
Exception in thread "main" java.lang.NoSuchMethodError: Main.test(J)V
at Main.main(Main.java:9)
```
Contributor guide
Research direction
Reproduce the issue with the old and new Main.java versions, then run the documented redefine /path/to/Main.class command on Java 8 and Java 11. Compare the reported redefinition result with the main process behavior; done means the redefine outcome is consistent and the process does not fail with the shown NoSuchMethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100