diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2021-02-02 09:44:36 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2021-09-06 11:58:05 +0200 |
commit | fdcbaa033d27b344adfea99d8d7bdd99cceacfb3 (patch) | |
tree | 5f385d9d193bd66ac7b5036f0f1b63fce4405cfe /src/utils | |
parent | e050dafc9016519e79184e383eab9ffbd579bebd (diff) | |
download | lombok-fdcbaa033d27b344adfea99d8d7bdd99cceacfb3.tar.gz lombok-fdcbaa033d27b344adfea99d8d7bdd99cceacfb3.tar.bz2 lombok-fdcbaa033d27b344adfea99d8d7bdd99cceacfb3.zip |
Replace val with native final var in Java >= 10
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/lombok/eclipse/Eclipse.java | 7 | ||||
-rw-r--r-- | src/utils/lombok/javac/java8/CommentCollectingScannerFactory.java | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 8af481b9..0f42ddc6 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -224,8 +224,11 @@ public class Eclipse { int highestVersionSoFar = 0; for (Field f : ClassFileConstants.class.getDeclaredFields()) { try { - if (f.getName().startsWith("JDK1_")) { - int thisVersion = Integer.parseInt(f.getName().substring("JDK1_".length())); + if (f.getName().startsWith("JDK")) { + String versionString = f.getName().substring("JDK".length()); + if (versionString.startsWith("1_")) versionString = versionString.substring("1_".length()); + + int thisVersion = Integer.parseInt(versionString); if (thisVersion > highestVersionSoFar) { highestVersionSoFar = thisVersion; latestEcjCompilerVersionConstantCached = (Long) f.get(null); diff --git a/src/utils/lombok/javac/java8/CommentCollectingScannerFactory.java b/src/utils/lombok/javac/java8/CommentCollectingScannerFactory.java index f29f501b..e625cd8d 100644 --- a/src/utils/lombok/javac/java8/CommentCollectingScannerFactory.java +++ b/src/utils/lombok/javac/java8/CommentCollectingScannerFactory.java @@ -21,6 +21,7 @@ */ package lombok.javac.java8; +import java.nio.Buffer; import java.nio.CharBuffer; import com.sun.tools.javac.parser.Scanner; @@ -79,7 +80,7 @@ public class CommentCollectingScannerFactory extends ScannerFactory { int limit; if (input instanceof CharBuffer && ((CharBuffer) input).hasArray()) { CharBuffer cb = (CharBuffer) input; - cb.compact().flip(); + ((Buffer)cb.compact()).flip(); array = cb.array(); limit = cb.limit(); } else { |