Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javac: Option to compile without notes

Is there a compiler option for javac to compile without notes?

I know of:

  • -nowarn : to not display warnings
  • -g:none : to generate no debugging info

Notes are still generated with both of these. Is there a compiler option to not generate notes, too?

By 'notes' I mean compiler output such as:

Note: Exercise.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

I use javac 1.7.0_40.

like image 710
franka Avatar asked Oct 05 '13 12:10

franka


1 Answers

Not really an javac option, but worth to mention...

If you don't want to display any compilation output.

in unix: javac ... > /dev/null

in windows: javac ... > NUL

After some research (How can I suppress javac warnings about deprecated api?)

"From what I can tell in the docs, you can't do it on the command-line.

According to the javac documentation, -Xlint:none only disables warnings "not mandated by the Java Language Specification". It appears that warning you of the use of deprecated APIs is managed by the language spec.

Your best option would be to fix the use of deprecated APIs. However, an option would be to add the @SuppressWarnings("deprecation") annotation to the classes or methods that are using the deprecated APIs."

And

"Two possible ways:

  1. don't use deprecated API
  2. Use @SuppressWarnings("deprecation")
like image 57
MrSimpleMind Avatar answered Sep 22 '22 02:09

MrSimpleMind