diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2021-09-16 02:07:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 02:07:26 +0200 |
commit | d09d995a8ecbd15428eac92150b1d7b55a525d2c (patch) | |
tree | 3b61fab8d931e610ce271735cdbac234cdf94726 /src/utils/lombok | |
parent | 14aaf25ede37228f186a7029aa9567353eb539ca (diff) | |
parent | f516dd8ab3186121c4a880444302e2f980f393f8 (diff) | |
download | lombok-d09d995a8ecbd15428eac92150b1d7b55a525d2c.tar.gz lombok-d09d995a8ecbd15428eac92150b1d7b55a525d2c.tar.bz2 lombok-d09d995a8ecbd15428eac92150b1d7b55a525d2c.zip |
Merge pull request #2936 from Rawi01/jdk-17
Add support for JDK17
Diffstat (limited to 'src/utils/lombok')
-rw-r--r-- | src/utils/lombok/javac/Java14Flags.java | 26 | ||||
-rw-r--r-- | src/utils/lombok/javac/Javac.java | 2 | ||||
-rw-r--r-- | src/utils/lombok/javac/JavacTreeMaker.java | 14 |
3 files changed, 15 insertions, 27 deletions
diff --git a/src/utils/lombok/javac/Java14Flags.java b/src/utils/lombok/javac/Java14Flags.java deleted file mode 100644 index 0d565dca..00000000 --- a/src/utils/lombok/javac/Java14Flags.java +++ /dev/null @@ -1,26 +0,0 @@ -package lombok.javac; - -public class Java14Flags { - private Java14Flags() { } - - /** - * Flag to indicate that a class is a record. The flag is also used to mark fields that are - * part of the state vector of a record and to mark the canonical constructor - */ - public static final long RECORD = 1L<<61; // ClassSymbols, MethodSymbols and VarSymbols - - /** - * Flag to mark a record constructor as a compact one - */ - public static final long COMPACT_RECORD_CONSTRUCTOR = 1L<<51; // MethodSymbols only - - /** - * Flag to mark a record field that was not initialized in the compact constructor - */ - public static final long UNINITIALIZED_FIELD= 1L<<51; // VarSymbols only - - /** Flag is set for compiler-generated record members, it could be appplied to - * accessors and fields - */ - public static final int GENERATED_MEMBER = 1<<24; // MethodSymbols and VarSymbols -} diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java index d9fcc4f2..3fa0fbb5 100644 --- a/src/utils/lombok/javac/Javac.java +++ b/src/utils/lombok/javac/Javac.java @@ -80,6 +80,8 @@ public class Javac { public static final long COMPACT_RECORD_CONSTRUCTOR = 1L << 51; // MethodSymbols (the 'implicit' many-args constructor that records have) public static final long UNINITIALIZED_FIELD = 1L << 51; // VarSymbols (To identify fields that the compact record constructor won't initialize) public static final long GENERATED_MEMBER = 1L << 24; // MethodSymbols, VarSymbols (marks methods and the constructor generated in records) + public static final long SEALED = 1L << 62; // ClassSymbols (Flag to indicate sealed class/interface declaration) + public static final long NON_SEALED = 1L << 63; // ClassSymbols (Flag to indicate that the class/interface was declared with the non-sealed modifier) /** * Returns the version of this java compiler, i.e. the JDK that it shipped in. For example, for javac v1.7, this returns {@code 7}. diff --git a/src/utils/lombok/javac/JavacTreeMaker.java b/src/utils/lombok/javac/JavacTreeMaker.java index 30d71606..d369b4e4 100644 --- a/src/utils/lombok/javac/JavacTreeMaker.java +++ b/src/utils/lombok/javac/JavacTreeMaker.java @@ -607,7 +607,19 @@ public class JavacTreeMaker { public JCCase Case(JCExpression pat, List<JCStatement> stats) { if (tryResolve(Case11)) return invoke(Case11, pat, stats); - return invoke(Case12.Case12, Case12.CASE_KIND_STATEMENT, pat == null ? com.sun.tools.javac.util.List.nil() : com.sun.tools.javac.util.List.of(pat), stats, null); + List<JCTree> labels; + if (pat == null) { + labels = tryResolve(DefaultCaseLabel) ? List.of(DefaultCaseLabel()) : List.<JCTree>nil(); + } else { + labels = List.<JCTree>of(pat); + } + return invoke(Case12.Case12, Case12.CASE_KIND_STATEMENT, labels, stats, null); + } + + //javac versions: 17 + private static final MethodId<JCTree> DefaultCaseLabel = MethodId("DefaultCaseLabel", JCTree.class); + public JCTree DefaultCaseLabel() { + return invoke(DefaultCaseLabel); } //javac versions: 6-8 |