Community
Participate
Working Groups
After 3.2M6, JDT reports compilation warnings as part of the JUnit test results. This is a great new feature, but the documentation around how to suppress certain warnings seems out of date. According to http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm (JDT Plug-in Developer Guide > Programmer's Guide > JDT Core > Compiling Java code > Warning options) and its successor in the built-in help in Eclipse 3.2 (I'm using 3.2RC1a, I20060419-1640), I can use flags in combination, like: -warn:-serial,+nls,-unusedLocal However, in practice, using Sun JDK 1.4.2, this is not the case. (Do I have to use JDK5 for this to work?) Instead, I get: [javac] invalid warning: +nls [javac] Compile failed; see the compiler error output for details. or [javac] invalid warning: -unusedLocal [javac] Compile failed; see the compiler error output for details. Oh, an in related news (in the same document)... Set warning level. e.g. -warn:unusedLocals,deprecation does not match unusedLocal | unused local variable I presume that's just a typo (unusedLocal != unusedLocals)
Are you using ant ? If yes, you should specify the compiler's name in the compilerarg element. Like this: <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" .... /> This would prevent javac from using Eclipse batch compiler options.
The doc says: -warn:<warnings separated by ,> enable exactly the listed warnings -warn:+<warnings separated by ,> enable additional warnings -warn:-<warnings separated by ,> disable specific warnings This doesn't mean that: -warn:-serial,+nls,-unusedLocals is valid. -warn:-serial,unusedLocals is valid -warn:+nls is valid unusedLocals has been left for backward compatibility. I changed the code sample to put unusedLocal instead of unusedLocals. I don't see what you mean by "using Sun JDK 1.4.2". If you are using ant, you should specify the compiler's name. If you are using a command line, then simply use Eclipse batch compiler options. We don't plan to match the Sun's options. We have many more warnings than javac.
You can use this syntax: -warn:-serial,unusedLocal -warn:+nls Ok to close?
Closing as REMIND.
What I meant was that we're invoking ant using a specific value for JAVA_HOME, but I'll try your combination of multiple -warn flags with <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" .... /> Thanks for the advice!
Reopen to close as INVALID since no fix has been done.
Closing as LATER. I will revisit the warning option on the command line for 3.3. I think we could improve it with a syntax like this: -warn:-serial,unusedLocal,+nls All options after the '-' would be disabled and all the options after the + would be enabled. Philippe, Do you think this is worth being investigated for 3.3?
+1
(In reply to comment #8) > +1 Comparing [1] and [2] it looks like this wasn't done in time for 3.3, though formatting was updated. [1]http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm [2]http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm Probably not worth wasting much effort on it if no one but me has complained. ;-) Could downgrade to INVALID or CLOSED, if you agree.
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.