]> source.dussan.org Git - aspectj.git/commitdiff
AST fixes: 110465 - from helen.
authoraclement <aclement>
Tue, 13 Dec 2005 08:50:36 +0000 (08:50 +0000)
committeraclement <aclement>
Tue, 13 Dec 2005 08:50:36 +0000 (08:50 +0000)
org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java
org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java

index 5ac6e9204a048690e7cf64c743f7995439c354f7..98fc374b62e5dc7851796361b4f3942360700750 100644 (file)
@@ -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
index b16a3606ee877f6cc8677d816ce2e486d4989f91..33ffbfd2dfc3345e8a6141aedd47af8550102b75 100644 (file)
@@ -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))))");