aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java18
-rw-r--r--src/utils/lombok/eclipse/Java14Bits.java11
-rw-r--r--src/utils/lombok/javac/Java14Flags.java26
-rw-r--r--src/utils/lombok/javac/Javac.java6
4 files changed, 57 insertions, 4 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java
index 31979955..ac15f90b 100644
--- a/src/utils/lombok/eclipse/Eclipse.java
+++ b/src/utils/lombok/eclipse/Eclipse.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2019 The Project Lombok Authors.
+ * Copyright (C) 2009-2021 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -60,6 +60,11 @@ public class Eclipse {
*/
public static final int ECLIPSE_DO_NOT_TOUCH_FLAG = ASTNode.Bit24;
+ /* This section includes flags that would ordinarily be in ClassFileConstants, but which are 'too new' (we don't compile against older versions of ecj/eclipse for compatibility). */
+ public static final int AccRecord = ASTNode.Bit25;
+ public static final int IsCanonicalConstructor = ASTNode.Bit10; // For record declarations, and presumably later on any constructor matching the destructor.
+ public static final int IsImplicit = ASTNode.Bit11; // the generated statements in the compact constructor of a record.
+
private static final Pattern SPLIT_AT_DOT = Pattern.compile("\\.");
private Eclipse() {
@@ -239,9 +244,14 @@ 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())));
- }
+ String fName = f.getName();
+ String versionNumber = null;
+ if (fName.startsWith("VERSION_1_")) {
+ versionNumber = fName.substring("VERSION_1_".length());
+ } else if (fName.startsWith("VERSION_")) {
+ versionNumber = fName.substring("VERSION_".length());
+ } else continue;
+ ecjCompilerVersionCached = Math.max(ecjCompilerVersionCached, Integer.parseInt(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
+}
diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java
index 27926507..c0bda93c 100644
--- a/src/utils/lombok/javac/Javac.java
+++ b/src/utils/lombok/javac/Javac.java
@@ -75,6 +75,12 @@ public class Javac {
private static final AtomicInteger compilerVersion = new AtomicInteger(-1);
+ /* This section includes flags that would ordinarily be in Flags, but which are 'too new' (we don't compile against older versions of javac for compatibility). */
+ public static final long RECORD = 1L << 61; // ClassSymbols, MethodSymbols, VarSymbols (Marks types as being records, as well as the 'fields' in the compact declaration, and the canonical constructor)
+ 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)
+
/**
* 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}.
*/