Javac: Option to compile without notes
Asked Answered
G

1

7

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.

Gentlefolk answered 5/10, 2013 at 12:19 Comment(3)
Didn't that Note itself gave you an option?Pyxidium
Compile with -Xlint:unchecked option. You should rather modify your code to remove unchecked operation.Pyxidium
as the note says, compiling with Xlint:unchecked gives more details on content of note itself, which is not what I'm asking.Gentlefolk
W
3

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")
Wooldridge answered 5/10, 2013 at 12:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.