0

NetBeans IDE 12.4 (Java AdoptOpenJDK 11) displays dozens of warnings "This anonymous inner class creation can be turned into a lambda expression" in its ActionItems docked window. Simultaneously it locks this code (locks body of initComponents of jFrame to protect it against modification) making it impossible to change these anonymous to lambdas to get rid of display these warnings. Any changes in Tools/Options/Editor/Hints options does not affect these specific warnings.

So I have unuseful warnings. In practice means that I do not pay attention to any warnings anymore.

However, I wish I could find warning messages list in ActionItems window useful.

Can something be done about it?

(revised and supplemented)

xyzt
  • 59
  • 6
  • What do you mean by "locks this code"? It's been a long time since I used netbeans. Does it not allow you to edit some parts of your code? If so, there might be a way to turn that off in the settings somewhere. You can also look in the settings for a way to disable these lint warnings. – Code-Apprentice Mar 29 '22 at 19:07
  • 1
    I would read the help documents. And if it is really that bad, then I would pick another IDE. – GhostCat Mar 29 '22 at 19:09
  • @vkraemer said "The initComponents() method is regenerated by the IDE as you create your UI in the GUI editor. The method is 'guarded' to prevent this regeneration from overwriting user written code." https://stackoverflow.com/questions/2438221/how-to-modify-add-code-to-the-initcomponents-method-in-java-using-netbeans – xyzt Mar 29 '22 at 19:33
  • [1] How do you display that _"Warnings docked window"_? I can't find the "Warnings" window. [2] You can configure some hints to be shown-as-error/shown-as-warning/suppressed using **Tools > Options > Editor > Hints > Language Java**. [3] More information is needed. Update your question with all of the following: Your NetBeans version, a screenshot showing the "Warnings" window, a list of the warnings you want suppressed, and code (in text form) to provoke the warning(s) you want suppressed. – skomisa Mar 30 '22 at 02:53
  • @skomisa Yes, I corrected the question. Indeed, the window has a different name - ActionItems - and Warnings is one of the lists available in the tree there. How to recreate the situation: Please create a new project - Java Application (for example like described here: https://netbeans.apache.org/kb/docs/java/quickstart-gui.html). Add a new JFrame Form. Add a button to the above JFrame. Double click on this button - IDE will add an action listener. Look at the ActionItems window in warnings - the said message will appear. Try to eliminate it in any way. – xyzt Mar 30 '22 at 09:47

1 Answers1

0

Same problem, I disable warnings :

Convert ot Lamnda or Memver Reference Convert Anonymous to Member

But warnings stays listed on "Action Items" tab (even after clean/build, clean cache and NetBeans relaunch) :

enter image description here

The only change, are the underlined code warning, has gone :

enter image description here

immobiluser
  • 349
  • 1
  • 2
  • 12