关于方法替换
- Dominant language
- C++
- Stars
- 7k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
旧方法:
```
...
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
func();
}
});
public void func(){
Toast.makeText(this,"我是一个错误的方法,"+i,Toast.LENGTH_SHORT).show();
}
...
```
现在我想修复func方法,写下如下代码:
```
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
func();
}
});
public void func(){
myFunc();
}
private void myFunc() {
Toast.makeText(this,"我是更新的方法 "+i,Toast.LENGTH_SHORT).show();
hello();
}
public void hello(){
Log.d("TAG", "hello");
Toast.makeText(this,"haha "+i,Toast.LENGTH_SHORT).show();
}
```
打patch包后,运行时crash,报nosuchmethod 异常,找不到hello方法.
请问这是什么原因?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing the old and patched code snippets and reproduce the crash with the patch package. Capture the complete NoSuchMethod exception and verify how the replacement handles the newly introduced hello method; done means documenting the cause and the compatible change needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100