[releng] Make the bazel build use Java 11
Make the default toolchain use Java 11, and fix two errorprone findings introduced recently. Change-Id: Iff51206fe8bdf096cb7d88cb1a499002550766cd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
parent
30a8afd768
commit
4184ff0953
|
@ -378,7 +378,7 @@ public static boolean isBinary(byte[] raw, int length, boolean complete) {
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public static boolean isBinary(byte curr, byte prev) {
|
public static boolean isBinary(byte curr, byte prev) {
|
||||||
return curr == '\0' || curr != '\n' && prev == '\r' || prev == '\0';
|
return curr == '\0' || (curr != '\n' && prev == '\r') || prev == '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -383,7 +383,10 @@ public static long parseLongWithSuffix(@NonNull String value,
|
||||||
try {
|
try {
|
||||||
return Math.multiplyExact(mul, number);
|
return Math.multiplyExact(mul, number);
|
||||||
} catch (ArithmeticException e) {
|
} catch (ArithmeticException e) {
|
||||||
throw new NumberFormatException(e.getLocalizedMessage());
|
NumberFormatException nfe = new NumberFormatException(
|
||||||
|
e.getLocalizedMessage());
|
||||||
|
nfe.initCause(e);
|
||||||
|
throw nfe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,9 +416,11 @@ public static int parseIntWithSuffix(@NonNull String value,
|
||||||
try {
|
try {
|
||||||
return Math.toIntExact(parseLongWithSuffix(value, positiveOnly));
|
return Math.toIntExact(parseLongWithSuffix(value, positiveOnly));
|
||||||
} catch (ArithmeticException e) {
|
} catch (ArithmeticException e) {
|
||||||
throw new NumberFormatException(
|
NumberFormatException nfe = new NumberFormatException(
|
||||||
MessageFormat.format(JGitText.get().valueExceedsRange,
|
MessageFormat.format(JGitText.get().valueExceedsRange,
|
||||||
value, Integer.class.getSimpleName()));
|
value, Integer.class.getSimpleName()));
|
||||||
|
nfe.initCause(e);
|
||||||
|
throw nfe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
tools/BUILD
19
tools/BUILD
|
@ -5,10 +5,27 @@ load(
|
||||||
)
|
)
|
||||||
load("@rules_java//java:defs.bzl", "java_package_configuration")
|
load("@rules_java//java:defs.bzl", "java_package_configuration")
|
||||||
|
|
||||||
|
JDK11_JVM_OPTS = [
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
||||||
|
"--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
|
||||||
|
"--patch-module=java.compiler=$(location @bazel_tools//tools/jdk:java_compiler_jar)",
|
||||||
|
"--patch-module=jdk.compiler=$(location @bazel_tools//tools/jdk:jdk_compiler_jar)",
|
||||||
|
"--add-opens=java.base/java.nio=ALL-UNNAMED",
|
||||||
|
"--add-opens=java.base/java.lang=ALL-UNNAMED",
|
||||||
|
]
|
||||||
|
|
||||||
default_java_toolchain(
|
default_java_toolchain(
|
||||||
name = "error_prone_warnings_toolchain",
|
name = "error_prone_warnings_toolchain",
|
||||||
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
|
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
|
||||||
jvm_opts = JDK9_JVM_OPTS,
|
jvm_opts = JDK11_JVM_OPTS,
|
||||||
|
source_version = "11",
|
||||||
|
target_version = "11",
|
||||||
package_configuration = [
|
package_configuration = [
|
||||||
":error_prone",
|
":error_prone",
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue