The synchronized modifier guarantees method body consistency
- 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 the inline method contains a syx modifier, but after refactoring, there is no method body missing the syx modifier, resulting in a change in access permissions.
class SourceClass{
private boolean flag = false;
public synchronized void method() {
flag = true;
}
public void callerMethod(){
method() ;
}
}
### 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 the inline method contains a syx modifier, but after refactoring, there is no method body missing the syx modifier, resulting in a change in access permissions.
class SourceClass{
private boolean flag = false;
public synchronized void method() {
flag = true;
}
public void callerMethod(){
method() ;
}
}
### 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
Start with the Inline method refactoring entry point and reproduce the issue using the SourceClass example in the report. Trace how the synchronized modifier is handled when method() is inlined into callerMethod(); done means the refactoring preserves the method body's synchronization semantics and access behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100