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

   ### Apache NetBeans version
   
   Apache NetBeans 21
   
   ### What happened
   
   When I select the statement "this. value=value;" and perform the extract 
method refactoring, the new method name is "newMethod" and I click "OK", a 
syntax compilation error occurs:
   
   class ExtractMethodTest {
   
       private final int value;
       public ExtractMethodTest(int value) {
         // extract method
          this.value = value;
        }
   }
   
   The refactoring results are as follows (Error : The final field 
ExtractMethodTest.value cannot be assigned):
   
![image](https://github.com/apache/netbeans/assets/77560508/2491f80b-f627-482c-8962-3ae09248c9ea)
   
     Expected result: Check for compilation errors before refactoring, and if 
there are any errors, give developers a prompt in advance.
   
   ### Language / Project Type / NetBeans Component
   
   _No response_
   
   ### How to reproduce
   
   Perform the following actions on the following code:
   
   1. selecet “this.value = value;”
   2. click “Refactor-Introduce-Method”
   3.  new name "newMethod"
   4.  click “ok”
   
   class ExtractMethodTest {
        private final int value;
        public ExtractMethodTest(int value) {
                // extract method
                this.value = value;
        }
   }
   
   ### 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
   
   _No response_
   
   ### 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: notifications-unsubscr...@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

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

Reply via email to