[Jboss-cvs] JBossAS SVN: r57051 - in trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate: . ast javassist
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 21 08:21:19 EDT 2006
Author: kabir.khan at jboss.com
Date: 2006-09-21 08:21:09 -0400 (Thu, 21 Sep 2006)
New Revision: 57051
Added:
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTAnnotation.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTChar.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTIdentifier.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValue.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValueArrayInitializer.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePair.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePairs.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTSingleMemberValue.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTStart.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTString.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParser.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserConstants.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTester.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTokenManager.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTreeConstants.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserVisitor.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/JJTAnnotationParserState.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Node.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ParseException.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleCharStream.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleNode.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Token.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/TokenMgrError.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/annotation.jjt
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/AnnotationProxy.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/DefaultValueAnnotationValidator.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/MemberValueGetter.java
trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/ProxyMapCreator.java
Log:
[JBAOP-286] Weaken dependencies on unreleased MC 2.0 - I screwed up originally and added these files to the mc project (had copied across folders with .svn folders)
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTAnnotation.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTAnnotation.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTAnnotation.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTAnnotation extends ASTMemberValue {
+ public ASTAnnotation(int id) {
+ super(id);
+ }
+
+ public ASTAnnotation(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+
+ private String identifier;
+
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ public void setIdentifier(String identifier)
+ {
+ this.identifier = identifier;
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTChar.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTChar.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTChar.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTChar extends ASTMemberValue
+{
+ public ASTChar(int id)
+ {
+ super(id);
+ }
+
+ public ASTChar(AnnotationParser p, int id)
+ {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ private char value;
+
+ public void setValue(String val)
+ {
+ value = val.charAt(1);
+ }
+
+ public char getValue() { return value; }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTIdentifier.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTIdentifier.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTIdentifier.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTIdentifier extends ASTMemberValue {
+ public ASTIdentifier(int id) {
+ super(id);
+ }
+
+ public ASTIdentifier(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+
+ String value;
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValue.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValue.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValue.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTMemberValue extends SimpleNode {
+ public ASTMemberValue(int id) {
+ super(id);
+ }
+
+ public ASTMemberValue(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValueArrayInitializer.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValueArrayInitializer.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValueArrayInitializer.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTMemberValueArrayInitializer extends ASTMemberValue {
+ public ASTMemberValueArrayInitializer(int id) {
+ super(id);
+ }
+
+ public ASTMemberValueArrayInitializer(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePair.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePair.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePair.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTMemberValuePair extends SimpleNode {
+ public ASTMemberValuePair(int id) {
+ super(id);
+ }
+
+ public ASTMemberValuePair(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+
+ private ASTIdentifier identifier;
+ private ASTMemberValue value;
+ public void jjtAddChild(Node n, int i)
+ {
+ if ((n instanceof ASTIdentifier) && i == 0)
+ {
+ identifier = (ASTIdentifier)n;
+ return;
+ }
+ if (n instanceof ASTMemberValue) value = (ASTMemberValue)n;
+ }
+
+ public ASTIdentifier getIdentifier()
+ {
+ return identifier;
+ }
+
+ public ASTMemberValue getValue()
+ {
+ return value;
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePairs.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePairs.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTMemberValuePairs.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTMemberValuePairs extends SimpleNode {
+ public ASTMemberValuePairs(int id) {
+ super(id);
+ }
+
+ public ASTMemberValuePairs(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTSingleMemberValue.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTSingleMemberValue.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTSingleMemberValue.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTSingleMemberValue extends SimpleNode
+{
+ public ASTSingleMemberValue(int id)
+ {
+ super(id);
+ }
+
+ public ASTSingleMemberValue(AnnotationParser p, int id)
+ {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ private ASTMemberValue value;
+
+ public void jjtAddChild(Node n, int i)
+ {
+ if (n instanceof ASTMemberValue) value = (ASTMemberValue) n;
+ }
+
+ public ASTMemberValue getValue()
+ {
+ return value;
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTStart.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTStart.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTStart.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTStart extends SimpleNode {
+ public ASTStart(int id) {
+ super(id);
+ }
+
+ public ASTStart(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTString.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTString.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ASTString.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class ASTString extends ASTMemberValue {
+ public ASTString(int id) {
+ super(id);
+ }
+
+ public ASTString(AnnotationParser p, int id) {
+ super(p, id);
+ }
+
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+
+ private String value;
+
+ public void setValue(String val)
+ {
+ value = val.substring(1, val.length() - 1);
+ }
+
+ public String getValue() { return value; }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParser.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParser.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParser.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,743 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class AnnotationParser/*@bgen(jjtree)*/implements AnnotationParserTreeConstants, AnnotationParserConstants {/*@bgen(jjtree)*/
+ protected JJTAnnotationParserState jjtree = new JJTAnnotationParserState();
+
+ final public ASTStart Start() throws ParseException {
+ /*@bgen(jjtree) Start */
+ ASTStart jjtn000 = new ASTStart(JJTSTART);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ try {
+ Annotation();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case 7:
+ jj_consume_token(7);
+ break;
+ case 8:
+ jj_consume_token(8);
+ break;
+ case 0:
+ jj_consume_token(0);
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ {if (true) return jjtn000;}
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void Annotation() throws ParseException {
+ /*@bgen(jjtree) Annotation */
+ ASTAnnotation jjtn000 = new ASTAnnotation(JJTANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);Token tok;
+ try {
+ jj_consume_token(9);
+ tok = jj_consume_token(IDENTIFIER);
+ jjtn000.setIdentifier(tok.image);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case 10:
+ jj_consume_token(10);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENTIFIER:
+ case CHARACTER:
+ case STRING:
+ case 9:
+ case 14:
+ if (jj_2_1(2)) {
+ MemberValuePairs();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENTIFIER:
+ case CHARACTER:
+ case STRING:
+ case 9:
+ case 14:
+ SingleMemberValue();
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ ;
+ }
+ jj_consume_token(11);
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void SingleMemberValue() throws ParseException {
+ /*@bgen(jjtree) SingleMemberValue */
+ ASTSingleMemberValue jjtn000 = new ASTSingleMemberValue(JJTSINGLEMEMBERVALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ try {
+ MemberValue();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void MemberValuePairs() throws ParseException {
+ /*@bgen(jjtree) MemberValuePairs */
+ ASTMemberValuePairs jjtn000 = new ASTMemberValuePairs(JJTMEMBERVALUEPAIRS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ try {
+ MemberValuePair();
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case 12:
+ ;
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ break label_1;
+ }
+ jj_consume_token(12);
+ MemberValuePair();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void MemberValuePair() throws ParseException {
+ /*@bgen(jjtree) MemberValuePair */
+ ASTMemberValuePair jjtn000 = new ASTMemberValuePair(JJTMEMBERVALUEPAIR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);Token specialToken;
+ try {
+ Identifier();
+ jj_consume_token(13);
+ MemberValue();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void MemberValue() throws ParseException {
+ Token tok;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case 9:
+ Annotation();
+ break;
+ case 14:
+ MemberValueArrayInitializer();
+ break;
+ case STRING:
+ String();
+ break;
+ case CHARACTER:
+ Char();
+ break;
+ case IDENTIFIER:
+ Identifier();
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public void MemberValueArrayInitializer() throws ParseException {
+ /*@bgen(jjtree) MemberValueArrayInitializer */
+ ASTMemberValueArrayInitializer jjtn000 = new ASTMemberValueArrayInitializer(JJTMEMBERVALUEARRAYINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ try {
+ jj_consume_token(14);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENTIFIER:
+ case CHARACTER:
+ case STRING:
+ case 9:
+ case 14:
+ MemberValue();
+ label_2:
+ while (true) {
+ if (jj_2_2(2)) {
+ ;
+ } else {
+ break label_2;
+ }
+ jj_consume_token(12);
+ MemberValue();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case 12:
+ jj_consume_token(12);
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ ;
+ }
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ ;
+ }
+ jj_consume_token(15);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void Identifier() throws ParseException {
+ /*@bgen(jjtree) Identifier */
+ ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);Token tok;
+ try {
+ tok = jj_consume_token(IDENTIFIER);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setValue(tok.image);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void String() throws ParseException {
+ /*@bgen(jjtree) String */
+ ASTString jjtn000 = new ASTString(JJTSTRING);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);Token tok;
+ try {
+ tok = jj_consume_token(STRING);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setValue(tok.image);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final public void Char() throws ParseException {
+ /*@bgen(jjtree) Char */
+ ASTChar jjtn000 = new ASTChar(JJTCHAR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);Token tok;
+ try {
+ tok = jj_consume_token(CHARACTER);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setValue(tok.image);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_1(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(0, xla); }
+ }
+
+ final private boolean jj_2_2(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_2(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(1, xla); }
+ }
+
+ final private boolean jj_3R_4() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_6()) {
+ jj_scanpos = xsp;
+ if (jj_3R_7()) {
+ jj_scanpos = xsp;
+ if (jj_3R_8()) {
+ jj_scanpos = xsp;
+ if (jj_3R_9()) {
+ jj_scanpos = xsp;
+ if (jj_3R_10()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_6() {
+ if (jj_3R_12()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_3()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_14() {
+ if (jj_scan_token(STRING)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_13() {
+ if (jj_scan_token(14)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_5() {
+ if (jj_3R_11()) return true;
+ if (jj_scan_token(13)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_2() {
+ if (jj_scan_token(12)) return true;
+ if (jj_3R_4()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_10() {
+ if (jj_3R_11()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_9() {
+ if (jj_3R_15()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_12() {
+ if (jj_scan_token(9)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_11() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_15() {
+ if (jj_scan_token(CHARACTER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_8() {
+ if (jj_3R_14()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_3() {
+ if (jj_3R_5()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_7() {
+ if (jj_3R_13()) return true;
+ return false;
+ }
+
+ public AnnotationParserTokenManager token_source;
+ SimpleCharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[8];
+ static private int[] jj_la1_0;
+ static {
+ jj_la1_0();
+ }
+ private static void jj_la1_0() {
+ jj_la1_0 = new int[] {0x181,0x4268,0x4268,0x400,0x1000,0x4268,0x1000,0x4268,};
+ }
+ final private JJCalls[] jj_2_rtns = new JJCalls[2];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ public AnnotationParser(java.io.InputStream stream) {
+ jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new AnnotationParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public AnnotationParser(java.io.Reader stream) {
+ jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new AnnotationParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public AnnotationParser(AnnotationParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(AnnotationParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ static private final class LookaheadSuccess extends java.lang.Error {}
+ final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ if (jj_scanpos.kind != kind) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+ return false;
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.Vector jj_expentries = new java.util.Vector();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
+ int[] oldentry = (int[])(e.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[16];
+ for (int i = 0; i < 16; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 8; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 16; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+ final private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 2; i++) {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ case 1: jj_3_2(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ }
+ jj_rescan = false;
+ }
+
+ final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserConstants.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserConstants.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserConstants.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public interface AnnotationParserConstants {
+
+ int EOF = 0;
+ int IDENTIFIER = 3;
+ int LETTER = 4;
+ int CHARACTER = 5;
+ int STRING = 6;
+
+ int DEFAULT = 0;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\t\"",
+ "<IDENTIFIER>",
+ "<LETTER>",
+ "<CHARACTER>",
+ "<STRING>",
+ "\"\\r\\n\"",
+ "\"\\n\"",
+ "\"@\"",
+ "\"(\"",
+ "\")\"",
+ "\",\"",
+ "\"=\"",
+ "\"{\"",
+ "\"}\"",
+ };
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTester.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTester.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTester.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+
+
+public class AnnotationParserTester implements AnnotationParserVisitor
+{
+ private int indent = 0;
+
+ private String indentString()
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < indent; ++i)
+ {
+ sb.append(" ");
+ }
+ return sb.toString();
+ }
+
+ public Object visit(ASTSingleMemberValue node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(SimpleNode node, Object data)
+ {
+ System.out.println(indentString() + node +
+ ": acceptor not unimplemented in subclass?");
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTStart node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTAnnotation node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTMemberValuePairs node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTMemberValuePair node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTMemberValueArrayInitializer node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTIdentifier node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTString node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public Object visit(ASTChar node, Object data)
+ {
+ System.out.println(indentString() + node);
+ ++indent;
+ data = node.childrenAccept(this, data);
+ --indent;
+ return data;
+ }
+
+ public static void main(String args[])
+ {
+// System.out.println("----" + args[0]);
+// StringReader reader = new StringReader(args[0]);
+ System.out.println("Reading from stdin");
+ AnnotationParser t = new AnnotationParser(System.in);
+ //PointcutExpressionParser t = new PointcutExpressionParser(System.in);
+ try
+ {
+ ASTStart n = t.Start();
+ AnnotationParserVisitor v = new AnnotationParserTester();
+ n.jjtAccept(v, null);
+ }
+ catch (Exception e)
+ {
+ System.out.println("Oops.");
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
+
+/*end*/
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTokenManager.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTokenManager.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTokenManager.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,493 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class AnnotationParserTokenManager implements AnnotationParserConstants
+{
+ public java.io.PrintStream debugStream = System.out;
+ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 10:
+ return jjStopAtPos(0, 8);
+ case 13:
+ return jjMoveStringLiteralDfa1_0(0x80L);
+ case 40:
+ return jjStopAtPos(0, 10);
+ case 41:
+ return jjStopAtPos(0, 11);
+ case 44:
+ return jjStopAtPos(0, 12);
+ case 61:
+ return jjStopAtPos(0, 13);
+ case 64:
+ return jjStopAtPos(0, 9);
+ case 123:
+ return jjStopAtPos(0, 14);
+ case 125:
+ return jjStopAtPos(0, 15);
+ default :
+ return jjMoveNfa_0(1, 0);
+ }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 10:
+ if ((active0 & 0x80L) != 0L)
+ return jjStopAtPos(1, 7);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+}
+private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private final void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 27;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ if ((0x3ff401000000000L & l) != 0L)
+ {
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(0);
+ }
+ else if (curChar == 34)
+ jjCheckNAddStates(0, 2);
+ else if (curChar == 39)
+ jjAddStates(3, 4);
+ break;
+ case 0:
+ if ((0x3ff401000000000L & l) == 0L)
+ break;
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if ((0xffffff7fffffdbffL & l) != 0L)
+ jjCheckNAdd(3);
+ break;
+ case 3:
+ if (curChar == 39 && kind > 5)
+ kind = 5;
+ break;
+ case 5:
+ if ((0x8000008400000000L & l) != 0L)
+ jjCheckNAdd(3);
+ break;
+ case 6:
+ if (curChar == 48)
+ jjCheckNAddTwoStates(7, 3);
+ break;
+ case 7:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(7, 3);
+ break;
+ case 8:
+ if ((0x3fe000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(9, 3);
+ break;
+ case 9:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(9, 3);
+ break;
+ case 10:
+ if (curChar == 48)
+ jjAddStates(5, 6);
+ break;
+ case 12:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(12, 3);
+ break;
+ case 14:
+ if (curChar == 34)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 15:
+ if ((0xfffffffbffffdbffL & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 17:
+ if ((0x8000008400000000L & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 18:
+ if (curChar == 34 && kind > 6)
+ kind = 6;
+ break;
+ case 19:
+ if (curChar == 48)
+ jjCheckNAddStates(7, 10);
+ break;
+ case 20:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddStates(7, 10);
+ break;
+ case 21:
+ if ((0x3fe000000000000L & l) != 0L)
+ jjCheckNAddStates(11, 14);
+ break;
+ case 22:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(11, 14);
+ break;
+ case 23:
+ if (curChar == 48)
+ jjAddStates(15, 16);
+ break;
+ case 25:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(17, 20);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ case 0:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAdd(3);
+ break;
+ case 4:
+ if (curChar == 92)
+ jjAddStates(21, 24);
+ break;
+ case 5:
+ if ((0x54404610000000L & l) != 0L)
+ jjCheckNAdd(3);
+ break;
+ case 11:
+ if (curChar == 120)
+ jjCheckNAdd(12);
+ break;
+ case 12:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(12, 3);
+ break;
+ case 13:
+ if (curChar == 88)
+ jjCheckNAdd(12);
+ break;
+ case 15:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 16:
+ if (curChar == 92)
+ jjAddStates(25, 28);
+ break;
+ case 17:
+ if ((0x54404610000000L & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 24:
+ if (curChar == 120)
+ jjCheckNAdd(25);
+ break;
+ case 25:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(17, 20);
+ break;
+ case 26:
+ if (curChar == 88)
+ jjCheckNAdd(25);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 2:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ case 15:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(0, 2);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 27 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static final int[] jjnextStates = {
+ 15, 16, 18, 2, 4, 11, 13, 15, 16, 20, 18, 15, 16, 22, 18, 24,
+ 26, 15, 16, 25, 18, 5, 6, 8, 10, 17, 19, 21, 23,
+};
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, "\15\12", "\12", "\100", "\50", "\51",
+"\54", "\75", "\173", "\175", };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+};
+static final long[] jjtoToken = {
+ 0xffe9L,
+};
+static final long[] jjtoSkip = {
+ 0x6L,
+};
+protected SimpleCharStream input_stream;
+private final int[] jjrounds = new int[27];
+private final int[] jjstateSet = new int[54];
+protected char curChar;
+public AnnotationParserTokenManager(SimpleCharStream stream)
+{
+ if (SimpleCharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+}
+public AnnotationParserTokenManager(SimpleCharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+public void ReInit(SimpleCharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 27; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+public void ReInit(SimpleCharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 1 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+protected Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ t.image = (im == null) ? input_stream.GetImage() : im;
+ t.beginLine = input_stream.getBeginLine();
+ t.beginColumn = input_stream.getBeginColumn();
+ t.endLine = input_stream.getEndLine();
+ t.endColumn = input_stream.getEndColumn();
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100000200L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ else
+ {
+ continue EOFLoop;
+ }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+}
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTreeConstants.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTreeConstants.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserTreeConstants.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public interface AnnotationParserTreeConstants
+{
+ public int JJTSTART = 0;
+ public int JJTANNOTATION = 1;
+ public int JJTSINGLEMEMBERVALUE = 2;
+ public int JJTMEMBERVALUEPAIRS = 3;
+ public int JJTMEMBERVALUEPAIR = 4;
+ public int JJTVOID = 5;
+ public int JJTMEMBERVALUEARRAYINITIALIZER = 6;
+ public int JJTIDENTIFIER = 7;
+ public int JJTSTRING = 8;
+ public int JJTCHAR = 9;
+
+
+ public String[] jjtNodeName = {
+ "Start",
+ "Annotation",
+ "SingleMemberValue",
+ "MemberValuePairs",
+ "MemberValuePair",
+ "void",
+ "MemberValueArrayInitializer",
+ "Identifier",
+ "String",
+ "Char",
+ };
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserVisitor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserVisitor.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/AnnotationParserVisitor.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public interface AnnotationParserVisitor
+{
+ public Object visit(SimpleNode node, Object data);
+ public Object visit(ASTStart node, Object data);
+ public Object visit(ASTAnnotation node, Object data);
+ public Object visit(ASTSingleMemberValue node, Object data);
+ public Object visit(ASTMemberValuePairs node, Object data);
+ public Object visit(ASTMemberValuePair node, Object data);
+ public Object visit(ASTMemberValueArrayInitializer node, Object data);
+ public Object visit(ASTIdentifier node, Object data);
+ public Object visit(ASTString node, Object data);
+ public Object visit(ASTChar node, Object data);
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/JJTAnnotationParserState.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/JJTAnnotationParserState.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/JJTAnnotationParserState.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+class JJTAnnotationParserState {
+ private java.util.Stack nodes;
+ private java.util.Stack marks;
+
+ private int sp; // number of nodes on stack
+ private int mk; // current mark
+ private boolean node_created;
+
+ JJTAnnotationParserState() {
+ nodes = new java.util.Stack();
+ marks = new java.util.Stack();
+ sp = 0;
+ mk = 0;
+ }
+
+ /* Determines whether the current node was actually closed and
+ pushed. This should only be called in the final user action of a
+ node scope. */
+ boolean nodeCreated() {
+ return node_created;
+ }
+
+ /* Call this to reinitialize the node stack. It is called
+ automatically by the parser's ReInit() method. */
+ void reset() {
+ nodes.removeAllElements();
+ marks.removeAllElements();
+ sp = 0;
+ mk = 0;
+ }
+
+ /* Returns the root node of the AST. It only makes sense to call
+ this after a successful parse. */
+ Node rootNode() {
+ return (Node)nodes.elementAt(0);
+ }
+
+ /* Pushes a node on to the stack. */
+ void pushNode(Node n) {
+ nodes.push(n);
+ ++sp;
+ }
+
+ /* Returns the node on the top of the stack, and remove it from the
+ stack. */
+ Node popNode() {
+ if (--sp < mk) {
+ mk = ((Integer)marks.pop()).intValue();
+ }
+ return (Node)nodes.pop();
+ }
+
+ /* Returns the node currently on the top of the stack. */
+ Node peekNode() {
+ return (Node)nodes.peek();
+ }
+
+ /* Returns the number of children on the stack in the current node
+ scope. */
+ int nodeArity() {
+ return sp - mk;
+ }
+
+
+ void clearNodeScope(Node n) {
+ while (sp > mk) {
+ popNode();
+ }
+ mk = ((Integer)marks.pop()).intValue();
+ }
+
+
+ void openNodeScope(Node n) {
+ marks.push(new Integer(mk));
+ mk = sp;
+ n.jjtOpen();
+ }
+
+
+ /* A definite node is constructed from a specified number of
+ children. That number of nodes are popped from the stack and
+ made the children of the definite node. Then the definite node
+ is pushed on to the stack. */
+ void closeNodeScope(Node n, int num) {
+ mk = ((Integer)marks.pop()).intValue();
+ while (num-- > 0) {
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, num);
+ }
+ n.jjtClose();
+ pushNode(n);
+ node_created = true;
+ }
+
+
+ /* A conditional node is constructed if its condition is true. All
+ the nodes that have been pushed since the node was opened are
+ made children of the the conditional node, which is then pushed
+ on to the stack. If the condition is false the node is not
+ constructed and they are left on the stack. */
+ void closeNodeScope(Node n, boolean condition) {
+ if (condition) {
+ int a = nodeArity();
+ mk = ((Integer)marks.pop()).intValue();
+ while (a-- > 0) {
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, a);
+ }
+ n.jjtClose();
+ pushNode(n);
+ node_created = true;
+ } else {
+ mk = ((Integer)marks.pop()).intValue();
+ node_created = false;
+ }
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Node.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Node.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Node.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public interface Node {
+
+ /** This method is called after the node has been made the current
+ node. It indicates that child nodes can now be added to it. */
+ public void jjtOpen();
+
+ /** This method is called after all the child nodes have been
+ added. */
+ public void jjtClose();
+
+ /** This pair of methods are used to inform the node of its
+ parent. */
+ public void jjtSetParent(Node n);
+ public Node jjtGetParent();
+
+ /** This method tells the node to add its argument to the node's
+ list of children. */
+ public void jjtAddChild(Node n, int i);
+
+ /** This method returns a child node. The children are numbered
+ from zero, left to right. */
+ public Node jjtGetChild(int i);
+
+ /** Return the number of children the node has. */
+ public int jjtGetNumChildren();
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data);
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ParseException.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ParseException.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/ParseException.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+/**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+ retval += "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleCharStream.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleCharStream.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleCharStream.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,421 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public class SimpleCharStream
+{
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ protected int bufline[];
+ protected int bufcolumn[];
+
+ protected int column = 0;
+ protected int line = 1;
+
+ protected boolean prevCharIsCR = false;
+ protected boolean prevCharIsLF = false;
+
+ protected java.io.Reader inputStream;
+
+ protected char[] buffer;
+ protected int maxNextCharInd = 0;
+ protected int inBuf = 0;
+
+ protected void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ protected void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ protected void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+
+ if (++bufpos == bufsize)
+ bufpos = 0;
+
+ return buffer[bufpos];
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = buffer[bufpos];
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public int getLine() {
+ return bufline[bufpos];
+ }
+
+ public int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.Reader dstream)
+ {
+ this(dstream, 1, 1, 4096);
+ }
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.Reader dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream)
+ {
+ this(dstream, 1, 1, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleNode.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleNode.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/SimpleNode.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class SimpleNode implements Node {
+ protected Node parent;
+ protected Node[] children;
+ protected int id;
+ protected AnnotationParser parser;
+
+ public SimpleNode(int i) {
+ id = i;
+ }
+
+ public SimpleNode(AnnotationParser p, int i) {
+ this(i);
+ parser = p;
+ }
+
+ public void jjtOpen() {
+ }
+
+ public void jjtClose() {
+ }
+
+ public void jjtSetParent(Node n) { parent = n; }
+ public Node jjtGetParent() { return parent; }
+
+ public void jjtAddChild(Node n, int i) {
+ if (children == null) {
+ children = new Node[i + 1];
+ } else if (i >= children.length) {
+ Node c[] = new Node[i + 1];
+ System.arraycopy(children, 0, c, 0, children.length);
+ children = c;
+ }
+ children[i] = n;
+ }
+
+ public Node jjtGetChild(int i) {
+ return children[i];
+ }
+
+ public int jjtGetNumChildren() {
+ return (children == null) ? 0 : children.length;
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+
+ /** Accept the visitor. **/
+ public Object childrenAccept(AnnotationParserVisitor visitor, Object data) {
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ children[i].jjtAccept(visitor, data);
+ }
+ }
+ return data;
+ }
+
+ /* You can override these two methods in subclasses of SimpleNode to
+ customize the way the node appears when the tree is dumped. If
+ your output uses more than one line you should override
+ toString(String), otherwise overriding toString() is probably all
+ you need to do. */
+
+ public String toString() { return AnnotationParserTreeConstants.jjtNodeName[id]; }
+ public String toString(String prefix) { return prefix + toString(); }
+
+ /* Override this method if you want to customize how the node dumps
+ out its children. */
+
+ public void dump(String prefix) {
+ System.out.println(toString(prefix));
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ SimpleNode n = (SimpleNode)children[i];
+ if (n != null) {
+ n.dump(prefix + " ");
+ }
+ }
+ }
+ }
+}
+
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Token.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Token.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/Token.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/TokenMgrError.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/TokenMgrError.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/TokenMgrError.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.ast;
+
+public class TokenMgrError extends Error
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8256510811060336766L;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/annotation.jjt
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/annotation.jjt 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/ast/annotation.jjt 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,171 @@
+/**
+ *
+ */
+options {
+ MULTI=true;
+ VISITOR=true;
+ NODE_DEFAULT_VOID=false;
+ STATIC=false;
+}
+
+PARSER_BEGIN(AnnotationParser)
+package org.jboss.aop.annotation.ast;
+
+public class AnnotationParser {
+}
+
+PARSER_END(AnnotationParser)
+
+
+SKIP :
+{
+ " "
+| "\t"
+}
+
+TOKEN :
+{
+ < IDENTIFIER: (<LETTER>)+ >
+|
+ < #LETTER: ["$","_","a"-"z","A"-"Z","0"-"9","."] >
+| < CHARACTER : "'"
+ ( (~["'","\\","\n","\r"])
+ | ("\\" (
+ ["n","t","v","b","r","f","a","\\","?","'","\""]
+ |
+ "0" (["0"-"7"])*
+ |
+ ["1"-"9"] (["0"-"9"])*
+ |
+ ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+
+ )
+ )
+ )
+ "'" >
+| < STRING : "\""
+ ( ( ~["\"","\\","\n","\r"])
+ | ("\\" (
+ ["n","t","v","b","r","f","a","\\","?","'","\""]
+ |
+ "0" (["0"-"7"])*
+ |
+ ["1"-"9"] (["0"-"9"])*
+ |
+ ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+
+ )
+ )
+ )*
+ "\"" >
+}
+
+
+ASTStart Start() #Start : {}
+{
+ Annotation() ("\r\n" | "\n" | <EOF>)
+ { return jjtThis; }
+}
+
+void Annotation() :
+{
+ Token tok;
+}
+{
+ "@"
+ tok=<IDENTIFIER>
+ {
+ jjtThis.setIdentifier(tok.image);
+ }
+ [ "(" [ LOOKAHEAD(2) MemberValuePairs() | SingleMemberValue() ] ")" ]
+}
+
+
+void SingleMemberValue() :
+{
+}
+{
+ MemberValue()
+}
+
+void MemberValuePairs() :
+{
+}
+{
+ MemberValuePair()
+ ( "," MemberValuePair()
+ )*
+}
+
+
+
+void MemberValuePair() :
+{
+ Token specialToken;
+}
+{
+ Identifier() "=" MemberValue()
+}
+
+
+void MemberValue() #void :
+{
+ Token tok;
+}
+{
+ Annotation()
+|
+ MemberValueArrayInitializer()
+|
+ String()
+|
+ Char()
+|
+ Identifier()
+}
+
+
+void MemberValueArrayInitializer() :
+{
+}
+{
+ "{"
+ [ MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] ]
+ "}"
+}
+
+void Identifier() :
+{
+ Token tok;
+}
+{
+ tok=<IDENTIFIER>
+ {
+ jjtThis.setValue(tok.image);
+ }
+}
+
+void String() :
+{
+ Token tok;
+}
+{
+ tok=<STRING>
+ {
+ jjtThis.setValue(tok.image);
+ }
+}
+
+void Char() :
+{
+ Token tok;
+}
+{
+ tok=<CHARACTER>
+ {
+ jjtThis.setValue(tok.image);
+ }
+}
+
+
+
+
+
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/AnnotationProxy.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/AnnotationProxy.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/AnnotationProxy.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.javassist;
+
+import java.lang.reflect.InvocationHandler;
+import java.util.Map;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 57050 $
+ */
+public class AnnotationProxy extends org.jboss.aop.annotation.factory.duplicate.AnnotationProxy implements InvocationHandler
+{
+ public AnnotationProxy(Class annotationType, Map valueMap)
+ {
+ super(annotationType, valueMap);
+ }
+
+ public static Object createProxy(javassist.bytecode.annotation.Annotation info) throws Exception
+ {
+ Class annotation = Thread.currentThread().getContextClassLoader().loadClass(info.getTypeName());
+ return createProxy(info, annotation);
+ }
+
+ public static Object createProxy(javassist.bytecode.annotation.Annotation info, Class annotation) throws Exception
+ {
+ Map map = ProxyMapCreator.createProxyMap(annotation, info);
+ DefaultValueAnnotationValidator reader = new DefaultValueAnnotationValidator();
+ reader.validate(map, annotation);
+ AnnotationProxy proxyHandler = new AnnotationProxy(annotation, map);
+ return java.lang.reflect.Proxy.newProxyInstance(annotation.getClassLoader(), new Class[]{annotation}, proxyHandler);
+ }
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/DefaultValueAnnotationValidator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/DefaultValueAnnotationValidator.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/DefaultValueAnnotationValidator.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,136 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.annotation.factory.duplicate.javassist;
+
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.jboss.aop.annotation.factory.duplicate.AnnotationValidationException;
+import org.jboss.aop.annotation.factory.duplicate.AnnotationValidator;
+
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtMethod;
+import javassist.NotFoundException;
+import javassist.bytecode.AnnotationDefaultAttribute;
+import javassist.bytecode.MethodInfo;
+import javassist.bytecode.annotation.MemberValue;
+import javassist.scopedpool.ScopedClassPoolRepository;
+import javassist.scopedpool.ScopedClassPoolRepositoryImpl;
+
+/**
+ * Validates if all attributes have been filled in for an annotation.
+ * Attempts to read default values where they exist
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 57050 $
+ */
+public class DefaultValueAnnotationValidator implements AnnotationValidator
+{
+ ScopedClassPoolRepository repository = ScopedClassPoolRepositoryImpl.getInstance();
+
+ public void validate(Map map, Class annotation)
+ {
+ ArrayList notAssignedAttributes = null;
+ CtClass ctClass = null;
+
+ Method[] methods = getDeclaredMethods(annotation);
+ for (int i = 0 ; i < methods.length ; i++)
+ {
+ if (map.get(methods[i].getName()) == null)
+ {
+ if (ctClass == null)
+ {
+ ctClass = getCtClass(annotation);
+ }
+
+ CtMethod method;
+ try
+ {
+ method = ctClass.getDeclaredMethod(methods[i].getName());
+ }
+ catch (NotFoundException e)
+ {
+ throw new RuntimeException("Unable to find method " + methods[i].getName() + " for " + annotation.getName());
+ }
+ Object defaultValue = null;
+ MethodInfo minfo = method.getMethodInfo2();
+ AnnotationDefaultAttribute defAttr = (AnnotationDefaultAttribute)minfo.getAttribute(AnnotationDefaultAttribute.tag);
+
+ if (defAttr != null)
+ {
+ MemberValue value = defAttr.getDefaultValue(); // default value of age
+ MemberValueGetter getter = new MemberValueGetter(methods[i]);
+ value.accept(getter);
+ defaultValue = getter.getValue();
+ }
+
+ if (defaultValue != null)
+ {
+ map.put(methods[i].getName(), defaultValue);
+ }
+ else
+ {
+ if (notAssignedAttributes == null)
+ {
+ notAssignedAttributes = new ArrayList();
+ }
+ notAssignedAttributes.add(methods[i].getName());
+ }
+
+ }
+ }
+
+ if (notAssignedAttributes != null)
+ {
+ throw new AnnotationValidationException("Unable to fill in default attributes for " + annotation + " " + notAssignedAttributes);
+ }
+ }
+
+
+ CtClass getCtClass(Class clazz)
+ {
+ try
+ {
+ ClassPool pool = repository.findClassPool(clazz.getClassLoader());
+ return pool.get(clazz.getName());
+ }
+ catch (NotFoundException e)
+ {
+ throw new RuntimeException("Unable to load CtClass for " + clazz, e);
+ }
+ }
+
+ private Method[] getDeclaredMethods(final Class clazz)
+ {
+ return (Method[])AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run()
+ {
+ return clazz.getDeclaredMethods();
+ };
+ });
+ }
+}
+
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/MemberValueGetter.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/MemberValueGetter.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/MemberValueGetter.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,166 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.annotation.factory.duplicate.javassist;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+
+import javassist.bytecode.annotation.Annotation;
+import javassist.bytecode.annotation.AnnotationMemberValue;
+import javassist.bytecode.annotation.ArrayMemberValue;
+import javassist.bytecode.annotation.BooleanMemberValue;
+import javassist.bytecode.annotation.ByteMemberValue;
+import javassist.bytecode.annotation.CharMemberValue;
+import javassist.bytecode.annotation.ClassMemberValue;
+import javassist.bytecode.annotation.DoubleMemberValue;
+import javassist.bytecode.annotation.EnumMemberValue;
+import javassist.bytecode.annotation.FloatMemberValue;
+import javassist.bytecode.annotation.IntegerMemberValue;
+import javassist.bytecode.annotation.LongMemberValue;
+import javassist.bytecode.annotation.MemberValue;
+import javassist.bytecode.annotation.MemberValueVisitor;
+import javassist.bytecode.annotation.ShortMemberValue;
+import javassist.bytecode.annotation.StringMemberValue;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 57050 $
+ */
+public class MemberValueGetter implements MemberValueVisitor
+{
+ Object value;
+ Method method;
+
+ public MemberValueGetter(Method method)
+ {
+ this.method = method;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void visitAnnotationMemberValue(AnnotationMemberValue node)
+ {
+ try
+ {
+ Annotation ann = node.getValue();
+ value = AnnotationProxy.createProxy(ann);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void visitArrayMemberValue(ArrayMemberValue node)
+ {
+ MemberValue[] values = node.getValue();
+ value = node.getValue();
+ Object vals = Array.newInstance(getAttributeType(), values.length);
+
+ for (int i = 0 ; i < values.length ; i++)
+ {
+ values[i].accept(this);
+ Array.set(vals, i, value);
+ }
+
+ value = vals;
+ }
+
+ public void visitBooleanMemberValue(BooleanMemberValue node)
+ {
+ value = new Boolean(node.getValue());
+ }
+
+ public void visitByteMemberValue(ByteMemberValue node)
+ {
+ value = new Byte(node.getValue());
+ }
+
+ public void visitCharMemberValue(CharMemberValue node)
+ {
+ value = new Character(node.getValue());
+ }
+
+ public void visitDoubleMemberValue(DoubleMemberValue node)
+ {
+ value = new Double(node.getValue());
+ }
+
+ public void visitEnumMemberValue(EnumMemberValue node)
+ {
+ value = Enum.valueOf(getAttributeType(), node.getValue());
+ }
+
+ public void visitFloatMemberValue(FloatMemberValue node)
+ {
+ value = new Float(node.getValue());
+ }
+
+ public void visitIntegerMemberValue(IntegerMemberValue node)
+ {
+ value = new Integer(node.getValue());
+ }
+
+ public void visitLongMemberValue(LongMemberValue node)
+ {
+ value = new Long(node.getValue());
+ }
+
+ public void visitShortMemberValue(ShortMemberValue node)
+ {
+ value = new Short(node.getValue());
+ }
+
+ public void visitStringMemberValue(StringMemberValue node)
+ {
+ value = node.getValue();
+ }
+
+ public void visitClassMemberValue(ClassMemberValue node)
+ {
+ try
+ {
+ value = Class.forName(node.getValue());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private Class getAttributeType()
+ {
+ Class rtn = method.getReturnType();
+
+ while (rtn.isArray())
+ {
+ rtn = rtn.getComponentType();
+ }
+
+ return rtn;
+ }
+
+}
Added: trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/ProxyMapCreator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/ProxyMapCreator.java 2006-09-21 12:03:34 UTC (rev 57050)
+++ trunk/aop/src/main/org/jboss/aop/annotation/factory/duplicate/javassist/ProxyMapCreator.java 2006-09-21 12:21:09 UTC (rev 57051)
@@ -0,0 +1,253 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.annotation.factory.duplicate.javassist;
+
+import javassist.bytecode.annotation.AnnotationMemberValue;
+import javassist.bytecode.annotation.ArrayMemberValue;
+import javassist.bytecode.annotation.BooleanMemberValue;
+import javassist.bytecode.annotation.ByteMemberValue;
+import javassist.bytecode.annotation.CharMemberValue;
+import javassist.bytecode.annotation.ClassMemberValue;
+import javassist.bytecode.annotation.DoubleMemberValue;
+import javassist.bytecode.annotation.EnumMemberValue;
+import javassist.bytecode.annotation.FloatMemberValue;
+import javassist.bytecode.annotation.IntegerMemberValue;
+import javassist.bytecode.annotation.LongMemberValue;
+import javassist.bytecode.annotation.MemberValue;
+import javassist.bytecode.annotation.MemberValueVisitor;
+import javassist.bytecode.annotation.ShortMemberValue;
+import javassist.bytecode.annotation.StringMemberValue;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 57050 $
+ */
+public class ProxyMapCreator implements MemberValueVisitor
+{
+ public Object value;
+ private Class type;
+
+
+ public ProxyMapCreator(Class type)
+ {
+ this.type = type;
+ }
+
+ public void visitAnnotationMemberValue(AnnotationMemberValue annotationMemberValue)
+ {
+ try
+ {
+ value = AnnotationProxy.createProxy(annotationMemberValue.getValue());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
+ }
+ }
+
+ public void visitArrayMemberValue(ArrayMemberValue arrayMemberValue)
+ {
+ Class baseType = type.getComponentType();
+ int size = 0;
+ if (arrayMemberValue.getValue() == null || arrayMemberValue.getValue().length == 0)
+ {
+ size = 0;
+ }
+ else
+ {
+ size = arrayMemberValue.getValue().length;
+ }
+ value = Array.newInstance(baseType, size);
+ MemberValue[] elements = arrayMemberValue.getValue();
+ for (int i = 0; i < size; i++)
+ {
+ ProxyMapCreator creator = new ProxyMapCreator(baseType);
+ elements[i].accept(creator);
+ Array.set(value, i, creator.value);
+ }
+ }
+
+ public void visitBooleanMemberValue(BooleanMemberValue booleanMemberValue)
+ {
+ value = new Boolean(booleanMemberValue.getValue());
+ }
+
+ public void visitByteMemberValue(ByteMemberValue byteMemberValue)
+ {
+ value = new Byte(byteMemberValue.getValue());
+ }
+
+ public void visitCharMemberValue(CharMemberValue charMemberValue)
+ {
+ value = new Character(charMemberValue.getValue());
+ }
+
+ public void visitDoubleMemberValue(DoubleMemberValue doubleMemberValue)
+ {
+ value = new Double(doubleMemberValue.getValue());
+ }
+
+ public void visitEnumMemberValue(EnumMemberValue enumMemberValue)
+ {
+ try
+ {
+ Field enumVal = type.getField(enumMemberValue.getValue());
+ value = enumVal.get(null);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
+ }
+ catch (SecurityException e)
+ {
+ throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
+ }
+ }
+
+ public void visitFloatMemberValue(FloatMemberValue floatMemberValue)
+ {
+ value = new Float(floatMemberValue.getValue());
+ }
+
+ public void visitIntegerMemberValue(IntegerMemberValue integerMemberValue)
+ {
+ value = new Integer(integerMemberValue.getValue());
+ }
+
+ public void visitLongMemberValue(LongMemberValue longMemberValue)
+ {
+ value = new Long(longMemberValue.getValue());
+ }
+
+ public void visitShortMemberValue(ShortMemberValue shortMemberValue)
+ {
+ value = new Short(shortMemberValue.getValue());
+ }
+
+ public void visitStringMemberValue(StringMemberValue stringMemberValue)
+ {
+ value = stringMemberValue.getValue();
+ }
+
+ public void visitClassMemberValue(ClassMemberValue classMemberValue)
+ {
+ try
+ {
+ String classname = classMemberValue.getValue();
+ if (classname.equals("void"))
+ {
+ value = void.class;
+ }
+ else if (classname.equals("int"))
+ {
+ value = int.class;
+ }
+ else if (classname.equals("byte"))
+ {
+ value = byte.class;
+ }
+ else if (classname.equals("long"))
+ {
+ value = long.class;
+ }
+ else if (classname.equals("double"))
+ {
+ value = double.class;
+ }
+ else if (classname.equals("float"))
+ {
+ value = float.class;
+ }
+ else if (classname.equals("char"))
+ {
+ value = char.class;
+ }
+ else if (classname.equals("short"))
+ {
+ value = short.class;
+ }
+ else if (classname.equals("boolean"))
+ {
+ value = boolean.class;
+ }
+ else
+ {
+ value = Thread.currentThread().getContextClassLoader().loadClass(classMemberValue.getValue());
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
+ }
+
+ }
+
+ public static Class getMemberType(Class annotation, String member)
+ {
+ Method[] methods = annotation.getMethods();
+ for (int i = 0; i < methods.length; i++)
+ {
+ if (methods[i].getName().equals(member))
+ {
+ return methods[i].getReturnType();
+ }
+ }
+ throw new RuntimeException("unable to determine member type for annotation: " + annotation.getName() + "." + member);
+ }
+
+ public static Map createProxyMap(Class annotation, javassist.bytecode.annotation.Annotation info)
+ {
+ //TODO: Need to handle default values for annotations in jdk 1.5
+ Map map = new HashMap();
+
+ if (info.getMemberNames() == null) return map;
+ Set members = info.getMemberNames();
+ Iterator it = members.iterator();
+ while (it.hasNext())
+ {
+ String name = (String) it.next();
+ MemberValue mv = info.getMemberValue(name);
+ ProxyMapCreator creator = new ProxyMapCreator(getMemberType(annotation, name));
+ mv.accept(creator);
+ map.put(name, creator.value);
+ }
+ return map;
+ }
+}
More information about the jboss-cvs-commits
mailing list