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

   ### Apache NetBeans version
   
   Apache NetBeans 21
   
   ### What happened
   
   When I select "dependentMethod()"  and perform the move methodrefactoring, 
and i click "OK", a syntax error:
   
   class SourceClass {
       private int value;
       TargetClass c;
       public void setValue(int value) {
           this.value = value;
       }
     // move method "dependentMethod()" to TargetClass
       public void dependentMethod() {
           System.out.println("Dependent method: " + value);
       }
   }
   
   class TargetClass {
       public void callDependentMethod() {
           SourceClass source = new SourceClass();
           source.dependentMethod(); // DependentMethod() depends on the value 
attribute in the Source Class
       }
   }
   
   refactoring result:
   
![image](https://github.com/apache/netbeans/assets/77560508/e540fef5-2d96-4ebd-a0dd-be40e154b2de)
   
   Expected result: Check for grammar errors before and after refactoring, and 
if so, provide error prompts
   
   
   ### Language / Project Type / NetBeans Component
   
   _No response_
   
   ### How to reproduce
   
   When I select "dependentMethod()"  and perform the move methodrefactoring, 
and i click "OK", a syntax error:
   
   class SourceClass {
       private int value;
       TargetClass c;
       public void setValue(int value) {
           this.value = value;
       }
     // move method "dependentMethod()" to TargetClass
       public void dependentMethod() {
           System.out.println("Dependent method: " + value);
       }
   }
   
   class TargetClass {
       public void callDependentMethod() {
           SourceClass source = new SourceClass();
           source.dependentMethod(); // DependentMethod() depends on the value 
attribute in the Source Class
       }
   }
   
   ### 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