summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-03-13 19:16:53 +0000
committerjhugunin <jhugunin>2003-03-13 19:16:53 +0000
commit56cc4f27afaf591f8cebb2450513cc6eb7d51299 (patch)
tree0279a7e07f317888c2ddbee33a63ce4d5ff7c342 /org.aspectj.ajdt.core
parent21f9d5a71fa19792e0268a97955efdb8bf5d7916 (diff)
downloadaspectj-56cc4f27afaf591f8cebb2450513cc6eb7d51299.tar.gz
aspectj-56cc4f27afaf591f8cebb2450513cc6eb7d51299.zip
test and fix for Bugzilla Bug 34925 v1_1_0_RC1
compiler crash on yesterday's rc1 build
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java67
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java40
2 files changed, 57 insertions, 50 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
index 2e0630f6c..a8b5d3d40 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
@@ -13,25 +13,12 @@
package org.aspectj.ajdt.internal.compiler.lookup;
-import org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.InterTypeConstructorDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.InterTypeFieldDeclaration;
-import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration;
+
+import org.aspectj.ajdt.internal.compiler.ast.*;
import org.aspectj.bridge.ISourceLocation;
-import org.aspectj.bridge.SourceLocation;
-import org.aspectj.weaver.Member;
-import org.aspectj.weaver.Shadow;
-import org.aspectj.weaver.TypeX;
-import org.aspectj.weaver.World;
+import org.aspectj.weaver.*;
import org.aspectj.weaver.ast.Var;
-import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
-import org.eclipse.jdt.internal.compiler.ast.AstNode;
-import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
-import org.eclipse.jdt.internal.compiler.ast.MessageSend;
-import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.*;
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
/**
@@ -44,8 +31,8 @@ import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
public class EclipseShadow extends Shadow {
EclipseFactory world;
AstNode astNode;
- //XXXReferenceContext context;
- AbstractMethodDeclaration enclosingMethod;
+ ReferenceContext context;
+ //AbstractMethodDeclaration enclosingMethod;
public EclipseShadow(EclipseFactory world, Kind kind, Member signature, AstNode astNode,
ReferenceContext context)
@@ -53,8 +40,7 @@ public class EclipseShadow extends Shadow {
super(kind, signature, null);
this.world = world;
this.astNode = astNode;
- //XXX can this fail in practice?
- this.enclosingMethod = (AbstractMethodDeclaration)context;
+ this.context = context;
}
public World getIWorld() {
@@ -63,7 +49,13 @@ public class EclipseShadow extends Shadow {
public TypeX getEnclosingType() {
- return world.fromBinding(enclosingMethod.binding.declaringClass);
+ if (context instanceof TypeDeclaration) {
+ return world.fromBinding(((TypeDeclaration)context).binding);
+ } else if (context instanceof AbstractMethodDeclaration) {
+ return world.fromBinding(((AbstractMethodDeclaration)context).binding.declaringClass);
+ } else {
+ return ResolvedTypeX.MISSING;
+ }
}
public ISourceLocation getSourceLocation() {
@@ -72,7 +64,14 @@ public class EclipseShadow extends Shadow {
}
public Member getEnclosingCodeSignature() {
- return world.makeResolvedMember(enclosingMethod.binding);
+ if (context instanceof TypeDeclaration) {
+ return new Member(Member.STATIC_INITIALIZATION, getEnclosingType(), 0,
+ ResolvedTypeX.VOID, "<clinit>", TypeX.NONE);
+ } else if (context instanceof AbstractMethodDeclaration) {
+ return world.makeResolvedMember(((AbstractMethodDeclaration)context).binding);
+ } else {
+ return null;
+ }
}
// -- all below here are only used for implementing, not in matching
@@ -114,14 +113,12 @@ public class EclipseShadow extends Shadow {
world.makeResolvedMember(e.binding), astNode, context);
} else if (astNode instanceof MessageSend) {
MessageSend e = (MessageSend)astNode;
+ if (e.isSuperAccess()) return null; // super calls don't have shadows
return new EclipseShadow(world, Shadow.MethodCall,
world.makeResolvedMember(e.binding), astNode, context);
} else if (astNode instanceof ExplicitConstructorCall) {
- //??? these need to be ignored, they don't have shadows
- return null;
-// ExplicitConstructorCall e = (ExplicitConstructorCall)astNode;
-// return new EclipseShadow(world, Shadow.MethodCall,
-// world.makeResolvedMember(e.binding), astNode, context);
+ //??? these should be ignored, they don't have shadows
+ return null;
} else if (astNode instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration e = (AbstractMethodDeclaration)astNode;
Shadow.Kind kind;
@@ -139,13 +136,23 @@ public class EclipseShadow extends Shadow {
kind = Shadow.MethodExecution;
} else if (e instanceof ConstructorDeclaration) {
kind = Shadow.ConstructorExecution;
+ } else if (e instanceof Clinit) {
+ kind = Shadow.StaticInitialization;
} else {
- throw new RuntimeException("unimplemented: " + e);
+ return null;
+ //throw new RuntimeException("unimplemented: " + e);
}
return new EclipseShadow(world, kind,
world.makeResolvedMember(e.binding), astNode, context);
+ } else if (astNode instanceof TypeDeclaration) {
+ return new EclipseShadow(world, Shadow.StaticInitialization,
+ new Member(Member.STATIC_INITIALIZATION,
+ world.fromBinding(((TypeDeclaration)astNode).binding), 0,
+ ResolvedTypeX.VOID, "<clinit>", TypeX.NONE),
+ astNode, context);
} else {
- throw new RuntimeException("unimplemented: " + astNode);
+ return null;
+ //throw new RuntimeException("unimplemented: " + astNode);
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
index 16bb99b1a..3981de98b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
@@ -65,31 +65,31 @@ public class AjProblemReporter extends ProblemReporter {
{
if (!world.getWorld().getDeclareSoft().isEmpty()) {
Shadow callSite = world.makeShadow(location, referenceContext);
- if (callSite == null) {
- super.unhandledException(exceptionType, location);
- return;
- }
Shadow enclosingExec = world.makeShadow(referenceContext);
- // System.err.println("about to show error for unhandled exception: " + exceptionType +
- // " at " + location + " in " + referenceContext);
-
+// System.err.println("about to show error for unhandled exception: " + new String(exceptionType.sourceName()) +
+// " at " + location + " in " + referenceContext);
for (Iterator i = world.getWorld().getDeclareSoft().iterator(); i.hasNext(); ) {
DeclareSoft d = (DeclareSoft)i.next();
- FuzzyBoolean match = d.getPointcut().match(callSite);
- if (match.alwaysTrue()) {
- //System.err.println("matched callSite: " + callSite + " with " + d);
- return;
- } else if (!match.alwaysFalse()) {
- throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
+ if (callSite != null) {
+ FuzzyBoolean match = d.getPointcut().match(callSite);
+ if (match.alwaysTrue()) {
+ //System.err.println("matched callSite: " + callSite + " with " + d);
+ return;
+ } else if (!match.alwaysFalse()) {
+ //!!! need this check to happen much sooner
+ //throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
+ }
}
-
- match = d.getPointcut().match(enclosingExec);
- if (match.alwaysTrue()) {
- //System.err.println("matched enclosingExec: " + enclosingExec + " with " + d);
- return;
- } else if (!match.alwaysFalse()) {
- throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
+ if (enclosingExec != null) {
+ FuzzyBoolean match = d.getPointcut().match(enclosingExec);
+ if (match.alwaysTrue()) {
+ //System.err.println("matched enclosingExec: " + enclosingExec + " with " + d);
+ return;
+ } else if (!match.alwaysFalse()) {
+ //!!! need this check to happen much sooner
+ //throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
+ }
}
}
}