| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]"> |
| <title> |
| Quick fix |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| </head> |
| <body> |
| <h1> |
| Quick fix |
| </h1> |
| <p> |
| 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. |
| </p> |
| <p> |
| <img src="../images/qs-37a.gif" width=330 height=132 alt="A Java editor indicating a quick-fixable problem with a lightbulb in the editor marker bar"> <br> |
| </p> |
| To see the correction proposals use the Quick Fix action |
| <ul> |
| <li> |
| Set the cursor inside the highlight range, and select <strong>Quick Fix</strong> from the <a href="ref-menu-edit.htm">Edit menu</a> or the context menu. |
| </li> |
| <li> |
| Set the cursor inside the highlight range, and press Ctrl + 1 |
| </li> |
| <li> |
| Click on the light bulb |
| </li> |
| </ul> |
| <p> |
| 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. |
| </p> |
| <p> |
| Provided corrections: |
| </p> |
| <table border="1" cellspacing="0"> |
| <tbody> |
| <tr> |
| <th> |
| <p> |
| Problem |
| </p> |
| </th> |
| <th> |
| <p> |
| Correction Proposals |
| </p> |
| </th> |
| </tr> |
| <tr align="left" valign="top"> |
| <td align="left" valign="top"> |
| <p> |
| Unresolved method reference |
| </p> |
| </td> |
| <td align="left" valign="top"> |
| <ul> |
| <li> |
| Change to a method with a similar name |
| </li> |
| <li> |
| Create method |
| </li> |
| </ul> |
| <br> |
| <br> |
| </td> |
| </tr> |
| <tr> |
| <td align="left" valign="top"> |
| <p> |
| Unresolved variable name |
| </p> |
| </td> |
| <td align="left" valign="top"> |
| <ul> |
| <li> |
| Change to a variable with a similar name |
| </li> |
| <li> |
| Create field |
| </li> |
| <li> |
| Create local variable |
| </li> |
| <li> |
| Create parameter |
| </li> |
| </ul> |
| <br> |
| <br> |
| </td> |
| </tr> |
| <tr> |
| <td align="left" valign="top"> |
| <p> |
| Unresolved type name |
| </p> |
| </td> |
| <td align="left" valign="top"> |
| <ul> |
| <li> |
| Change to a type with a similar name |
| </li> |
| <li> |
| Create class |
| </li> |
| <li> |
| Create interface |
| </li> |
| <li> |
| Add import statement |
| </li> |
| </ul> |
| <br> |
| <br> |
| </td> |
| </tr> |
| <tr> |
| <td align="left" valign="top"> |
| <p> |
| Undefined constructor |
| </p> |
| </td> |
| <td align="left" valign="top"> |
| <ul> |
| <li> |
| Create constructor |
| </li> |
| </ul> |
| <br> |
| <br> |
| </td> |
| </tr> |
| <tr valign="top"> |
| <td> |
| Parameter mismatch |
| </td> |
| <td> |
| <ul> |
| <li> |
| Change method name to matching method |
| </li> |
| </ul> |
| </td> |
| </tr> |
| <tr> |
| <td align="left" valign="top"> |
| <p> |
| Unhandled exception |
| </p> |
| </td> |
| <td align="left" valign="top"> |
| <ul> |
| <li> |
| Add try / catch statement |
| </li> |
| <li> |
| Add throws declaration to enclosing method |
| </li> |
| </ul> |
| <br> |
| <br> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| Type name does not match compilation unit name |
| </td> |
| <td> |
| <ul> |
| <li> |
| Change type name |
| </li> |
| <li> |
| Change file name |
| </li> |
| </ul> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td> |
| Package declaration does not match file location |
| </td> |
| <td> |
| <ul> |
| <li> |
| Change package declaration |
| </li> |
| <li> |
| Move file |
| </li> |
| </ul> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td> |
| Unused import |
| </td> |
| <td> |
| <ul> |
| <li> |
| Remove import |
| </li> |
| </ul> |
| </td> |
| </tr> |
| <tr align="left" valign="top"> |
| <td> |
| Type mismatch |
| </td> |
| <td> |
| <ul> |
| <li> |
| Add cast statement |
| </li> |
| <li> |
| Change declared type |
| </li> |
| </ul> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| Unterminated string |
| </td> |
| <td> |
| <ul> |
| <li> |
| Terminate string |
| </li> |
| </ul> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| Non-Externalized string |
| </td> |
| <td> |
| <ul> |
| <li> |
| Open Externalize String wizard |
| </li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <p> |
| To enable / disable problem indication & the light bulb go to the <a href="ref-21.htm">Java Editor preference page</a> > Annotations |
| </p> |
| <p> |
| <img src="../images/ngrelc.gif" alt="Related concepts" border="0" height="27" width="159"><br> |
| <a href="../concepts/concepts-7.htm">Java editor</a><a href="../concepts/concepts-7.htm"><br> |
| Java Development Tools (JDT)<br> |
| </a> |
| </p> |
| <p> |
| <img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159"><br> |
| <a href="../tasks/tasks-175.htm">Using quick fix<br> |
| </a> |
| </p> |
| <p> |
| <img src="../images/ngrelr.gif" width=159 height=27 alt="Related reference"><br> |
| <a href="../reference/ref-21.htm">Java editor preferences</a><br> |
| <a href="../reference/ref-menu-edit.htm">Edit menu</a><br> |
| </p> |
| <p> |
| <a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0" height="14" width="324"></a> |
| </p> |
| </body> |
| </html> |
| |