An unused import can sit in a Java file long after the code that needed it is gone. Eclipse on Linux lets you change the severity of that warning and other Java compiler diagnostics for an individual project.
Java projects inherit compiler warning severities from the workspace by default. The Errors/Warnings page in a project's properties lets you set a stricter rule for that project.
Setting Unused import to Error makes Eclipse report unused imports as Java errors after a rebuild. The file, project path, and line in Problems identify the same diagnostic after the severity changes.
Steps to configure Java compiler warnings in Eclipse:
Start with an open Java project that inherits workspace warning settings, with Project > Build Automatically enabled and an unused-import entry under Warnings in Problems.
- Note the import, file, project path, and line of the unused-import warning in Problems.
The project shown is
inventoryin~/eclipse-workspace. Its warning is forjava.util.Liston line 1 ofInventory.java. - Right-click your Java project in Project Explorer.

- Click Properties in the project context menu.

- Enter
Errors/Warningsin the filter above the properties tree.
- Select Errors/Warnings under Java Compiler.

- Select Enable project specific settings.
Clearing this checkbox and applying the change with a rebuild restores the workspace severities.
- Click the type filter text field on the Errors/Warnings page.

- Enter
Unused importin the optional-problem filter.
- Open the Unused import severity list under Unnecessary code.

- Select Error for Unused import.

- Click Apply and Close to save the project settings.

- Click Yes in Error/Warning Settings Changed to rebuild the project.
The rebuild is complete when the build progress indicator clears from the status bar.
- Expand Errors in Problems if the group is collapsed.

- Confirm that the unused-import entry for the same file, project path, and line now appears under Errors in Problems.
