From ada85b4c07f7c5872a367004b4243f99f24b7a0a Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 28 Sep 2023 13:51:08 +0200 Subject: [PATCH] Bump checkstyle version to support Java 21 syntax --- .../java/org/teavm/classlib/java/math/TBigDecimal.java | 8 ++++---- config/checkstyle/checkstyle.xml | 7 ++++++- gradle/libs.versions.toml | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/classlib/src/main/java/org/teavm/classlib/java/math/TBigDecimal.java b/classlib/src/main/java/org/teavm/classlib/java/math/TBigDecimal.java index 713b58c21..88eb7788f 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/math/TBigDecimal.java +++ b/classlib/src/main/java/org/teavm/classlib/java/math/TBigDecimal.java @@ -1697,7 +1697,7 @@ public class TBigDecimal extends Number implements Comparable, Seri TMathContext newPrecision = mc; // MathContext by default // In particular cases, it reduces the problem to call the other 'pow()' - if ((n == 0) || ((isZero()) && (n > 0))) { + if (n == 0 || isZero() && n > 0) { return pow(n); } if ((m > 999999999) || ((mcPrecision == 0) && (n < 0)) || ((mcPrecision > 0) && (elength > mcPrecision))) { @@ -2382,7 +2382,7 @@ public class TBigDecimal extends Number implements Comparable, Seri */ public String toPlainString() { String intStr = getUnscaledValue().toString(); - if ((scale == 0) || ((isZero()) && (scale < 0))) { + if (scale == 0 || isZero() && scale < 0) { return intStr; } int begin = (signum() < 0) ? 1 : 0; @@ -2429,7 +2429,7 @@ public class TBigDecimal extends Number implements Comparable, Seri * @return this {@code BigDecimal} as a big integer instance. */ public TBigInteger toBigInteger() { - if ((scale == 0) || (isZero())) { + if (scale == 0 || isZero()) { return getUnscaledValue(); } else if (scale < 0) { return getUnscaledValue().multiply(TMultiplication.powerOf10(-(long) scale)); @@ -2449,7 +2449,7 @@ public class TBigDecimal extends Number implements Comparable, Seri * if rounding is necessary. */ public TBigInteger toBigIntegerExact() { - if ((scale == 0) || (isZero())) { + if (scale == 0 || isZero()) { return getUnscaledValue(); } else if (scale < 0) { return getUnscaledValue().multiply(TMultiplication.powerOf10(-(long) scale)); diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index f5a697cde..81c13fc60 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -40,7 +40,12 @@ - + + + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d52d82788..2f29299c7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ asm = "9.5" jackson = "2.14.2" jetty = "9.4.50.v20221201" shadow = "7.1.2" -checkstyle = "8.41" +checkstyle = "10.12.3" idea = "2020.1.4" idea-scala = "2020.1.43" maven = "3.5.4"