Home > Net >  How to remove boxing using Code Clean up in Intellij Idea?
How to remove boxing using Code Clean up in Intellij Idea?

Time:10-08

There is a feature in Intellij Idea called Analyze > Code Cleanup. This cleans up the code (like removes unnecessary instances of this.). I am editing a very old script in a newer version of Java. I'm in a file, and there is almost 700 warnings saying Remove Boxing and Remove Unboxing. For some reason, when I run code cleanup, it cleans up everything except this. The severity in my settings for this is at warning. What can I do to automatically remove all unnecessary Boxing and Unboxing from this old script?

Thank you for the help!

CodePudding user response:

The simplest way if you have one file (or only a few):

  • hover over one line having warning till a quick fix pop up appears and click on More actions...

enter image description here

  • click on the arrow >

enter image description here

  • choose fix all 'Unnecessary unboxing' problems in file

enter image description here

  • Related