Search code examples
androidwarnings

Android Java Compiler directive to disable warnings for a single line of code


I want to suppress a compiler warning by number. I saw it done by following the line of code with some special comment.

You know Murphy's law? I think this is one case. When I don't need it, I bump all the time over code that has this kind of directive. Loks somehting like

static int num;   //!NLNS201

Now that I need it I cannot find it anywhere.

EDIT: I cannot believe nobody knows what am talking about! I rephrased the question, maybe it was unclear.


Solution

  • Well, I found it. But it is not what I thought it is.

    The $NON-NLS-x tags, are used by Eclipse to suppress only literal strings warning aimed at language internationalization.

    I am using instead @SupressWarnings("all") before the variable declaration.

    See this post for a good reference on @SuppressWarnings arguments