javaantcompiler-warningssuppress-warnings

Ant compiler warnings for specific class file


I want to ignore warnings from ant which are thrown by an specific file.

It is not mandatory why there are warnings i only want to find a way that any ignore the warnings form an specific class file.

Is there a way to do that?


Solution

  • I take it you mean "suppress compilation warnings from javac when running an Ant script"?

    You don't supply an example of a warning, but in general you could look into the @SuppressWarnings annotation. Sadly, only "unchecked" is required byt the JLS, while all others are implementation dependent - you can try a

    localhost:~$ javac -X
      -Xlint:{all,cast,deprecation,divzero,empty,unchecked,fallthrough,path,
              serial,finally,overrides,-cast,-deprecation,-divzero,-empty,-unchecked,
              -fallthrough,-path,-serial,-finally,-overrides,none}
    

    to see the ones supported on your chosen JDK.

    Edit: It is not possible to suppress the "internal proprietary API" type warnings in this manner, cf. this Bug ID. It should, however, be possible with the (undocumented) -XDignore.symbol.file command line option for javac (see eg. bug 6544224).

    The real solution is of course to not use these APIs...

    Cheers,