From 3eb0e5addb26cf4f8a9a66795581c01a60adce63 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 13 Dec 2005 08:50:36 +0000 Subject: [PATCH] AST fixes: 110465 - from helen. --- .../aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java | 4 ++++ .../testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java b/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java index 5ac6e9204..98fc374b6 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java @@ -72,12 +72,16 @@ public class AjASTConverter extends ASTConverter { adviceDecl = new org.aspectj.org.eclipse.jdt.core.dom.AfterAdviceDeclaration(this.ast); } else if (adviceDeclaration.kind.equals(AdviceKind.AfterThrowing)){ adviceDecl = new AfterThrowingAdviceDeclaration(this.ast); + if (adviceDeclaration.extraArgument != null) { SingleVariableDeclaration throwing = convert(adviceDeclaration.extraArgument); ((AfterThrowingAdviceDeclaration)adviceDecl).setThrowing(throwing); + } } else if (adviceDeclaration.kind.equals(AdviceKind.AfterReturning)){ adviceDecl = new AfterReturningAdviceDeclaration(this.ast); + if (adviceDeclaration.extraArgument != null) { SingleVariableDeclaration returning = convert(adviceDeclaration.extraArgument); ((AfterReturningAdviceDeclaration)adviceDecl).setReturning(returning); + } } else if (adviceDeclaration.kind.equals(AdviceKind.Around)){ adviceDecl = new AroundAdviceDeclaration(this.ast); // set the returnType diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java index b16a3606e..33ffbfd2d 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java @@ -102,10 +102,18 @@ public class ASTVisitorTest extends TestCase { check("aspect A {pointcut a();after():a(){}}", "(compilationUnit(aspect(simpleName)(pointcut(simpleName))(afterAdvice(simpleName)(block))))"); } + public void testAfterThrowingAdviceWithNoArgument() { + check("aspect A {pointcut a();after()throwing:a(){} }", + "(compilationUnit(aspect(simpleName)(pointcut(simpleName))(afterThrowingAdvice(simpleName)(block))))"); + } public void testAfterThrowingAdvice() { check("aspect A {pointcut a();after()throwing(Exception e):a(){} }", "(compilationUnit(aspect(simpleName)(pointcut(simpleName))(afterThrowingAdvice(simpleName)(simpleName)(simpleName)(block))))"); } + public void testAfterReturningAdviceWithNoArgument() { + check("aspect A {pointcut a();after()returning:a(){}}", + "(compilationUnit(aspect(simpleName)(pointcut(simpleName))(afterReturningAdvice(simpleName)(block))))"); + } public void testAfterReturningAdvice() { check("aspect A {pointcut a();after()returning(Object o):a(){}}", "(compilationUnit(aspect(simpleName)(pointcut(simpleName))(afterReturningAdvice(simpleName)(simpleName)(simpleName)(block))))"); -- 2.39.5