aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2012-02-15 04:36:15 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2012-02-15 04:36:15 +0100
commitdf5324e2d7f2ce12b691954dd79714ad7496b406 (patch)
tree9188bd163d99fbb8eeaf1301755ce50514e97438 /src/core/lombok/eclipse/handlers
parent9a50da2d092f86eef6e00e0f518039ad3ef53ec8 (diff)
downloadlombok-df5324e2d7f2ce12b691954dd79714ad7496b406.tar.gz
lombok-df5324e2d7f2ce12b691954dd79714ad7496b406.tar.bz2
lombok-df5324e2d7f2ce12b691954dd79714ad7496b406.zip
'val' is no longer legal in basic for loops now. Fixes issue #346
Diffstat (limited to 'src/core/lombok/eclipse/handlers')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleVal.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleVal.java b/src/core/lombok/eclipse/handlers/HandleVal.java
index 41c34aee..a5cf29b2 100644
--- a/src/core/lombok/eclipse/handlers/HandleVal.java
+++ b/src/core/lombok/eclipse/handlers/HandleVal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2011 The Project Lombok Authors.
+ * Copyright (C) 2010-2012 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
@@ -27,12 +27,13 @@ import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseNode;
import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
+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.mangosdk.spi.ProviderFor;
/*
- * This class just handles 2 basic error cases. The real meat of eclipse 'val' support is in {@code EclipsePatcher}'s {@code patchHandleVal} method.
+ * This class just handles 3 basic error cases. The real meat of eclipse 'val' support is in {@code PatchVal} and {@code PatchValEclipse}.
*/
@ProviderFor(EclipseASTVisitor.class)
public class HandleVal extends EclipseASTAdapter {
@@ -58,5 +59,10 @@ public class HandleVal extends EclipseASTAdapter {
localNode.addError("'val' is not compatible with array initializer expressions. Use the full form (new int[] { ... } instead of just { ... })");
return;
}
+
+ if (localNode.directUp().get() instanceof ForStatement) {
+ localNode.addError("'val' is not allowed in old-style for loops");
+ return;
+ }
}
}