Index: src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java =================================================================== RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java,v --- src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java 27 Jan 2006 15:51:14 -0000 1.7 +++ src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java 3 Feb 2006 20:27:58 -0000 @@ -525,6 +525,14 @@ } else { pointcutDecl.setDesignator(new org.aspectj.org.eclipse.jdt.core.dom.DefaultPointcut(this.ast,pointcutDeclaration.toString())); } + org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument[] parameters = pointcutDeclaration.arguments; + if (parameters != null) { + int parametersLength = parameters.length; + for (int i = 0; i < parametersLength; i++) { + pointcutDecl.parameters().add(convert(parameters[i])); + } + } + // The javadoc comment is now got from list store in compilation unit declaration if (this.resolveBindings) { recordNodes(pointcutDecl, pointcutDeclaration); Index: src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java =================================================================== RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java,v --- src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java 23 Sep 2005 15:53:15 -0000 1.2 +++ src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java 3 Feb 2006 20:28:01 -0000 @@ -514,7 +514,15 @@ printIndent(); buffer.append(" pointcut "); node.getName().accept(this); - buffer.append("():"); + buffer.append("("); + List parameters = node.parameters(); + for (Iterator iter = parameters.iterator(); iter.hasNext();) { + SingleVariableDeclaration element = (SingleVariableDeclaration) iter.next(); + buffer.append(element.getType().toString()+" "+element.getName()); + if (iter.hasNext()) + buffer.append(", "); + } + buffer.append("):"); buffer.append(((DefaultPointcut)node.getDesignator()).getDetail()); buffer.append(";\n"); return false; Index: src/org/aspectj/org/eclipse/jdt/core/dom/PointcutDeclaration.java =================================================================== RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/PointcutDeclaration.java,v --- src/org/aspectj/org/eclipse/jdt/core/dom/PointcutDeclaration.java 11 Nov 2005 08:16:23 -0000 1.2 +++ src/org/aspectj/org/eclipse/jdt/core/dom/PointcutDeclaration.java 3 Feb 2006 20:28:01 -0000 @@ -36,6 +36,12 @@ private PointcutDesignator pointcutDesignator = null; public static final ChildPropertyDescriptor DESIGNATOR_PROPERTY = new ChildPropertyDescriptor(PointcutDeclaration.class, "designator", PointcutDesignator.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ + + /** + * The "parameters" structural property of this node type. + */ + public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY = + new ChildListPropertyDescriptor(PointcutDeclaration.class, "parameters", SingleVariableDeclaration.class, CYCLE_RISK); //$NON-NLS-1$ public PointcutDesignator getDesignator() { return this.pointcutDesignator; @@ -110,20 +116,24 @@ private static final List PROPERTY_DESCRIPTORS_3_0; static { - List propertyList = new ArrayList(5); + List propertyList = new ArrayList(6); createPropertyList(PointcutDeclaration.class, propertyList); addProperty(JAVADOC_PROPERTY, propertyList); addProperty(MODIFIERS_PROPERTY, propertyList); addProperty(NAME_PROPERTY, propertyList); addProperty(DESIGNATOR_PROPERTY, propertyList); + addProperty(PARAMETERS_PROPERTY, propertyList); + PROPERTY_DESCRIPTORS_2_0 = reapPropertyList(propertyList); - propertyList = new ArrayList(5); + propertyList = new ArrayList(6); createPropertyList(PointcutDeclaration.class, propertyList); addProperty(JAVADOC_PROPERTY, propertyList); addProperty(MODIFIERS2_PROPERTY, propertyList); addProperty(NAME_PROPERTY, propertyList); addProperty(DESIGNATOR_PROPERTY, propertyList); + addProperty(PARAMETERS_PROPERTY, propertyList); + PROPERTY_DESCRIPTORS_3_0 = reapPropertyList(propertyList); } @@ -161,6 +171,8 @@ super(ast); } + protected ASTNode.NodeList parameters = + new ASTNode.NodeList(PARAMETERS_PROPERTY); /* (omit javadoc for this method) * Method declared on ASTNode. @@ -225,6 +237,9 @@ if (property == MODIFIERS2_PROPERTY) { return modifiers(); } + if (property == PARAMETERS_PROPERTY) { + return parameters(); + } // allow default implementation to flag the error return super.internalGetChildListProperty(property); } @@ -273,6 +288,8 @@ } result.setName((SimpleName) getName().clone(target)); result.setDesignator((PointcutDesignator) getDesignator().clone(target)); + result.parameters().addAll( + ASTNode.copySubtrees(target, parameters())); return result; } @@ -299,16 +316,28 @@ } acceptChild(ajvis, getName()); acceptChild(ajvis, getDesignator()); + acceptChildren(visitor, this.parameters); } ajvis.endVisit(this); } } + /** + * Returns the live ordered list of method parameter declarations for this + * method declaration. + * + * @return the live list of method parameter declarations + * (element type: SingleVariableDeclaration) + */ + public List parameters() { + return this.parameters; + } + /* (omit javadoc for this method) * Method declared on ASTNode. */ int memSize() { - return super.memSize() + 2 * 4; + return super.memSize() + 3 * 4; } /* (omit javadoc for this method) @@ -320,6 +349,7 @@ + (this.optionalDocComment == null ? 0 : getJavadoc().treeSize()) + (this.pointcutName == null ? 0 : getName().treeSize()) + (this.modifiers == null ? 0 : this.modifiers.listSize()) + + this.parameters.listSize() + (this.pointcutDesignator == null ? 0 : getDesignator().treeSize()); } } Index: testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java =================================================================== RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java,v --- testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java 27 Jan 2006 15:51:15 -0000 1.7 +++ testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java 3 Feb 2006 20:28:04 -0000 @@ -180,6 +180,38 @@ "(compilationUnit(aspect(simpleName)(pointcut(simpleName))))"); } + public void testPointcutWithoutArguments(){ + check("aspect A {pointcut a(): adviceexecution();}", + "(compilationUnit(aspect(simpleName)(pointcut(simpleName))))"); + } + + public void testPointcutWithOnePrimitiveArgument(){ + check("aspect A {pointcut a(int a): adviceexecution();}", + "(compilationUnit(aspect(simpleName)(pointcut(simpleName)(primitiveType)(simpleName))))"); + } + + public void testPointcutWithTwoPrimitiveArguments(){ + check("aspect A {pointcut a(int a, double b): adviceexecution();}", + "(compilationUnit(aspect(simpleName)(pointcut" + + "(simpleName)(primitiveType)(simpleName)(primitiveType)" + + "(simpleName))))"); + } + + public void testPointcutWithOneTypedArgument(){ + check("aspect A {pointcut a(A a): adviceexecution();}", + "(compilationUnit(aspect(simpleName)(pointcut" + + "(simpleName)(simpleName)" + + "(simpleName))))"); + } + + public void testPointcutWithTwoTypedArgument(){ + check("aspect A {pointcut a(A a, B b): adviceexecution();}", + "(compilationUnit(aspect(simpleName)(pointcut" + + "(simpleName)(simpleName)" + + "(simpleName)(simpleName)" + + "(simpleName))))"); + } + public void testFieldITD(){ check("class A {}aspect B {int A.a;}", "(compilationUnit(class(simpleName))(aspect(simpleName)(fieldITD(primitiveType)(simpleName))))"); Index: testsrc/org/aspectj/tools/ajc/AjASTTest.java =================================================================== RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjASTTest.java,v --- testsrc/org/aspectj/tools/ajc/AjASTTest.java 31 Jan 2006 12:53:11 -0000 1.3 +++ testsrc/org/aspectj/tools/ajc/AjASTTest.java 3 Feb 2006 20:28:09 -0000 @@ -393,6 +393,17 @@ "the ReferencePointcut",rp,pd.getDesignator()); } + public void testGetAndSetPointcutArguments(){ + AjAST ajast = createAjAST(); + PointcutDeclaration pd = ajast.newPointcutDeclaration(); + assertEquals("by default the number of arguments is zero",pd.parameters().size(), 0); + // The constructor for 'SingleVariableDeclaration' is not visible +/* SingleVariableDeclaration p1 = new SingleVariableDeclaration(ajast); + pd.parameters().add(p1); + assertEquals("should have set the arguments to be of size 1: ",pd.parameters().size(), 1); +*/ + } + // -------------- AspectDeclaration tests --------------- public void testNewAspectDeclaration() {