When the IDE detects an error for which it has identified a possible fix, a lightbulb () icon appears in the left margin of that line. You can click the lightbulb or press Alt-Enter to display a list of possible fixes. If one of those fixes suits you, you can select it and press Enter to have the fix generated in your code. Often, the "error" is not a coding mistake but a reflection of the fact that you have not gotten around to filling in the missing code. In those cases, the editor hints simply automate the entry of certain types of code. For example, assume you have just typed the following code, but x is not defined anywhere in the class. int newIntegerTransformer () { return x; } If your cursor is still resting on the line of the return statement, the icon will appear. If you click the icon or press Alt-Enter, you will be offered three possible solutions as shown in Figure 5-6. You can select one of those hints to generate the code. Figure 5-6. Display of editor hints
The IDE is able to provide hints for and generate the following solutions to common coding errors:
|