bytekit API 和 功能
- Dominant language
- Java
- Stars
- 37.5k
- Forks
- 7.6k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 4
Description
字节码插入主要是先确定某个 Location,比如 method enter/exit 。
有一些点要考虑的:
1. 插入的代码是否要用 try/catch 包围,因为插入的代码本身是有可能出错的,要保证自己出错时,不影响应用原来的逻辑。
比如:
```java
public int returnInt(int i) {
return 9998;
}
```
在method enter插入一行代码之后,变成:
```java
public int returnInt(int i) {
Interceptor.onEnter();
return 9998;
}
```
有可能出现的问题是:
* `Interceptor`类加载不到,尽管arthas已经尽管避免这个问题了
* `Interceptor.onEnter();` 本身抛出异常影响了应用本身的逻辑
所以插入的代码需要是这样子的?
```java
public int returnInt(int i) {
try {
Interceptor.onEnter();
} catch (Throwable e) {
}
return 9998;
}
```
Contributor guide
Research direction
The issue names no files, tests, or implementation entry points. Start by locating the bytecode insertion API and the method-enter/exit handling, then determine the intended behavior for interceptor class-loading failures and thrown exceptions; done requires an agreed API and defined failure-isolation semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100