DongChunHao opened a new issue, #7297:
URL: https://github.com/apache/netbeans/issues/7297

   ### Apache NetBeans version
   
   Apache NetBeans 21
   
   ### What happened
   
   When I select "originalMethod()" and perform the inline method refactoring, 
and i click "OK":
   
   public class OriginalClass {
        private boolean flag = false;
   
       public synchronized void originalMethod() throws InterruptedException {
           flag = true;
           notify();
       }
   
       public void callerMethod() throws InterruptedException {
           // inline method refactoring
        originalMethod() ;
       }
   }
   
   refactoring result:
   
![image](https://github.com/apache/netbeans/assets/77560508/d47b70a9-844f-43fa-bdf6-276cddaae92e)
   
   Missing synchronized keyword restriction; After inlining methods, 
multi-threaded calls may cause communication issues between threads, making it 
difficult for waiting threads to be awakened correctly
   
   Expected result:  When performing inline method refactoring on methods with 
the synchronized keyword, synchronized internal block restrictions should be 
added to the method body or refactoring should not be performed.
   
   ### Language / Project Type / NetBeans Component
   
   _No response_
   
   ### How to reproduce
   
   Perform the following actions on the following code:
   
   selecet “originalMethod()”
   click “Refactor-inline”
   click “ok”
   
   public class OriginalClass {
        private boolean flag = false;
   
       public synchronized void originalMethod() throws InterruptedException {
           flag = true;
           notify();
       }
   
       public void callerMethod() throws InterruptedException {
        originalMethod() ;
       }
   }
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Windows11
   
   ### JDK
   
   20
   
   ### Apache NetBeans packaging
   
   Apache NetBeans platform
   
   ### Anything else
   
   Perform the following actions on the following code:
   
   selecet “originalMethod()”
   click “Refactor-inline”
   click “ok”
   
   public class OriginalClass {
        private boolean flag = false;
   
       public synchronized void originalMethod() throws InterruptedException {
           flag = true;
           notify();
       }
   
       public void callerMethod() throws InterruptedException {
        originalMethod() ;
       }
   }
   
   ### Are you willing to submit a pull request?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to