|
22 | 22 | package lombok.eclipse.handlers;
|
23 | 23 |
|
24 | 24 | import static lombok.core.handlers.HandlerUtil.handleFlagUsage;
|
25 |
| -import static lombok.eclipse.handlers.EclipseHandlerUtil.*; |
| 25 | +import static lombok.eclipse.handlers.EclipseHandlerUtil.typeMatches; |
26 | 26 |
|
27 | 27 | import lombok.ConfigurationKeys;
|
28 | 28 | import lombok.val;
|
29 | 29 | import lombok.var;
|
30 | 30 | import lombok.core.HandlerPriority;
|
31 | 31 | import lombok.eclipse.DeferUntilPostDiet;
|
32 |
| -import lombok.eclipse.Eclipse; |
33 | 32 | import lombok.eclipse.EclipseASTAdapter;
|
34 | 33 | import lombok.eclipse.EclipseASTVisitor;
|
35 | 34 | import lombok.eclipse.EclipseNode;
|
|
41 | 40 | import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
|
42 | 41 | import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
|
43 | 42 | import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
|
44 |
| -import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; |
45 | 43 | import org.eclipse.jdt.internal.compiler.ast.TypeReference;
|
46 |
| -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; |
47 | 44 |
|
48 | 45 | /*
|
49 |
| - * 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}. |
50 |
| - * Java 10+: Lombok uses the native 'var' support and transforms 'val' to 'final var'. |
| 46 | + * This class just handles 3 basic error cases. The real meat of eclipse 'val' support is in {@code PatchVal} and {@code PatchValEclipse} |
51 | 47 | */
|
52 | 48 | @Provides(EclipseASTVisitor.class)
|
53 | 49 | @DeferUntilPostDiet
|
@@ -101,16 +97,5 @@ public class HandleVal extends EclipseASTAdapter {
|
101 | 97 | localNode.addError("variable initializer is 'null'");
|
102 | 98 | return;
|
103 | 99 | }
|
104 |
| - |
105 |
| - // For Java >= 10 we use native support |
106 |
| - if (localNode.getSourceVersion() >= 10) { |
107 |
| - if (isVal) { |
108 |
| - TypeReference originalType = local.type; |
109 |
| - local.type = new SingleTypeReference("var".toCharArray(), Eclipse.pos(local.type)); |
110 |
| - local.modifiers |= ClassFileConstants.AccFinal; |
111 |
| - local.annotations = addAnnotation(local.type, local.annotations, originalType.getTypeName()); |
112 |
| - } |
113 |
| - return; |
114 |
| - } |
115 | 100 | }
|
116 | 101 | }
|
0 commit comments