To clear the strikethrough of deprecated method in Eclipse


Android is upgraded frequently. Therefore, it is often the case that the old API methods is deprecated and a new method is recommended. Now, it is likely that API methods which have been adopted since 3.x (Honeycomb) is recommended and methods which can be used even less than 2.x are deprecated.

I think that if you can accommodate the situation by Support Library, it is the best to use new API. However, if the method is not supported by the library, you are not forced to use the old API. (At least, Gingerbread has a market share close to 50% yet. For more information, please refer to Dashboards.)

If you use the old methods deprecated in Eclipse, code becomes difficult to read because the “strikethrough” is marked with in the default setting. Then this does not disappear even with the @SuppressWarnings(“deprecation”).

I do not think that even without “strikethrough” you are troubled, because the lint will mark the following warning.
deprecated_method

So I tried to check the settings to turn off the “strikethrough”.

At development of Java (Including Android), to turn off the “strikethrough” for the deprecated method is as easy as following.

  1. Open the menu Window > Preferences > Java > Editor > Syntax Colorling
  2. In Element, select “Deprecated members
  3. Remove the check mark of Enable
  4. Click Apply

syntax_coloring-en
Alternatively, It is a good idea that leaving “Enable”, change the Color or change “Strikethrough” to “Underline”. Of course, if the recommended alternative method is available you should take advantage of that.


Your email address will not be published.