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/AjNaiveASTFlattener.java (-2 / +85 lines)
Lines 41-47 Link Here
41
	 * The string buffer into which the serialized representation of the AST is
41
	 * The string buffer into which the serialized representation of the AST is
42
	 * written.
42
	 * written.
43
	 */
43
	 */
44
	private StringBuffer buffer;
44
	protected StringBuffer buffer;
45
	
45
	
46
	private int indent = 0;
46
	private int indent = 0;
47
	
47
	
Lines 523-529 Link Here
523
				buffer.append(", ");
523
				buffer.append(", ");
524
		}
524
		}
525
		buffer.append("):");
525
		buffer.append("):");
526
		buffer.append(((DefaultPointcut)node.getDesignator()).getDetail());
526
		node.getDesignator().accept(this);
527
		buffer.append(";\n");
527
		buffer.append(";\n");
528
		return false;
528
		return false;
529
	}
529
	}
Lines 1646-1649 Link Here
1646
		return false;
1646
		return false;
1647
	}
1647
	}
1648
1648
1649
	public boolean visit(DeclareParentsDeclaration node) {
1650
		printIndent();
1651
		this.buffer.append("declare parents: ");
1652
		node.getChildTypePattern().accept(this);
1653
		
1654
		if(node.isExtends()){
1655
			this.buffer.append(" extends ");
1656
		} else {
1657
			this.buffer.append(" implements ");
1658
		}
1659
		
1660
		for (Iterator it = node.parentTypePatterns().iterator(); it.hasNext();) {
1661
			TypePattern typePat = (TypePattern) it.next();
1662
			typePat.accept(this);
1663
			if(it.hasNext()){
1664
				this.buffer.append(", ");
1665
			}
1666
		}
1667
		
1668
		this.buffer.append(";\n");
1669
		
1670
		return false;
1671
	}
1672
	
1673
	public boolean visit(DeclareWarningDeclaration node) {
1674
		printIndent();
1675
		
1676
		this.buffer.append("declare warning: ");
1677
		node.getPointcut().accept(this);
1678
		this.buffer.append(" : ");
1679
		node.getMessage().accept(this);
1680
		this.buffer.append(" ;\n");
1681
		return false;
1682
	}
1683
	
1684
	public boolean visit(DeclareErrorDeclaration node) {
1685
		printIndent();
1686
		
1687
		this.buffer.append("declare error: ");
1688
		node.getPointcut().accept(this);
1689
		this.buffer.append(" : ");
1690
		node.getMessage().accept(this);
1691
		this.buffer.append(" ;\n");
1692
		return false;
1693
	}
1694
	
1695
	public boolean visit(DeclareSoftDeclaration node) {
1696
		printIndent();
1697
		
1698
		this.buffer.append("declare soft: ");
1699
		node.getTypePattern().accept(this);
1700
		this.buffer.append(" : ");
1701
		node.getPointcut().accept(this);
1702
		this.buffer.append(" ;\n");
1703
		return false;
1704
	}
1705
	
1706
	public boolean visit(DeclarePrecedenceDeclaration node) {
1707
		printIndent();
1708
		
1709
		this.buffer.append("declare precedence: ");
1710
		for (Iterator it = node.typePatterns().iterator(); it.hasNext();) {
1711
			TypePattern typePat = (TypePattern) it.next();
1712
			typePat.accept(this);
1713
			if(it.hasNext()){
1714
				this.buffer.append(", ");
1715
			}
1716
		}
1717
		
1718
		this.buffer.append(";\n");
1719
		
1720
		return false;
1721
	}
1722
	
1723
	public boolean visit(DefaultTypePattern node) {
1724
		this.buffer.append(node.getDetail());
1725
		return false;
1726
	}
1727
	
1728
	public boolean visit(DefaultPointcut node) {
1729
		this.buffer.append(node.getDetail());
1730
		return false;
1731
	}
1649
}
1732
}
(-)testsrc/org/aspectj/tools/ajc/AjNaiveASTFlattenerTest.java (+25 lines)
Lines 61-66 Link Here
61
		check("public aspect A { pointcut y(int a, double b, Y c): call(* *.*(..));}",
61
		check("public aspect A { pointcut y(int a, double b, Y c): call(* *.*(..));}",
62
				"public aspect A {\n   pointcut y(int a, double b, Y c):call(* *.*(..));\n}\n");
62
				"public aspect A {\n   pointcut y(int a, double b, Y c):call(* *.*(..));\n}\n");
63
	}
63
	}
64
	
65
	public void testDeclareParentsDeclaration() throws Exception {
66
		check("public aspect A { declare parents: X extends Y; }",
67
				"public aspect A {\n  declare parents: X extends Y;\n}\n");
68
	}
69
	
70
	public void testDeclareWarning() throws Exception {
71
		check("public aspect A { declare warning: call(* *.*(..)) : \"warning!\"; }",
72
				"public aspect A {\n  declare warning: call(* *.*(..)) : \"warning!\" ;\n}\n");
73
	}
74
	
75
	public void testDeclareErrorDeclaration() throws Exception {
76
		check("public aspect A { declare error: call(* *.*(..)) : \"error!\"; }",
77
		"public aspect A {\n  declare error: call(* *.*(..)) : \"error!\" ;\n}\n");
78
	}
79
	
80
	public void testDeclareSoftDeclaration() throws Exception {
81
		check("public aspect A { declare soft: X : call(* *.*(..)); }",
82
		"public aspect A {\n  declare soft: X : call(* *.*(..)) ;\n}\n");
83
	}
84
	
85
	public void testDeclarePrecedenceDeclaration() throws Exception {
86
		check("public aspect A { declare precedence: X, Y, Z; }",
87
				"public aspect A {\n  declare precedence: X, Y, Z;\n}\n");
88
	}
64
89
65
	private void check(String source, String expectedOutput) {
90
	private void check(String source, String expectedOutput) {
66
		ASTParser parser = ASTParser.newParser(AST.JLS2);
91
		ASTParser parser = ASTParser.newParser(AST.JLS2);

Return to bug 110465