Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 55758 Details for
Bug 110465
Continue AST work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
AjNaiveASTFlattener support for declare statements
pr110465-NaiveASTFlattener.txt (text/plain), 4.96 KB, created by
Davi Pires
on 2006-12-15 09:52:54 EST
(
hide
)
Description:
AjNaiveASTFlattener support for declare statements
Filename:
MIME Type:
Creator:
Davi Pires
Created:
2006-12-15 09:52:54 EST
Size:
4.96 KB
patch
obsolete
>Index: src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java,v >retrieving revision 1.3 >diff -u -r1.3 AjNaiveASTFlattener.java >--- src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java 6 Feb 2006 13:31:23 -0000 1.3 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java 15 Dec 2006 14:41:00 -0000 >@@ -41,7 +41,7 @@ > * The string buffer into which the serialized representation of the AST is > * written. > */ >- private StringBuffer buffer; >+ protected StringBuffer buffer; > > private int indent = 0; > >@@ -523,7 +523,7 @@ > buffer.append(", "); > } > buffer.append("):"); >- buffer.append(((DefaultPointcut)node.getDesignator()).getDetail()); >+ node.getDesignator().accept(this); > buffer.append(";\n"); > return false; > } >@@ -1646,4 +1646,87 @@ > return false; > } > >+ public boolean visit(DeclareParentsDeclaration node) { >+ printIndent(); >+ this.buffer.append("declare parents: "); >+ node.getChildTypePattern().accept(this); >+ >+ if(node.isExtends()){ >+ this.buffer.append(" extends "); >+ } else { >+ this.buffer.append(" implements "); >+ } >+ >+ for (Iterator it = node.parentTypePatterns().iterator(); it.hasNext();) { >+ TypePattern typePat = (TypePattern) it.next(); >+ typePat.accept(this); >+ if(it.hasNext()){ >+ this.buffer.append(", "); >+ } >+ } >+ >+ this.buffer.append(";\n"); >+ >+ return false; >+ } >+ >+ public boolean visit(DeclareWarningDeclaration node) { >+ printIndent(); >+ >+ this.buffer.append("declare warning: "); >+ node.getPointcut().accept(this); >+ this.buffer.append(" : "); >+ node.getMessage().accept(this); >+ this.buffer.append(" ;\n"); >+ return false; >+ } >+ >+ public boolean visit(DeclareErrorDeclaration node) { >+ printIndent(); >+ >+ this.buffer.append("declare error: "); >+ node.getPointcut().accept(this); >+ this.buffer.append(" : "); >+ node.getMessage().accept(this); >+ this.buffer.append(" ;\n"); >+ return false; >+ } >+ >+ public boolean visit(DeclareSoftDeclaration node) { >+ printIndent(); >+ >+ this.buffer.append("declare soft: "); >+ node.getTypePattern().accept(this); >+ this.buffer.append(" : "); >+ node.getPointcut().accept(this); >+ this.buffer.append(" ;\n"); >+ return false; >+ } >+ >+ public boolean visit(DeclarePrecedenceDeclaration node) { >+ printIndent(); >+ >+ this.buffer.append("declare precedence: "); >+ for (Iterator it = node.typePatterns().iterator(); it.hasNext();) { >+ TypePattern typePat = (TypePattern) it.next(); >+ typePat.accept(this); >+ if(it.hasNext()){ >+ this.buffer.append(", "); >+ } >+ } >+ >+ this.buffer.append(";\n"); >+ >+ return false; >+ } >+ >+ public boolean visit(DefaultTypePattern node) { >+ this.buffer.append(node.getDetail()); >+ return false; >+ } >+ >+ public boolean visit(DefaultPointcut node) { >+ this.buffer.append(node.getDetail()); >+ return false; >+ } > } >Index: testsrc/org/aspectj/tools/ajc/AjNaiveASTFlattenerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjNaiveASTFlattenerTest.java,v >retrieving revision 1.1 >diff -u -r1.1 AjNaiveASTFlattenerTest.java >--- testsrc/org/aspectj/tools/ajc/AjNaiveASTFlattenerTest.java 6 Feb 2006 13:31:24 -0000 1.1 >+++ testsrc/org/aspectj/tools/ajc/AjNaiveASTFlattenerTest.java 15 Dec 2006 14:41:01 -0000 >@@ -61,6 +61,31 @@ > check("public aspect A { pointcut y(int a, double b, Y c): call(* *.*(..));}", > "public aspect A {\n pointcut y(int a, double b, Y c):call(* *.*(..));\n}\n"); > } >+ >+ public void testDeclareParentsDeclaration() throws Exception { >+ check("public aspect A { declare parents: X extends Y; }", >+ "public aspect A {\n declare parents: X extends Y;\n}\n"); >+ } >+ >+ public void testDeclareWarning() throws Exception { >+ check("public aspect A { declare warning: call(* *.*(..)) : \"warning!\"; }", >+ "public aspect A {\n declare warning: call(* *.*(..)) : \"warning!\" ;\n}\n"); >+ } >+ >+ public void testDeclareErrorDeclaration() throws Exception { >+ check("public aspect A { declare error: call(* *.*(..)) : \"error!\"; }", >+ "public aspect A {\n declare error: call(* *.*(..)) : \"error!\" ;\n}\n"); >+ } >+ >+ public void testDeclareSoftDeclaration() throws Exception { >+ check("public aspect A { declare soft: X : call(* *.*(..)); }", >+ "public aspect A {\n declare soft: X : call(* *.*(..)) ;\n}\n"); >+ } >+ >+ public void testDeclarePrecedenceDeclaration() throws Exception { >+ check("public aspect A { declare precedence: X, Y, Z; }", >+ "public aspect A {\n declare precedence: X, Y, Z;\n}\n"); >+ } > > private void check(String source, String expectedOutput) { > ASTParser parser = ASTParser.newParser(AST.JLS2);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
aclement
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 110465
:
31372
|
31373
|
31943
|
32069
|
32485
|
33584
|
33695
|
34121
|
34184
| 55758