Skip to content

Commit 4184ff0

Browse files
Thomas Wolfmsohn
Thomas Wolf
authored andcommitted
[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>
1 parent 30a8afd commit 4184ff0

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public static boolean isBinary(byte[] raw, int length, boolean complete) {
378378
* @since 6.0
379379
*/
380380
public static boolean isBinary(byte curr, byte prev) {
381-
return curr == '\0' || curr != '\n' && prev == '\r' || prev == '\0';
381+
return curr == '\0' || (curr != '\n' && prev == '\r') || prev == '\0';
382382
}
383383

384384
/**

org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,10 @@ public static long parseLongWithSuffix(@NonNull String value,
383383
try {
384384
return Math.multiplyExact(mul, number);
385385
} catch (ArithmeticException e) {
386-
throw new NumberFormatException(e.getLocalizedMessage());
386+
NumberFormatException nfe = new NumberFormatException(
387+
e.getLocalizedMessage());
388+
nfe.initCause(e);
389+
throw nfe;
387390
}
388391
}
389392

@@ -413,9 +416,11 @@ public static int parseIntWithSuffix(@NonNull String value,
413416
try {
414417
return Math.toIntExact(parseLongWithSuffix(value, positiveOnly));
415418
} catch (ArithmeticException e) {
416-
throw new NumberFormatException(
419+
NumberFormatException nfe = new NumberFormatException(
417420
MessageFormat.format(JGitText.get().valueExceedsRange,
418421
value, Integer.class.getSimpleName()));
422+
nfe.initCause(e);
423+
throw nfe;
419424
}
420425
}
421426

tools/BUILD

+18-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,27 @@ load(
55
)
66
load("@rules_java//java:defs.bzl", "java_package_configuration")
77

8+
JDK11_JVM_OPTS = [
9+
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
10+
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
11+
"--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
12+
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
13+
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
14+
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
15+
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
16+
"--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
17+
"--patch-module=java.compiler=$(location @bazel_tools//tools/jdk:java_compiler_jar)",
18+
"--patch-module=jdk.compiler=$(location @bazel_tools//tools/jdk:jdk_compiler_jar)",
19+
"--add-opens=java.base/java.nio=ALL-UNNAMED",
20+
"--add-opens=java.base/java.lang=ALL-UNNAMED",
21+
]
22+
823
default_java_toolchain(
924
name = "error_prone_warnings_toolchain",
1025
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
11-
jvm_opts = JDK9_JVM_OPTS,
26+
jvm_opts = JDK11_JVM_OPTS,
27+
source_version = "11",
28+
target_version = "11",
1229
package_configuration = [
1330
":error_prone",
1431
],

0 commit comments

Comments
 (0)