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

   ### Apache NetBeans version
   
   Apache NetBeans 14
   
   ### What happened
   
   Defining compact constructor almost always results in "unused local 
variable" warning, because NetBeans is unaware of implicit field assignments 
that happen after compact constructor code is executed.
   
   In an example:
   
   ````java
   record MyRecord(List<String> list, int[] ints) {
       MyRecord {
           list = List.copyOf(list); // WARNING: unused local variable
           ints = Arrays.copyOf(ints); // WARNING: unused local variable
       }
   }
   ````
   
   I expect there to be no warnings, because above code is totally legitimate 
and even more recommended way to use compact constructor.
   
   ### How to reproduce
   
   Define any record with compact constructor that assigns to constructor 
parameters.
   
   ### Did this work correctly in an earlier version?
   
   No
   
   ### Operating System
   
   Fedora 34
   
   ### JDK
   
   JDK 18
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### 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: [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