Note: Occasionally, invoking Quick Fix will not suggest any corrections. A message saying 'No suggestions available' will be displayed in such cases.
The Java editor also offers some common code changes even when there's no error or warning in your code.
For example, set the caret into the if
of the following if-else statement, press Ctrl+1, and select "Change 'if-else' statements to blocks":
String test(int arg) { if (arg > 1000) return "big"; else return "small"; }
Braces are added around the return statements:
String test(int arg) { if (arg > 1000) { return "big"; } else { return "small"; } }
Check out the Available Quick Fix proposals and the Available Quick Assist proposals, or just press Ctrl+1 to see what quick fixes or quick assists Eclipse offers in your current context.
Java editor
Available Quick Fix proposals
Available Quick Assist proposals