FIRST-Tech-Challenge / FIRST-Tech-Challenge/FtcRobotController
Consider supporting cross-compilation from newer JDKs without warnings
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 9.9k
- Avg merge
- 18m
- Merged PRs (30d)
- 1
Description
Attempt to compile using JDK 13 or higher complains with:
> warning: [options] source value 7 is obsolete and will be removed in a future release
> warning: [options] target value 7 is obsolete and will be removed in a future release
> warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
And to make matters even more annoying, it happens for 4-tasks, so you get 12 total warnings every time you build.
Installing an ancient Java 7 JDK is one option, or not using anything newer than a Java 11 JDK for cross-compilation is another, but many systems are switching to installing JDK 13 as the default, and the below code snippet allows newer cross-compilation JDKs without emitting the annoying warnings, yet keeps everything else functionally equivalent:
### build.gradle (top-level one, in the allprojects {} section)
```groovy
// Avoid warning message from newer JDKs about Java 7 source/target being obsolete
tasks.withType(JavaCompile).whenTaskAdded { JavaCompile javaCompile ->
javaCompile.options.compilerArgs << '-Xlint:-options'
}
```
The snippet directly replaced in the build.gradle file can be seen here:
https://github.com/FIRST-Tech-Challenge/FtcRobotController/pull/11/files
Contributor guide
Assessment
This issue has not been assessed yet.