aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2012-08-13 02:45:58 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2012-08-13 02:46:43 +0200
commitafcb211e47f387c5c9b42a0d954e247aec84e781 (patch)
tree25e8d72850e532bee879aa4a3d80be8daf79de0e /src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
parentd1539a3ec2e49297d358b0690d84e6319c27f93c (diff)
downloadlombok-afcb211e47f387c5c9b42a0d954e247aec84e781.tar.gz
lombok-afcb211e47f387c5c9b42a0d954e247aec84e781.tar.bz2
lombok-afcb211e47f387c5c9b42a0d954e247aec84e781.zip
Fix for issue 401: test(), Object.test(), and super.test() were all allowed in eclipse for @ExtensionMethod, resulting in VerifyErrors in the emitted class files.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
index b96f70c9..008e722a 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
@@ -48,8 +48,10 @@ import org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.eclipse.jdt.internal.compiler.ast.NameReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
+import org.eclipse.jdt.internal.compiler.ast.SuperReference;
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
@@ -201,7 +203,16 @@ public class PatchExtensionMethod {
}
}
- for (Extension extension : extensions) {
+ boolean skip = false;
+
+ if (methodCall.receiver instanceof ThisReference && (((ThisReference)methodCall.receiver).bits & ASTNode.IsImplicitThis) != 0) skip = true;
+ if (methodCall.receiver instanceof SuperReference) skip = true;
+ if (methodCall.receiver instanceof NameReference) {
+ Binding binding = ((NameReference)methodCall.receiver).binding;
+ if (binding instanceof TypeBinding) skip = true;
+ }
+
+ if (!skip) for (Extension extension : extensions) {
if (!extension.suppressBaseMethods && !(methodCall.binding instanceof ProblemMethodBinding)) continue;
for (MethodBinding extensionMethod : extension.extensionMethods) {
if (!Arrays.equals(methodCall.selector, extensionMethod.selector)) continue;