netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

The synchronized modifier guarantees method body consistency

Open assdfsdafasfa opened this issue 1 year ago • 3 comments

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

assdfsdafasfa avatar Oct 08 '24 13:10 assdfsdafasfa

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

neilcsmith-net avatar Oct 08 '24 13:10 neilcsmith-net

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

mbien avatar Oct 08 '24 22:10 mbien

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!

assdfsdafasfa avatar Oct 09 '24 00:10 assdfsdafasfa