Gradlew eclipse should generates a JDK 1.6 compliance instead of 1.5

not-a-bug

(ZOSROTHKO) #1

Hi

The eclipse task should generates .settings/org.eclipse.jdt.core.prefs with a org.eclipse.jdt.core.compiler.compliance equals to 1.6 instead of 1.5 as show below, otherwise all @override annotation lines are marked as error.

#
#Thu Oct 06 09:25:15 CEST 2016
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.circularClasspath=warning
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

gradlew -version


Gradle 3.2-20160930000021+0000

Build time: 2016-09-30 00:00:21 UTC
Revision: 6e814ee56c8cfa40699afd79220aa4e0a4a7d618

Groovy: 2.4.7
Ant: Apache Ant™ version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_102 (Oracle Corporation 25.102-b14)
OS: Windows 10 10.0 amd64


(Stefan Oehme) #2

Just set the sourceCompatibility in your project to 1.6 and the eclipse task will pick it up.


(ZOSROTHKO) #3

What you suggest is a work around but the issue remains a bug and in my opnion, it should be fixed to avoid to apply the workaround 3 times or more


(Paul Merlin) #4

By default, the eclipse task uses the value of sourceCompatibility from the Java plugin for compliance and source. If this value is not set in the build it falls back to the version of the JVM you’re using to run the build.

You’re running with Java 8 so you probably have sourceCompatiblity set to 1.5 somewhere in your build.

HTH


(ZOSROTHKO) #5

Ok, since the .setting files are not generated by Gradle but by Eclipse, this is an issue with Eclipse and it is not a bug per se for Gradle.

But saying that, I would like to transform this issue as an enhancement request for the Gradle Eclipse plugin so that it generates the proper .settings/org.eclipse.jdt.core.prefs with the compliance level set to 1.7


(Stefan Oehme) #6

They are generated by Gradle. You have 1.5 in there because you probably set that as sourceCompatibility in your build. If you don’t think this is the case, please provide a reproducible example.

It does that. My guess is that you set 1.5 somewhere in your build. Please provide an example, otherwise we can’t help you with this.