aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2010-11-08 23:27:31 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2010-11-08 23:27:31 +0100
commit844414768c49677f344704328905f1ab3f7b67a8 (patch)
treef03a30d4855408e30cbcad77b97fac53d41d9ffa /src/eclipseAgent/lombok
parent93e38f9024216b25856b80d0b56d802c16408b16 (diff)
downloadlombok-844414768c49677f344704328905f1ab3f7b67a8.tar.gz
lombok-844414768c49677f344704328905f1ab3f7b67a8.tar.bz2
lombok-844414768c49677f344704328905f1ab3f7b67a8.zip
Ran into a one-off, non-repeatable problem involving arguments not binding correctly. Just in case its our fault, added some extra code to not even attempt any 'val' shenanigans in method arguments (which are LocalDeclaration subclasses).
Diffstat (limited to 'src/eclipseAgent/lombok')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java3
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java6
2 files changed, 8 insertions, 1 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index b5132ca4..399ea357 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -282,7 +282,8 @@ public class EclipsePatcher extends Agent {
sm.addScript(ScriptBuilder.replaceMethodCall()
.target(new MethodTarget(LOCALDECLARATION_SIG, "resolve", "void", BLOCKSCOPE_SIG))
.methodToReplace(new Hook(EXPRESSION_SIG, "resolveType", TYPEBINDING_SIG, BLOCKSCOPE_SIG))
- .replacementMethod(new Hook("lombok.eclipse.agent.PatchFixes", "skipResolveInitializerIfAlreadyCalled", TYPEBINDING_SIG, EXPRESSION_SIG, BLOCKSCOPE_SIG))
+ .requestExtra(StackRequest.THIS)
+ .replacementMethod(new Hook("lombok.eclipse.agent.PatchFixes", "skipResolveInitializerIfAlreadyCalled2", TYPEBINDING_SIG, EXPRESSION_SIG, BLOCKSCOPE_SIG, LOCALDECLARATION_SIG))
.build());
sm.addScript(ScriptBuilder.exitEarly()
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index 32335ecc..e2a52929 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -268,6 +268,7 @@ public class PatchFixes {
}
public static boolean handleValForLocalDeclaration(LocalDeclaration local, BlockScope scope) {
+ if (local == null || !LocalDeclaration.class.equals(local.getClass())) return false;
boolean decomponent = false;
if (local.type instanceof SingleTypeReference) {
@@ -313,4 +314,9 @@ public class PatchFixes {
if (expr.resolvedType != null) return expr.resolvedType;
return expr.resolveType(scope);
}
+
+ public static TypeBinding skipResolveInitializerIfAlreadyCalled2(Expression expr, BlockScope scope, LocalDeclaration decl) {
+ if (decl != null && LocalDeclaration.class.equals(decl.getClass()) && expr.resolvedType != null) return expr.resolvedType;
+ return expr.resolveType(scope);
+ }
}