Using java 9 JDK to locate Java 6 will issue a warning

I'm trying to build a project using JDK 9, because using javac's – release parameter means that it can build for an older version without installing the corresponding JDK / JRE I need to support Java 6, so my previous settings need Java 6 for bootstrap classpath and JDK 8 or 9 for gradle and IDE I want to cancel JDK 6 and only use 9, and sort out the build to some extent

My new build The gradle has the following configurations:

tasks.withType(JavaCompile) {
    options.compilerArgs.addAll(['--release','6',"-Xlint"])
}

The sourcecompatibility, targetcompatibility and bootstrap classpath options are not set because I understand that the - release parameter now handles it

I received the following warning:

warning: [options] source value 1.6 is obsolete and will be removed in a future release
warning: [options] target value 1.6 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options,use -Xlint:-options.

I knew these could be suppressed (it said it was there), but I didn't expect to see them When building with – release [7-9], these warnings do not exist

For context, this is the old (not currently used) '2x JDK' configuration:

sourceCompatibility = "1.6"
targetCompatibility = "1.6"

tasks.withType(JavaCompile) {
    options.bootstrapClasspath = new SimpleFileCollection(Arrays.asList(new File("$JDK6_HOME/jre/lib/rt.jar")))
}

Did I set compiler parameters incorrectly? Is there any way not to set / unset the source and target?

Solution

Although this is not from an official source, the warning seems to be consistent with the "one plus three" clause

Therefore, ideally, JDK 10 should be used to delete 1.6. The warning has a good effect on customers' understanding of the strategy

Edit: however, as pointed out by Alan in comments, JDK 10 will continue to support - release 6, such as this mailing list Described

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>