You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/10/05 19:57:07 UTC

[GitHub] [netbeans] errael opened a new issue, #4724: refactor rename record field does partial change and syntax error, or NPE

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

   ### Apache NetBeans version
   
   Apache NetBeans latest daily build
   
   ### What happened
   
   Refactor field name in record declaration, got syntax error in file. Similar situation produces an NPE, see below.
   
   ### How to reproduce
   
   In the following source code, with the caret on the field named `string` in the record `ClipData, refactor rename. The field name gets changed where it's referenced, but not in the record declaration. 
   ```
   public class Library {
       public void someLibraryMethod() {
   	int type;
   	String stringData;
   	var clipData = getClipData(); 
   	type = clipData.type;
   	stringData = clipData.string; /////// this gets changed to stringData
       }
   //////////////////////////////////// VVVVVV ///// refactor this to stringData
       record ClipData(int type, String string) {}
       private ClipData getClipData() {
   	return new ClipData(3, "foo");
       }
   }
   ```
   
   Interestingly, if the field reference is the function, like
   ```
   stringData = clipData.string()
   ```
   Then nothing is changed, the refactor fails, but the file is not left with a syntax error.
   
   If the caret is on `string()` then there is an NPE.
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Linux harmony 5.19.0-76051900-generic #202207312230~1660780566~22.04~9d60db1
   
   ### JDK
   
   openjdk version "11.0.2" 2019-01-15
   
   ### Apache NetBeans packaging
   
   Own source build
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
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-unsubscribe@netbeans.apache.org.apache.org

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


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

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


[GitHub] [netbeans] mbien commented on issue #4724: refactor rename record field does partial change and syntax error, or NPE

Posted by GitBox <gi...@apache.org>.
mbien commented on issue #4724:
URL: https://github.com/apache/netbeans/issues/4724#issuecomment-1264857072

   yeah this is likely related to #4257, the editor thinks those are not the same fields for some reason - if you rename one, the other isn't renamed.
   
   You can see this already by putting the cursor over the field. It doesn't highlight the other one.


-- 
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-unsubscribe@netbeans.apache.org

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


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

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


[GitHub] [netbeans] errael commented on issue #4724: refactor rename record field does partial change and syntax error, or NPE

Posted by GitBox <gi...@apache.org>.
errael commented on issue #4724:
URL: https://github.com/apache/netbeans/issues/4724#issuecomment-1264772846

   The SourceLevel is `19`.


-- 
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-unsubscribe@netbeans.apache.org

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


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

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