In Eclipse, when I temporarily comment out the source code and save it, the import statement of the class used there disappears.
Of course, it is troublesome to write an import statement when returning from commenting out, but I am afraid of import mistakes. When importing, the import statement is automatically entered just by selecting from the list due to the excellent suggestion function of Eclipse. Some of the class names to be imported have the same class name in different packages, so there is no mistake in selecting them when returning from commenting out.
Eclipse Java EE IDE for Web Developers.
Version: Neon Release (4.6.0) Build id: 20160613-1800
↑ Settings before improvement
In the image above "Settings before improvement", check "Additional actions" so that you can press the "Configure" button, and when you press the "Configure" button, a screen like the image below opens.
In the "Unnecessary Code" tab, there is a setting item "Remove unused imports". Make sure it is unchecked and click OK to close the screen.
I think this will improve it, but ** it disappears **.
(Before the improvement, "Additional action" was not checked and the setting was not specified, so I thought that I could go if I checked it.)
As explained in this page, the import statement did not disappear when "Organize import" was unchecked.
It seems that the ** "Remove unused imports" setting item of "Additional actions" is ignored and the "Organize imports" setting is prioritized **. I don't know what I'm doing in "Organizing Imports".
So, I made this setting.
Of course, you don't have to check "Additional actions" as shown in the image below.
that's all.