summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-05-01 03:25:43 +0000
committerjhugunin <jhugunin>2003-05-01 03:25:43 +0000
commitea84f573e50bd198f3412acffb7157e9d9b8b544 (patch)
treee9821ceb029efbd9d6f211c9ec243fa80ea9d205 /org.aspectj.ajdt.core
parentabe705ad6b4926e7c02cf49b3ba033c320cf2b60 (diff)
downloadaspectj-ea84f573e50bd198f3412acffb7157e9d9b8b544.tar.gz
aspectj-ea84f573e50bd198f3412acffb7157e9d9b8b544.zip
expanded coverage and fix for bug involving around advice with either
assert or <name>.class in the body the fix for now is just to not inline such advice, but in the future these should be transformed to inlinable constructs
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java20
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java4
2 files changed, 24 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
index 637ab0bd1..aa195135e 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
@@ -23,6 +23,8 @@ import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.ResolvedMember;
import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
+import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
@@ -57,6 +59,10 @@ public class AccessForInlineVisitor extends AbstractSyntaxTreeVisitorAdapter {
AspectDeclaration inAspect;
EclipseFactory world; // alias for inAspect.world
+ // set to true for ClassLiteralAccess and AssertStatement
+ // ??? A better answer would be to transform these into inlinable forms
+ public boolean isInlinable = true;
+
public AccessForInlineVisitor(AspectDeclaration inAspect, PrivilegedHandler handler) {
this.inAspect = inAspect;
this.world = inAspect.factory;
@@ -187,4 +193,18 @@ public class AccessForInlineVisitor extends AbstractSyntaxTreeVisitorAdapter {
return;
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor#endVisit(org.eclipse.jdt.internal.compiler.ast.AssertStatement, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
+ */
+ public void endVisit(AssertStatement assertStatement, BlockScope scope) {
+ isInlinable = false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor#endVisit(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
+ */
+ public void endVisit(ClassLiteralAccess classLiteral, BlockScope scope) {
+ isInlinable = false;
+ }
+
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
index f23502f75..aabc84624 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
@@ -163,6 +163,10 @@ public class AdviceDeclaration extends MethodDeclaration {
AccessForInlineVisitor v = new AccessForInlineVisitor((AspectDeclaration)upperScope.referenceContext, handler);
this.traverse(v, (ClassScope) null);
+
+ // ??? if we found a construct that we can't inline, set
+ // proceedInInners so that we won't try to inline this body
+ if (!v.isInlinable) proceedInInners = true;
}
}
}