Eclipse Quick Fix
Using quick fix
In the Eclipse editor, when you type letters, the editor analyzes what you have typed for errors.
The Java editor uses Java syntax to detect errors in the code. When it finds an error or warning:
- Highlights errors with a red wavy line
- Highlights warnings with a yellow wavy line
- Displays errors and warnings in the Problem view
- Displays a yellow light bulb and warning and error markers on the vertical ruler
The quick fix dialog provides solutions. The quick fix dialog can be invoked in the following ways:
- Place the mouse pointer on the wavy line
- Click the light bulb
- Place the mouse pointer on the highlighted text and select the Quick fix item in the Edit menu, or press the shortcut Ctrl + 1
In the figure above, getId is highlighted because there is no method named getId() in the Person class. Select "Create method 'getId()' in type 'Person'" from the proposed fixes to add the getId() method to the Person class.
You can also right-click an error item in the Problems view and then select the quick fix menu item to display the quick fix dialog, as shown in the figure below: