Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365733

Summary: Tycho JDT compiler default warnings configuration produces way too much warnings
Product: z_Archived Reporter: Missing name <thomas.demande>
Component: TychoAssignee: Jan Sievers <jan.sievers>
Status: CLOSED WORKSFORME QA Contact:
Severity: minor    
Priority: P3 CC: jan.sievers
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch that ignores JDT compiler unnecessary warnings if compiler settings are set not to show warnings. none

Description Missing name CLA 2011-12-06 09:15:37 EST
Build Identifier: 

By default, the Eclipse JDT compiler warns about many things, which is rather nice inside an IDE, but is not really usable in a CI or manual console build output.

Warnings should be reduced to only print stability relevant information, keeping purely code-related being handled by the IDE or code quality tools.


Reproducible: Always
Comment 1 Missing name CLA 2011-12-06 09:23:31 EST
Created attachment 207990 [details]
Patch that ignores JDT compiler unnecessary warnings if compiler settings are set not to show warnings.
Comment 2 Jan Sievers CLA 2011-12-09 08:58:26 EST
thanks for the patch, I intend to merge it.

You need to answer the following questions:

1.  Did you author 100% of the content you are contributing
2.  Do you have the rights to donate the content to Eclipse
3.  Are you contributing the content under the EPL
Comment 3 Jan Sievers CLA 2011-12-09 11:28:15 EST
note that 3 of the ignored warnings actually can't be ignored in general:

settings.put(CompilerOptions.OPTION_ReportAssertIdentifier, compilerOptions.IGNORE);

this is an error if compiler source level >= 1.4

settings.put(CompilerOptions.OPTION_ReportEnumIdentifier, CompilerOptions.IGNORE);

this is an error if compiler source level >= 1.5

settings.put(CompilerOptions.OPTION_ReportForbiddenReference, CompilerOptions.IGNORE);

This is an error by default as it reports access to non-exported OSGi packages and we want to keep it as error.

I will remove these 3 lines.
Comment 4 Jan Sievers CLA 2011-12-09 12:38:45 EST
(In reply to comment #3)
after some reconsideration, I think we should not use the low-level options map for this. These are implementation details which could change anytime.

Rather use the CLI options [1]

-warn:none

-deprecation / -warn:-deprecation

-g / -g:none

[1] http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_compile.htm
Comment 5 Jan Sievers CLA 2011-12-09 15:41:47 EST
looking at the code again, I realized that warnings are already not shown by default:

http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java#n192

and

http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java#n97

same applies for deprecation and debug options. 

Feel free to reopen if you can provide a sample project which demonstrates the problem and steps to reproduce.
Comment 6 Missing name CLA 2011-12-12 07:41:38 EST
It might be some code that we used to add to the old plexus-compiler-eclipse implementation, which uses a JDT compiler from a different package (org.eclipse.jdt.core.compiler.batch).

I tested the current HEAD of this project and didn't notice unnecessary warning.

I guess, as for other functionalities, the implementation used here just doesn't have the same issue.

Sorry fir the inconvenience, you can keep this issue closed.