View | Details | Raw Unified | Return to bug 110465 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java (+8 lines)
Lines 525-530 Link Here
525
		} else {
525
		} else {
526
			pointcutDecl.setDesignator(new org.aspectj.org.eclipse.jdt.core.dom.DefaultPointcut(this.ast,pointcutDeclaration.toString()));
526
			pointcutDecl.setDesignator(new org.aspectj.org.eclipse.jdt.core.dom.DefaultPointcut(this.ast,pointcutDeclaration.toString()));
527
		}
527
		}
528
		org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument[] parameters = pointcutDeclaration.arguments;
529
		if (parameters != null) {
530
			int parametersLength = parameters.length;
531
			for (int i = 0; i < parametersLength; i++) {
532
				pointcutDecl.parameters().add(convert(parameters[i]));
533
			}
534
		}
535
		
528
//		 The javadoc comment is now got from list store in compilation unit declaration
536
//		 The javadoc comment is now got from list store in compilation unit declaration
529
		if (this.resolveBindings) {
537
		if (this.resolveBindings) {
530
			recordNodes(pointcutDecl, pointcutDeclaration);
538
			recordNodes(pointcutDecl, pointcutDeclaration);
(-)src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java (-1 / +9 lines)
Lines 514-520 Link Here
514
		printIndent();
514
		printIndent();
515
		buffer.append(" pointcut ");
515
		buffer.append(" pointcut ");
516
		node.getName().accept(this);
516
		node.getName().accept(this);
517
		buffer.append("():");
517
		buffer.append("(");
518
		List parameters = node.parameters();
519
		for (Iterator iter = parameters.iterator(); iter.hasNext();) {
520
			SingleVariableDeclaration element = (SingleVariableDeclaration) iter.next();
521
			buffer.append(element.getType().toString()+" "+element.getName());
522
			if (iter.hasNext())
523
				buffer.append(", ");
524
		}
525
		buffer.append("):");
518
		buffer.append(((DefaultPointcut)node.getDesignator()).getDetail());
526
		buffer.append(((DefaultPointcut)node.getDesignator()).getDetail());
519
		buffer.append(";\n");
527
		buffer.append(";\n");
520
		return false;
528
		return false;
(-)src/org/aspectj/org/eclipse/jdt/core/dom/PointcutDeclaration.java (-3 / +33 lines)
Lines 36-41 Link Here
36
	private PointcutDesignator pointcutDesignator = null;
36
	private PointcutDesignator pointcutDesignator = null;
37
	public static final ChildPropertyDescriptor DESIGNATOR_PROPERTY = 
37
	public static final ChildPropertyDescriptor DESIGNATOR_PROPERTY = 
38
		new ChildPropertyDescriptor(PointcutDeclaration.class, "designator", PointcutDesignator.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
38
		new ChildPropertyDescriptor(PointcutDeclaration.class, "designator", PointcutDesignator.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
39
40
	/**
41
	 * The "parameters" structural property of this node type.
42
	 */
43
	public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY = 
44
		new ChildListPropertyDescriptor(PointcutDeclaration.class, "parameters", SingleVariableDeclaration.class, CYCLE_RISK); //$NON-NLS-1$
39
	
45
	
40
	public PointcutDesignator getDesignator() {
46
	public PointcutDesignator getDesignator() {
41
		return this.pointcutDesignator;
47
		return this.pointcutDesignator;
Lines 110-129 Link Here
110
	private static final List PROPERTY_DESCRIPTORS_3_0;
116
	private static final List PROPERTY_DESCRIPTORS_3_0;
111
	
117
	
112
	static {
118
	static {
113
		List propertyList = new ArrayList(5);
119
		List propertyList = new ArrayList(6);
114
		createPropertyList(PointcutDeclaration.class, propertyList);
120
		createPropertyList(PointcutDeclaration.class, propertyList);
115
		addProperty(JAVADOC_PROPERTY, propertyList);
121
		addProperty(JAVADOC_PROPERTY, propertyList);
116
		addProperty(MODIFIERS_PROPERTY, propertyList);
122
		addProperty(MODIFIERS_PROPERTY, propertyList);
117
		addProperty(NAME_PROPERTY, propertyList);
123
		addProperty(NAME_PROPERTY, propertyList);
118
		addProperty(DESIGNATOR_PROPERTY, propertyList);
124
		addProperty(DESIGNATOR_PROPERTY, propertyList);
125
		addProperty(PARAMETERS_PROPERTY, propertyList);
126
		
119
		PROPERTY_DESCRIPTORS_2_0 = reapPropertyList(propertyList);
127
		PROPERTY_DESCRIPTORS_2_0 = reapPropertyList(propertyList);
120
		
128
		
121
		propertyList = new ArrayList(5);
129
		propertyList = new ArrayList(6);
122
		createPropertyList(PointcutDeclaration.class, propertyList);
130
		createPropertyList(PointcutDeclaration.class, propertyList);
123
		addProperty(JAVADOC_PROPERTY, propertyList);
131
		addProperty(JAVADOC_PROPERTY, propertyList);
124
		addProperty(MODIFIERS2_PROPERTY, propertyList);
132
		addProperty(MODIFIERS2_PROPERTY, propertyList);
125
		addProperty(NAME_PROPERTY, propertyList);
133
		addProperty(NAME_PROPERTY, propertyList);
126
		addProperty(DESIGNATOR_PROPERTY, propertyList);
134
		addProperty(DESIGNATOR_PROPERTY, propertyList);
135
		addProperty(PARAMETERS_PROPERTY, propertyList);
136
		
127
		PROPERTY_DESCRIPTORS_3_0 = reapPropertyList(propertyList);
137
		PROPERTY_DESCRIPTORS_3_0 = reapPropertyList(propertyList);
128
	}
138
	}
129
139
Lines 161-166 Link Here
161
		super(ast);
171
		super(ast);
162
	}
172
	}
163
	
173
	
174
	protected ASTNode.NodeList parameters =
175
		new ASTNode.NodeList(PARAMETERS_PROPERTY);
164
176
165
	/* (omit javadoc for this method)
177
	/* (omit javadoc for this method)
166
	 * Method declared on ASTNode.
178
	 * Method declared on ASTNode.
Lines 225-230 Link Here
225
		if (property == MODIFIERS2_PROPERTY) {
237
		if (property == MODIFIERS2_PROPERTY) {
226
			return modifiers();
238
			return modifiers();
227
		}
239
		}
240
		if (property == PARAMETERS_PROPERTY) {
241
			return parameters();
242
		}
228
		// allow default implementation to flag the error
243
		// allow default implementation to flag the error
229
		return super.internalGetChildListProperty(property);
244
		return super.internalGetChildListProperty(property);
230
	}
245
	}
Lines 273-278 Link Here
273
		}
288
		}
274
		result.setName((SimpleName) getName().clone(target));
289
		result.setName((SimpleName) getName().clone(target));
275
		result.setDesignator((PointcutDesignator) getDesignator().clone(target));
290
		result.setDesignator((PointcutDesignator) getDesignator().clone(target));
291
		result.parameters().addAll(
292
				ASTNode.copySubtrees(target, parameters()));
276
		return result;
293
		return result;
277
	}
294
	}
278
	
295
	
Lines 299-314 Link Here
299
				}
316
				}
300
				acceptChild(ajvis, getName());
317
				acceptChild(ajvis, getName());
301
				acceptChild(ajvis, getDesignator());
318
				acceptChild(ajvis, getDesignator());
319
				acceptChildren(visitor, this.parameters);
302
			}
320
			}
303
			ajvis.endVisit(this);
321
			ajvis.endVisit(this);
304
		}
322
		}
305
	}
323
	}
306
		
324
		
325
	/**
326
	 * Returns the live ordered list of method parameter declarations for this
327
	 * method declaration.
328
	 * 
329
	 * @return the live list of method parameter declarations
330
	 *    (element type: <code>SingleVariableDeclaration</code>)
331
	 */ 
332
	public List parameters() {
333
		return this.parameters;
334
	}
335
	
307
	/* (omit javadoc for this method)
336
	/* (omit javadoc for this method)
308
	 * Method declared on ASTNode.
337
	 * Method declared on ASTNode.
309
	 */
338
	 */
310
	int memSize() {
339
	int memSize() {
311
		return super.memSize() + 2 * 4;
340
		return super.memSize() + 3 * 4;
312
	}
341
	}
313
	
342
	
314
	/* (omit javadoc for this method)
343
	/* (omit javadoc for this method)
Lines 320-325 Link Here
320
			+ (this.optionalDocComment == null ? 0 : getJavadoc().treeSize())
349
			+ (this.optionalDocComment == null ? 0 : getJavadoc().treeSize())
321
			+ (this.pointcutName == null ? 0 : getName().treeSize())
350
			+ (this.pointcutName == null ? 0 : getName().treeSize())
322
			+ (this.modifiers == null ? 0 : this.modifiers.listSize())
351
			+ (this.modifiers == null ? 0 : this.modifiers.listSize())
352
			+ this.parameters.listSize()
323
			+ (this.pointcutDesignator == null ? 0 : getDesignator().treeSize());
353
			+ (this.pointcutDesignator == null ? 0 : getDesignator().treeSize());
324
	}
354
	}
325
}
355
}
(-)testsrc/org/aspectj/tools/ajc/ASTVisitorTest.java (+32 lines)
Lines 180-185 Link Here
180
				"(compilationUnit(aspect(simpleName)(pointcut(simpleName))))");
180
				"(compilationUnit(aspect(simpleName)(pointcut(simpleName))))");
181
	}
181
	}
182
	
182
	
183
	public void testPointcutWithoutArguments(){
184
		check("aspect A {pointcut a(): adviceexecution();}",
185
				"(compilationUnit(aspect(simpleName)(pointcut(simpleName))))");
186
	}
187
		
188
	public void testPointcutWithOnePrimitiveArgument(){
189
		check("aspect A {pointcut a(int a): adviceexecution();}",
190
		"(compilationUnit(aspect(simpleName)(pointcut(simpleName)(primitiveType)(simpleName))))");
191
	}
192
193
	public void testPointcutWithTwoPrimitiveArguments(){
194
		check("aspect A {pointcut a(int a, double b): adviceexecution();}",
195
		"(compilationUnit(aspect(simpleName)(pointcut" +
196
		"(simpleName)(primitiveType)(simpleName)(primitiveType)" +
197
		"(simpleName))))");
198
	}
199
200
	public void testPointcutWithOneTypedArgument(){
201
		check("aspect A {pointcut a(A a): adviceexecution();}",
202
		"(compilationUnit(aspect(simpleName)(pointcut" +
203
		"(simpleName)(simpleName)" +
204
		"(simpleName))))");
205
	}
206
207
	public void testPointcutWithTwoTypedArgument(){
208
		check("aspect A {pointcut a(A a, B b): adviceexecution();}",
209
		"(compilationUnit(aspect(simpleName)(pointcut" +
210
		"(simpleName)(simpleName)" +
211
		"(simpleName)(simpleName)" +
212
		"(simpleName))))");
213
	}
214
183
	public void testFieldITD(){
215
	public void testFieldITD(){
184
		check("class A {}aspect B {int A.a;}",
216
		check("class A {}aspect B {int A.a;}",
185
				"(compilationUnit(class(simpleName))(aspect(simpleName)(fieldITD(primitiveType)(simpleName))))");
217
				"(compilationUnit(class(simpleName))(aspect(simpleName)(fieldITD(primitiveType)(simpleName))))");
(-)testsrc/org/aspectj/tools/ajc/AjASTTest.java (+11 lines)
Lines 393-398 Link Here
393
				"the ReferencePointcut",rp,pd.getDesignator());
393
				"the ReferencePointcut",rp,pd.getDesignator());
394
	}
394
	}
395
	
395
	
396
	public void testGetAndSetPointcutArguments(){
397
		AjAST ajast = createAjAST();
398
		PointcutDeclaration pd = ajast.newPointcutDeclaration();
399
		assertEquals("by default the number of arguments is zero",pd.parameters().size(), 0);
400
		// The constructor for 'SingleVariableDeclaration' is not visible 
401
/*		SingleVariableDeclaration p1 = new SingleVariableDeclaration(ajast); 
402
		pd.parameters().add(p1);
403
		assertEquals("should have set the arguments to be of size 1: ",pd.parameters().size(), 1);
404
*/		
405
	}
406
396
	// -------------- AspectDeclaration tests ---------------
407
	// -------------- AspectDeclaration tests ---------------
397
408
398
	public void testNewAspectDeclaration() {
409
	public void testNewAspectDeclaration() {

Return to bug 110465