aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2021-09-27 19:19:46 +0200
committerGitHub <noreply@github.com>2021-09-27 19:19:46 +0200
commitba2b47b974304517ef47154a3939056eff13fade (patch)
tree9eb1bc03741766c847afeb492efbfce7cc9f59dc /src/core/lombok
parentba68962cec99cb1411ed7cac259301edc417ebc5 (diff)
parent9ef7656a35706f387569189e118076c7279311c3 (diff)
downloadlombok-ba2b47b974304517ef47154a3939056eff13fade.tar.gz
lombok-ba2b47b974304517ef47154a3939056eff13fade.tar.bz2
lombok-ba2b47b974304517ef47154a3939056eff13fade.zip
Merge pull request #2975 from Rawi01/organize-imports-val
Move 'val' -> 'final var' code to patch method
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java6
-rw-r--r--src/core/lombok/eclipse/handlers/HandleVal.java19
2 files changed, 3 insertions, 22 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index a9f435fd..b00b8ec1 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -2052,11 +2052,7 @@ public class EclipseHandlerUtil {
}
int pS = source.sourceStart, pE = source.sourceEnd;
- long p = (long)pS << 32 | pE;
- long[] poss = new long[annotationTypeFqn.length];
- Arrays.fill(poss, p);
- QualifiedTypeReference qualifiedType = new QualifiedTypeReference(annotationTypeFqn, poss);
- setGeneratedBy(qualifiedType, source);
+ TypeReference qualifiedType = generateQualifiedTypeRef(source, annotationTypeFqn);
Annotation ann;
if (args != null && args.length == 1 && args[0] instanceof Expression) {
SingleMemberAnnotation sma = new SingleMemberAnnotation(qualifiedType, pS);
diff --git a/src/core/lombok/eclipse/handlers/HandleVal.java b/src/core/lombok/eclipse/handlers/HandleVal.java
index 0f70e66d..1bea5525 100644
--- a/src/core/lombok/eclipse/handlers/HandleVal.java
+++ b/src/core/lombok/eclipse/handlers/HandleVal.java
@@ -22,14 +22,13 @@
package lombok.eclipse.handlers;
import static lombok.core.handlers.HandlerUtil.handleFlagUsage;
-import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
+import static lombok.eclipse.handlers.EclipseHandlerUtil.typeMatches;
import lombok.ConfigurationKeys;
import lombok.val;
import lombok.var;
import lombok.core.HandlerPriority;
import lombok.eclipse.DeferUntilPostDiet;
-import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseASTAdapter;
import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseNode;
@@ -41,13 +40,10 @@ import org.eclipse.jdt.internal.compiler.ast.ForStatement;
import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
-import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
/*
- * Java 1-9: This class just handles 3 basic error cases. The real meat of eclipse 'val' support is in {@code PatchVal} and {@code PatchValEclipse}.
- * Java 10+: Lombok uses the native 'var' support and transforms 'val' to 'final var'.
+ * This class just handles 3 basic error cases. The real meat of eclipse 'val' support is in {@code PatchVal} and {@code PatchValEclipse}
*/
@Provides(EclipseASTVisitor.class)
@DeferUntilPostDiet
@@ -101,16 +97,5 @@ public class HandleVal extends EclipseASTAdapter {
localNode.addError("variable initializer is 'null'");
return;
}
-
- // For Java >= 10 we use native support
- if (localNode.getSourceVersion() >= 10) {
- if (isVal) {
- TypeReference originalType = local.type;
- local.type = new SingleTypeReference("var".toCharArray(), Eclipse.pos(local.type));
- local.modifiers |= ClassFileConstants.AccFinal;
- local.annotations = addAnnotation(local.type, local.annotations, originalType.getTypeName());
- }
- return;
- }
}
}