Quick fix
For certain problems underlined with a problem highlight line, the Java editor can offer corrections. This is shown by the light bulb shown in the editor marker bar.
To see the correction proposals use the Quick Fix action
- Set the cursor inside the highlight range, and select Quick Fix from the Edit menu or the context menu.
- Set the cursor inside the highlight range, and press Ctrl + 1
- Click on the light bulb
Note that the light bulb is only a hint. It is possible that even with the light bulb shown, it turns out that no corrections can be offered.
Provided corrections:
Problem
Correction Proposals
Unresolved method reference
- Change to a method with a similar name
- Create method
Unresolved variable name
- Change to a variable with a similar name
- Create field
- Create local variable
- Create parameter
Unresolved type name
- Change to a type with a similar name
- Create class
- Create interface
- Add import statement
Undefined constructor
- Create constructor
Parameter mismatch
- Change method name to matching method
Unhandled exception
- Add try / catch statement
- Add throws declaration to enclosing method
Type name does not match compilation unit name
- Change type name
- Change file name
Package declaration does not match file location
- Change package declaration
- Move file
Unused import
- Remove import
Type mismatch
- Add cast statement
- Change declared type
Unterminated string
- Terminate string
Non-Externalized string
- Open Externalize String wizard
To enable / disable problem indication & the light bulb go to the Java Editor preference page > Annotations
Java editor
Java Development Tools (JDT)