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

   ### Apache NetBeans version
   
   Apache NetBeans 15
   
   ### What happened
   
   I've a method whose body contains an unused variable. NetBeans reports about 
this issue right. However, if I add a `private` nested `record` to my class, 
then the warning disappears. By *disappears* I mean that is not detected as a 
proper warning anymore:
   
   * The light bulb isn't shown in the left margin of the editor.
   
   * The yellow line isn't shown in the right margin of the editor.
   
   * If I run *Source* → *Inspect...* and choose the hint *Probable bugs* → 
*Unused element*, it's not detected anymore.
   
   It's strange, because the unused variable is still underlined, but in gray 
color, not in yellow. And if you hover it with the mouse pointer, the IDE still 
shows the tip *Variable X is not used*.
   
   Other odd fact: If you change the visibility of the `record` to `public`, 
`protected` or *package-private*, then the warning comes back.
   
   
   ### How to reproduce
   
   Use this so simple code to reproduce the problem:
   
   ```java
   public class MyClass {
   
        public void myMethod () {
                int x = 1;  // << Unused variable.
        }
   
        private record MyRecord (String myField) {
        }
   
   }
   ```
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Debian GNU/Linux 11.5 (Bullseye)
   
   ### JDK
   
   OpenJDK Runtime Environment (build 17.0.4+8-Debian-1deb11u1)
   
   ### 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