Inline methods make the try-catch block empty, causing compilation errors
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 23
### What happened
When the "methodToBeInlined()" method is selected for the Inline method refactoring, it causes a refactoring bug, because empty try catch block content cannot trigger an exception, resulting in a syntax error.
class SourceClass{
public void methodToBeInlined() throws IOException{}
public void callerMethod(){
try{
methodToBeInlined()
}catch(IOException e){
e.printStackTrace();
}
}
}
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
When the "methodToBeInlined()" method is selected for the Inline method refactoring, it causes a refactoring bug, because empty try catch block content cannot trigger an exception, resulting in a syntax error.
class SourceClass{
public void methodToBeInlined() throws IOException{}
public void callerMethod(){
try{
methodToBeInlined()
}catch(IOException e){
e.printStackTrace();
}
}
}
### Did this work correctly in an earlier version?
Apache NetBeans 23
### Operating System
Windows11
### JDK
20
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Reproduce the failure in NetBeans 23 using the supplied SourceClass example and the Inline method refactoring. Start by locating the inline-method refactoring implementation and its regression tests; done means the refactoring no longer leaves an invalid empty try-catch structure or produces a compilation error.
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
- Mostly clear
- Newbie friendliness
- 45/100