apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 846 forks source link

The synchronized modifier guarantees method body consistency #7850

Open assdfsdafasfa opened 3 days ago

assdfsdafasfa commented 3 days ago

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

neilcsmith-net commented 3 days ago

Please stop swamping the issue board. This helps no-one. Either stop reporting for a while, or ideally collate these into an overarching issue.

mbien commented 3 days ago

commented on the first issue of the batch https://github.com/apache/netbeans/issues/7840#issuecomment-2400879923

assdfsdafasfa commented 3 days ago

Please stop swamping the issue board. This helps no-one. Either stop reporting for a while, or ideally collate these into an overarching issue.

Thanks for the heads up, I was going through the test methods and found the causes of the errors for the different refactoring types, they are different in detail, I hope you can take a look at them and fix them!