diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2020-09-10 10:20:12 +0200 |
---|---|---|
committer | Rawi01 <Rawi01@users.noreply.github.com> | 2020-09-10 10:32:14 +0200 |
commit | 0064c534273d9fb877f7e570f7a430060c88a5fb (patch) | |
tree | ee7089c1fbe948127aaea4c3317dd7dc18b0ee39 /src/utils | |
parent | 9148294f78a8e646ee131ca182a9b692bc028fdb (diff) | |
download | lombok-0064c534273d9fb877f7e570f7a430060c88a5fb.tar.gz lombok-0064c534273d9fb877f7e570f7a430060c88a5fb.tar.bz2 lombok-0064c534273d9fb877f7e570f7a430060c88a5fb.zip |
Add record support
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/lombok/eclipse/Eclipse.java | 13 | ||||
-rw-r--r-- | src/utils/lombok/eclipse/Java14Bits.java | 11 | ||||
-rw-r--r-- | src/utils/lombok/javac/Java14Flags.java | 26 |
3 files changed, 48 insertions, 2 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 31979955..cda75da5 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -239,8 +239,17 @@ public class Eclipse { for (Field f : CompilerOptions.class.getDeclaredFields()) { try { - if (f.getName().startsWith("VERSION_1_")) { - ecjCompilerVersionCached = Math.max(ecjCompilerVersionCached, Integer.parseInt(f.getName().substring("VERSION_1_".length()))); + if (f.getName().startsWith("VERSION_")) { + String version = f.getName().substring("VERSION_".length()); + Integer versionNumber = null; + if (version.startsWith("1_")) { + versionNumber = Integer.parseInt(version.substring("1_".length())); + } else if (version.length() <= 2) { + versionNumber = Integer.parseInt(version); + } + if (versionNumber != null) { + ecjCompilerVersionCached = Math.max(ecjCompilerVersionCached, versionNumber); + } } } catch (Exception ignore) {} } diff --git a/src/utils/lombok/eclipse/Java14Bits.java b/src/utils/lombok/eclipse/Java14Bits.java new file mode 100644 index 00000000..c7e00c39 --- /dev/null +++ b/src/utils/lombok/eclipse/Java14Bits.java @@ -0,0 +1,11 @@ +package lombok.eclipse; + +import org.eclipse.jdt.internal.compiler.ast.ASTNode; + +public class Java14Bits { + private Java14Bits() { } + + public static final int AccRecord = ASTNode.Bit25; + public static final int IsCanonicalConstructor = ASTNode.Bit10; // record declaration + public static final int IsImplicit = ASTNode.Bit11; // record declaration / generated statements in compact constructor +} diff --git a/src/utils/lombok/javac/Java14Flags.java b/src/utils/lombok/javac/Java14Flags.java new file mode 100644 index 00000000..0d565dca --- /dev/null +++ b/src/utils/lombok/javac/Java14Flags.java @@ -0,0 +1,26 @@ +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 +} |