diff options
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java | 2 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java | 9 | ||||
-rw-r--r-- | tools/BUILD | 19 |
3 files changed, 26 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java index aeb3c4563b..19961a13eb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java @@ -378,7 +378,7 @@ public class RawText extends Sequence { * @since 6.0 */ 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'; } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java index b77fb920ed..8ab13385e0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java @@ -383,7 +383,10 @@ public final class StringUtils { try { return Math.multiplyExact(mul, number); } catch (ArithmeticException e) { - throw new NumberFormatException(e.getLocalizedMessage()); + NumberFormatException nfe = new NumberFormatException( + e.getLocalizedMessage()); + nfe.initCause(e); + throw nfe; } } @@ -413,9 +416,11 @@ public final class StringUtils { try { return Math.toIntExact(parseLongWithSuffix(value, positiveOnly)); } catch (ArithmeticException e) { - throw new NumberFormatException( + NumberFormatException nfe = new NumberFormatException( MessageFormat.format(JGitText.get().valueExceedsRange, value, Integer.class.getSimpleName())); + nfe.initCause(e); + throw nfe; } } diff --git a/tools/BUILD b/tools/BUILD index 2b208744b5..7bfab2d06c 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -5,10 +5,27 @@ load( ) 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( name = "error_prone_warnings_toolchain", 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 = [ ":error_prone", ], |