Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/PageFlowAnnotationProcessor.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/PageFlowAnnotationProcessor.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/PageFlowAnnotationProcessor.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/PageFlowAnnotationProcessor.java Mon Apr 11 23:42:11 2005 @@ -18,7 +18,7 @@ package org.apache.beehive.netui.compiler.processor; import org.apache.beehive.netui.compiler.*; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration; import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment; @@ -84,7 +84,7 @@ } else { - AnnotationMirror ann = CompilerUtils.getAnnotation( classDecl, CONTROLLER_TAG_NAME ); + AnnotationInstance ann = CompilerUtils.getAnnotation( classDecl, CONTROLLER_TAG_NAME ); if ( ann != null ) {
Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/SilentDiagnostics.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/SilentDiagnostics.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/SilentDiagnostics.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/SilentDiagnostics.java Mon Apr 11 23:42:11 2005 @@ -19,7 +19,7 @@ import org.apache.beehive.netui.compiler.Diagnostics; import org.apache.beehive.netui.compiler.typesystem.declaration.Declaration; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue; public class SilentDiagnostics extends Diagnostics @@ -34,7 +34,7 @@ setHasErrors( true ); } - public void addErrorArrayArgs( AnnotationMirror ann, String messageKey, Object[] args ) + public void addErrorArrayArgs( AnnotationInstance ann, String messageKey, Object[] args ) { setHasErrors( true ); } @@ -48,7 +48,7 @@ { } - public void addWarningArrayArgs( AnnotationMirror ann, String messageKey, Object[] args ) + public void addWarningArrayArgs( AnnotationInstance ann, String messageKey, Object[] args ) { } Copied: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationInstance.java (from r159330, incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationMirror.java) URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationInstance.java?view=diff&rev=161025&p1=incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationMirror.java&r1=159330&p2=incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationInstance.java&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationMirror.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/AnnotationInstance.java Mon Apr 11 23:42:11 2005 @@ -22,7 +22,7 @@ import java.util.Map; -public interface AnnotationMirror +public interface AnnotationInstance { AnnotationType getAnnotationType(); Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/Declaration.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/Declaration.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/Declaration.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/Declaration.java Mon Apr 11 23:42:11 2005 @@ -27,7 +27,7 @@ // --Commented out by Inspection (3/13/05 4:42 PM): String getDocComment(); - AnnotationMirror[] getAnnotationMirrors(); + AnnotationInstance[] getAnnotationInstances(); //<A extends Annotation> A getAnnotation( Class<A> aClass ); Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/FieldDeclaration.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/FieldDeclaration.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/FieldDeclaration.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/FieldDeclaration.java Mon Apr 11 23:42:11 2005 @@ -17,12 +17,12 @@ */ package org.apache.beehive.netui.compiler.typesystem.declaration; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; public interface FieldDeclaration extends MemberDeclaration { - TypeMirror getType(); + TypeInstance getType(); // --Commented out by Inspection (3/13/05 4:42 PM): Object getConstantValue(); Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/MethodDeclaration.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/MethodDeclaration.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/MethodDeclaration.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/MethodDeclaration.java Mon Apr 11 23:42:11 2005 @@ -17,10 +17,10 @@ */ package org.apache.beehive.netui.compiler.typesystem.declaration; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; public interface MethodDeclaration extends ExecutableDeclaration { - TypeMirror getReturnType(); + TypeInstance getReturnType(); } Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/ParameterDeclaration.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/ParameterDeclaration.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/ParameterDeclaration.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/ParameterDeclaration.java Mon Apr 11 23:42:11 2005 @@ -17,10 +17,10 @@ */ package org.apache.beehive.netui.compiler.typesystem.declaration; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; public interface ParameterDeclaration extends Declaration { - TypeMirror getType(); + TypeInstance getType(); } Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ArrayType.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ArrayType.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ArrayType.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ArrayType.java Mon Apr 11 23:42:11 2005 @@ -20,5 +20,5 @@ public interface ArrayType extends ReferenceType { - TypeMirror getComponentType(); + TypeInstance getComponentType(); } Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/DeclaredType.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/DeclaredType.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/DeclaredType.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/DeclaredType.java Mon Apr 11 23:42:11 2005 @@ -26,7 +26,7 @@ DeclaredType getContainingType(); - //TypeMirror[] getActualTypeArguments(); + //TypeInstance[] getActualTypeArguments(); InterfaceType[] getSuperinterfaces(); } Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/PrimitiveType.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/PrimitiveType.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/PrimitiveType.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/PrimitiveType.java Mon Apr 11 23:42:11 2005 @@ -18,7 +18,7 @@ package org.apache.beehive.netui.compiler.typesystem.type; public interface PrimitiveType - extends TypeMirror + extends TypeInstance { Kind getKind(); Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ReferenceType.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ReferenceType.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ReferenceType.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/ReferenceType.java Mon Apr 11 23:42:11 2005 @@ -18,6 +18,6 @@ package org.apache.beehive.netui.compiler.typesystem.type; public interface ReferenceType - extends TypeMirror + extends TypeInstance { } Copied: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeInstance.java (from r159330, incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeMirror.java) URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeInstance.java?view=diff&rev=161025&p1=incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeMirror.java&r1=159330&p2=incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeInstance.java&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeMirror.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/TypeInstance.java Mon Apr 11 23:42:11 2005 @@ -17,7 +17,7 @@ */ package org.apache.beehive.netui.compiler.typesystem.type; -public interface TypeMirror +public interface TypeInstance { String toString(); Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/VoidType.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/VoidType.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/VoidType.java (original) +++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/VoidType.java Mon Apr 11 23:42:11 2005 @@ -18,6 +18,6 @@ package org.apache.beehive.netui.compiler.typesystem.type; public interface VoidType - extends TypeMirror + extends TypeInstance { } Added: incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/config.xsdconfig URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/config.xsdconfig?view=auto&rev=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/config.xsdconfig (added) +++ incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/config.xsdconfig Mon Apr 11 23:42:11 2005 @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config" > + <xb:namespace> + <xb:package>org.apache.beehive.netui.compiler.schema.annotations</xb:package> + </xb:namespace> +</xb:config> Propchange: incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/config.xsdconfig ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/processed-annotations.xsd URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/processed-annotations.xsd?view=auto&rev=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/processed-annotations.xsd (added) +++ incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/processed-annotations.xsd Mon Apr 11 23:42:11 2005 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- @todo: need to remove the legacy-tag-support from this --> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + + <xsd:element name="processed-annotations"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="type-name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + <xsd:element name="annotated-element" type="annotated-element" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="annotated-element"> + <xsd:sequence> + <xsd:element name="element-name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + <xsd:element name="annotation" type="processed-annotation" minOccurs="1" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="processed-annotation"> + <xsd:sequence> + <xsd:element name="annotation-name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + <xsd:element name="annotation-attribute" type="annotation-attribute" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="annotation-attribute"> + <xsd:sequence> + <xsd:element name="attribute-name" type="xsd:string" minOccurs="1" maxOccurs="1"/> + <xsd:element name="string-value" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <xsd:element name="annotation-value" type="processed-annotation" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> +</xsd:schema> + + Propchange: incubator/beehive/trunk/netui/src/compiler-core/schema/processed-annotations/processed-annotations.xsd ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml Mon Apr 11 23:42:11 2005 @@ -8,7 +8,7 @@ <property name="module.classes.dir" value="${classes.dir}/${module.name}"/> <property name="module.dir" location="${src.dir}/${module.name}"/> <property name="xdoclet-xml.dir" value="${module.classes.dir}/META-INF"/> - <property name="xdoclet-xml.template.file" value="${basedir}/xdoclet-xml.xdt" /> + <property name="xdoclet-xml.template.file" value="${module.dir}/xdoclet-xml.xdt" /> <property name="compiler-core.classes.dir" location="${classes.dir}/compiler-core"/> <property name="pageflow.module.dir" location="${src.dir}/pageflow"/> @@ -17,9 +17,8 @@ <path refid="commons-logging.dependency.path"/> <path refid="commons-collections.dependency.path"/> <fileset refid="controls.fileset"/> - <!-- TODO: put these jars into netui.properties --> - <fileset file="${external.dir}/xdoclet/xdoclet-1.2b4.jar"/> - <fileset file="${external.dir}/xdoclet/xjavadoc-1.1-j5-v3.jar"/> + <fileset file="${xdoclet.jar}"/> + <fileset file="${xjavadoc.jar}"/> <pathelement path="${compiler-core.classes.dir}"/> </path> @@ -39,8 +38,8 @@ debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" - source="1.4" - target="1.4"> + source="${compile.source}" + target="${compile.target}"> <include name="**/*.java"/> </javac> @@ -99,6 +98,9 @@ <attribute name="Class-Path" value="apache-xbean.jar"/> </manifest> </jar> + + <!-- Copy the distributable build file to build/lib --> + <copy todir="${build.lib.dir}" file="${module.dir}/pageflow-webapp-build-xdoclet.xml" failonerror="true"/> </target> <target name="clean"> Added: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDoclet.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDoclet.java?view=auto&rev=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDoclet.java (added) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDoclet.java Mon Apr 11 23:42:11 2005 @@ -0,0 +1,474 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package org.apache.beehive.netui.compiler.xdoclet.tools; + +import java.io.StreamTokenizer; +import java.io.Reader; +import java.io.File; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.util.ArrayList; + +public class AnnotationsToXDoclet +{ + private static final String[] QUALIFIED_ANNOTATIONS = + { + "@org.apache.beehive.netui.pageflow.annotations.", + "@org.apache.beehive.controls.api.bean." + }; + + private static void usage() + { + System.err.println( "usage: " + AnnotationsToXDoclet.class.getName() + " input-file output-file" ); + System.err.println( " -or-" ); + System.err.println( "usage: " + AnnotationsToXDoclet.class.getName() + + " -input-dir <root of input dir> -output-dir <root of output dir> -extensions <comma-separated list>" ); + } + + public static void main( String[] args ) + throws IOException, FileNotFoundException + { + // Recurse + if ( args.length == 6 ) + { + if ( ! args[0].equals( "-input-dir" ) || ! args[2].equals( "-output-dir" ) || ! args[4].equals( "-extensions" ) ) + { + usage(); + System.exit( 1 ); + } + + File inputDir = new File( args[1] ); + if ( ! inputDir.exists() ) + { + System.err.println( inputDir + " is not a directory" ); + System.exit( 2 ); + } + + File outputDir = new File( args[3] ); + if ( ! outputDir.exists() ) + { + System.err.println( outputDir + " is not a directory" ); + System.exit( 2 ); + } + + String[] extensions = args[5].split( "," ); + new AnnotationsToXDoclet().translateRecursive( inputDir, outputDir, extensions ); + return; + } + + // ...or, do a single file translation. + if ( args.length != 2 ) + { + usage(); + System.exit( 1 ); + } + + File input = new File( args[0] ); + File output = new File( args[1] ); + + if ( input.equals( output ) ) + { + System.err.println( "input file " + input + " must be different from output file" ); + System.exit( 2 ); + } + + if ( ! input.canRead() ) + { + System.err.println( "cannot read " + input ); + System.exit( 2 ); + } + + if ( output.exists() && ! output.canWrite() ) + { + System.err.println( "cannot write to " + output ); + System.exit( 2 ); + } + + new AnnotationsToXDoclet().translate( input, output ); + } + + public void translateRecursive( File inputDir, File outputDir, String[] extensions ) + throws IOException, FileNotFoundException + { + File[] children = inputDir.listFiles(); + + outputDir.mkdirs(); + + for ( int i = 0; i < children.length; i++ ) + { + File child = children[i]; + + if ( child.isFile() ) + { + for ( int j = 0; j < extensions.length; j++ ) + { + String extension = extensions[j]; + if ( child.getName().endsWith( extension ) ) + { + translate( child, new File( outputDir, child.getName() ) ); + } + } + } + else if ( child.isDirectory() ) + { + File childOutputDir = new File( outputDir, child.getName() ); + translateRecursive( child, childOutputDir, extensions ); + } + } + } + + public void translate( File input, File output ) + throws IOException, FileNotFoundException + { +System.err.println( input + " -> " + output ); + output.getParentFile().mkdirs(); + FileReader in = new FileReader( input ); + PrintWriter out = null; + + try + { + out = new PrintWriter( new FileWriter( output ) ); + StreamTokenizer tok = getJavaTokenizer( in ); + boolean addedSpace = false; + StringBuffer indentBuffer = new StringBuffer(); + String indent = ""; + + while ( tok.nextToken() != StreamTokenizer.TT_EOF ) + { + boolean wasSpace = false; + boolean wasChar = false; + + switch ( tok.ttype ) + { + case StreamTokenizer.TT_WORD: + if ( indentBuffer != null ) + { + indent = indentBuffer.toString(); + indentBuffer = null; + } + String str = tok.sval; + if ( str.startsWith( "@Jpf.ViewProperties" ) ) + { + ignoreUntil( tok, ")" ); + } + else if ( str.startsWith( "@Jpf." ) || str.startsWith( "@Control" ) + || str.startsWith( "@org.apache.beehive" ) ) + { + out.println( "/**" ); + ArrayList tags = new ArrayList(); + translateAnnotation( tok, out, str, indent, tags ); + for ( int i = 0; i < tags.size(); ++i ) + { + out.print( indent ); + out.print( " * " ); + out.println( ( String ) tags.get( i ) ); + } + out.print( indent ); + out.print( " */" ); + } + else if ( str.equals( "import" ) ) + { + filterImport( tok, out ); + } + else + { + out.print( str ); + if ( str.length() == 1 ) + { + char c = str.charAt( 0 ); + if ( c == '\'' || c == '"' ) wasChar = true; + } + } + break; + + case StreamTokenizer.TT_NUMBER: + assert false : tok.nval; // parseNumbers() was set to false on the tokenizer. + break; + + default: + char c = ( char ) tok.ttype; + wasChar = true; + if ( ! addedSpace || c != ' ' ) out.print( c ); + wasSpace = Character.isWhitespace( c ); + if ( ! wasSpace && indentBuffer != null ) + { + indent = indentBuffer.toString(); + indentBuffer = null; + } + if ( indentBuffer != null ) indentBuffer.append( c ); + if ( c == '\n' ) indentBuffer = new StringBuffer(); + } + + if ( ! wasChar ) + { + out.print( ' ' ); + addedSpace = true; + } + else + { + addedSpace = false; + } + } + } + finally + { + in.close(); + if ( out != null ) out.close(); + } + } + + private void ignoreUntil( StreamTokenizer tok, String str ) + throws IOException + { + while ( ! getToken( tok ).equals( str ) ) + { + } + } + + private void filterImport( StreamTokenizer tok, PrintWriter out ) + throws IOException + { + String importName = getToken( tok ); + if ( ! importName.startsWith( "org.apache.beehive.netui.pageflow.annotations" ) + && ! importName.startsWith( "org.apache.beehive.controls.api.bean.Control" ) ) + { + out.print( "import " ); + out.print( importName ); + } + else + { + expectToken( tok, ";" ); + } + } + + private void translateAnnotation( StreamTokenizer tok, PrintWriter out, String firstToken, String indent, + ArrayList tags ) + throws IOException + { + for ( int i = 0; i < QUALIFIED_ANNOTATIONS.length; i++ ) + { + String qualifiedAnnotation = QUALIFIED_ANNOTATIONS[i]; + if ( firstToken.startsWith( qualifiedAnnotation ) ) + { + firstToken = '@' + firstToken.substring( qualifiedAnnotation.length() ); + } + } + + String nextToken = getToken( tok ); + + if ( ! nextToken.equals( "(" ) ) + { + tok.pushBack(); + tags.add( firstToken ); + return; + } + else + { + StringBuffer tag = new StringBuffer( firstToken ); + int thisTagPos = tags.size(); + tags.add( "" ); + + while ( ! ( nextToken = getToken( tok ) ).equals( ")" ) ) + { + if ( nextToken.equals( "," ) ) nextToken = getToken( tok ); + String attrName = nextToken; + expectToken( tok, "=" ); + String value = getToken( tok ); + int pos; + + if ( value.charAt( 0 ) == '@' ) + { + if ( attrName.equals( "validationErrorForward" ) ) + { + // Special case: + // [EMAIL PROTECTED](...) + // goes to + // @Jpf.ValidationErrorForward(...) + value = "@Jpf.ValidationErrorForward"; + } + + translateAnnotation( tok, out, value, indent, tags ); + value = null; + } + else if ( value.equals( "{" ) ) + { + StringBuffer stringArray = null; + + while ( ! ( nextToken = getToken( tok ) ).equals( "}" ) ) + { + if ( nextToken.equals( "," ) ) nextToken = getToken( tok ); + + if ( nextToken.charAt( 0 ) == '@' ) + { + translateAnnotation( tok, out, nextToken, indent, tags ); + } + else + { + // We're expecting a string array element here. + assert nextToken.length() > 1 && nextToken.charAt( 0 ) == '"' + && nextToken.charAt( nextToken.length() - 1 ) == '"' : nextToken; + if ( stringArray == null ) + { + stringArray = new StringBuffer( "\"" ); + } + else + { + stringArray.append( ',' ); + } + stringArray.append( nextToken.substring( 1, nextToken.length() - 1 ) ); + } + } + + value = stringArray != null ? stringArray.append( '"' ).toString() : null; + } + else if ( value.equals( "true" ) || value.equals( "false" ) ) + { + value = '"' + value + '"'; + } + else if ( value.endsWith( ".class" ) ) + { + value = '"' + value.substring( 0, value.length() - 6 ) + '"'; + } + else if ( ( pos = value.indexOf( "Jpf.NavigateTo." ) ) != -1 ) + { + value = '"' + value.substring( pos + 15 ) + '"'; + } + else if ( ( pos = value.indexOf( "Jpf.ValidatorVersion." ) ) != -1 ) + { + value = '"' + value.substring( pos + 21 ) + '"'; + } + else if ( isNumber( value ) ) + { + value = '"' + value + '"'; + } + else + { + assert value.charAt( 0 ) == '"' && value.charAt( value.length() - 1 ) == '"' : value; + if ( value.charAt( 0 ) != '"' ) value = '"' + value; + if ( value.charAt( value.length() - 1 ) != '"' ) value += '"'; + } + + if ( value != null ) + { + tag.append( ' ' ).append( attrName ).append( '=' ).append( value ); + } + } + + tags.set( thisTagPos, tag.toString() ); + } + } + + private static boolean isNumber( String str ) + { + char firstChar = str.charAt( 0 ); + if ( firstChar != '-' && ! Character.isDigit( firstChar ) && firstChar != '.' ) return false; + + for ( int i = 1; i < str.length(); ++i ) + { + char c = str.charAt( i ); + if ( ! Character.isDigit( c ) && c != '.' ) return false; + } + + return true; + } + + private String expectToken( StreamTokenizer tok, String expected ) + throws IOException + { + String token = getToken( tok ); + assert token.equals( expected ) : "expected \"" + expected + "\", got \"" + token + "\" (line " + tok.lineno() + ')'; + return token; + } + + private String getToken( StreamTokenizer tok ) + throws IOException + { + return getToken( tok, false, "" ); + } + + private String getToken( StreamTokenizer tok, boolean includeSpace, String prepend ) + throws IOException + { + tok.nextToken(); + assert tok.ttype != StreamTokenizer.TT_EOF : "unexpected eof"; + String retVal; + + switch ( tok.ttype ) + { + case StreamTokenizer.TT_WORD: + retVal = prepend + tok.sval; + break; + + case StreamTokenizer.TT_NUMBER: + assert false : tok.nval; // parseNumbers() was set to false on the tokenizer. + retVal = new Double( tok.nval ).toString(); + break; + + default: + char c = ( char ) tok.ttype; + if ( Character.isWhitespace( c ) && ! includeSpace ) return getToken( tok ); + retVal = prepend + Character.toString( c ); + } + + // If quotes are imbalanced, keep reading tokens until they're balanced. + return count( retVal, '"' ) % 2 != 0 ? getToken( tok, true, retVal ) : retVal; + } + + private static int count( String s, char c ) + { + int count = 0; + char lastChar = '\0'; + + for ( int i = 0; i < s.length(); ++i ) + { + if ( lastChar != '\\' && s.charAt( i ) == c ) ++count; + lastChar = c; + } + + return count; + } + + private static StreamTokenizer getJavaTokenizer( Reader reader ) + { + StreamTokenizer tok = new StreamTokenizer( reader ); + tok.resetSyntax(); + tok.eolIsSignificant( true ); + tok.lowerCaseMode( false ); + tok.wordChars( 'A', 'Z' ); + tok.wordChars( 'a', 'z' ); + tok.wordChars( '_', '_' ); + tok.wordChars( '@', '@' ); + tok.wordChars( '[', '[' ); + tok.wordChars( ']', ']' ); + tok.wordChars( '.', '.' ); + tok.wordChars( '"', '"' ); + tok.wordChars( '\'', '\'' ); + tok.wordChars( '-', '-' ); + tok.wordChars( '0', '9' ); + tok.wordChars( ':', ':' ); + tok.wordChars( '$', '$' ); + tok.wordChars( '/', '/' ); + tok.wordChars( '*', '*' ); + tok.wordChars( '\\', '\\' ); + tok.wordChars( '?', '?' ); + return tok; + } +} Propchange: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDoclet.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDocletTask.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDocletTask.java?view=auto&rev=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDocletTask.java (added) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDocletTask.java Mon Apr 11 23:42:11 2005 @@ -0,0 +1,50 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package org.apache.beehive.netui.compiler.xdoclet.tools; + +import org.apache.tools.ant.taskdefs.Copy; +import org.apache.tools.ant.BuildException; + +import java.util.Iterator; +import java.util.Map; +import java.io.File; +import java.io.IOException; + +public class AnnotationsToXDocletTask + extends Copy +{ + protected void doFileOperations() + { + try + { + AnnotationsToXDoclet atx = new AnnotationsToXDoclet(); + + for ( Iterator i = fileCopyMap.entrySet().iterator(); i.hasNext(); ) + { + Map.Entry entry = ( Map.Entry ) i.next(); + String[] values = ( String[] ) entry.getValue(); + assert values.length == 1 : values.length; + atx.translate( new File( ( String ) entry.getKey() ), new File( values[0] ) ); + } + } + catch ( IOException e ) + { + throw new BuildException( e ); + } + } +} Propchange: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/AnnotationsToXDocletTask.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/SourceCopy.java (from r161013, incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/tasks/SourceCopy.java) URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/SourceCopy.java?view=diff&rev=161025&p1=incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/tasks/SourceCopy.java&r1=161013&p2=incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/SourceCopy.java&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/tasks/SourceCopy.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/SourceCopy.java Mon Apr 11 23:42:11 2005 @@ -1,4 +1,4 @@ -package org.apache.beehive.netui.tasks; +package org.apache.beehive.netui.compiler.xdoclet.tools; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.taskdefs.Copy; Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java Mon Apr 11 23:42:11 2005 @@ -23,7 +23,7 @@ import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType; import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType; import org.apache.beehive.netui.compiler.typesystem.type.PrimitiveType; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; import org.apache.beehive.netui.compiler.typesystem.type.VoidType; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.ClassDeclarationImpl; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.ConstructorDeclarationImpl; @@ -41,6 +41,8 @@ import java.util.HashMap; import java.util.HashSet; +import java.util.Collections; +import java.util.Map; public class WrapperFactory { @@ -59,9 +61,6 @@ PRIMITIVE_TYPES.add( "double" ); } - private HashMap _classDeclarations = new HashMap(); - - private WrapperFactory() { } @@ -71,7 +70,7 @@ return INSTANCE; } - public TypeMirror getTypeMirror( Type delegate ) + public TypeInstance getTypeInstance( Type delegate ) { if ( delegate == null ) return null; @@ -81,11 +80,58 @@ } else { - return getTypeMirror( delegate.getType() ); + return getTypeInstance( delegate.getType() ); + } + } + + public TypeInstance getTypeInstance( XClass delegate, int dimension ) + { + if ( delegate == null ) return null; + + if ( dimension > 0 ) + { + return getArrayType( new SynthesizedXJavaDocArrayType( delegate, dimension ) ); + } + else + { + return getTypeInstance( delegate ); + } + } + + private static class SynthesizedXJavaDocArrayType + implements Type + { + private XClass _baseType; + private int _dimension; + + public SynthesizedXJavaDocArrayType( XClass type, int dimension ) + { + _baseType = type; + _dimension = dimension; + } + + public int getDimension() + { + return _dimension; + } + + public String getDimensionAsString() + { + StringBuffer buf = new StringBuffer(); + for ( int i = 0; i < _dimension; ++i ) + { + buf.append( "[]" ); + } + return buf.toString(); + } + + public XClass getType() + { + return _baseType; } } - public TypeMirror getTypeMirror( XClass delegate ) + public TypeInstance getTypeInstance( XClass delegate ) { if ( delegate == null ) return null; @@ -125,7 +171,15 @@ public DeclaredType getDeclaredType( XClass delegate ) { if ( delegate == null ) return null; - return delegate.isInterface() ? ( DeclaredType ) getInterfaceType( delegate ) : getClassType( delegate ); + return isInterface( delegate ) ? ( DeclaredType ) getInterfaceType( delegate ) : getClassType( delegate ); + } + + private static boolean isInterface( XClass xClass ) + { + // There's a bug where some returned XClass objects won't think they're interfaces, even when they are. + // In these cases, the word "interface" appears in the list of Modifiers. + if ( xClass.isInterface() ) return true; + return xClass.getModifiers().indexOf( "interface" ) != -1; } public ClassType getClassType( XClass delegate ) @@ -175,7 +229,7 @@ if ( delegate == null ) return null; assert delegate instanceof XClass : delegate.getClass().getName(); XClass xclass = ( XClass ) delegate; - return xclass.isInterface() ? ( TypeDeclaration ) getInterfaceDeclaration( xclass ) : getClassDeclaration( xclass ); + return isInterface( xclass ) ? ( TypeDeclaration ) getInterfaceDeclaration( xclass ) : getClassDeclaration( xclass ); } public ClassDeclaration getClassDeclaration( XClass delegate ) @@ -183,12 +237,12 @@ if ( delegate == null ) return null; String qualifiedName = delegate.getQualifiedName(); - ClassDeclaration decl = ( ClassDeclaration ) _classDeclarations.get( qualifiedName ); - if ( decl != null ) return decl; + //ClassDeclaration decl = ( ClassDeclaration ) _classDeclarations.get( qualifiedName ); +// if ( decl != null ) return decl; - decl = new ClassDeclarationImpl( delegate ); - _classDeclarations.put( qualifiedName, decl ); - return decl; + return new ClassDeclarationImpl( delegate ); +// _classDeclarations.put( qualifiedName, decl ); +// return decl; } public InterfaceDeclaration getInterfaceDeclaration( XClass delegate ) Copied: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationInstanceImpl.java (from r159330, incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java) URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationInstanceImpl.java?view=diff&rev=161025&p1=incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java&r1=159330&p2=incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationInstanceImpl.java&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationInstanceImpl.java Mon Apr 11 23:42:11 2005 @@ -17,7 +17,7 @@ */ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; import org.apache.beehive.netui.compiler.typesystem.type.AnnotationType; import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition; @@ -32,9 +32,9 @@ import java.util.List; import java.util.Map; -public class AnnotationMirrorImpl +public class AnnotationInstanceImpl extends DelegatingImpl - implements AnnotationMirror + implements AnnotationInstance { private AnnotationType _type; @@ -43,7 +43,7 @@ // Map<AnnotationTypeElementDeclaration, AnnotationValue> getElementValues(); private HashMap _elementValues; - public AnnotationMirrorImpl( XTag tag, XProgramElement element, AnnotationType type, HashMap elementValues ) + public AnnotationInstanceImpl( XTag tag, XProgramElement element, AnnotationType type, HashMap elementValues ) { super( tag ); _sourcePosition = SourcePositionImpl.get( tag, element ); @@ -104,7 +104,7 @@ { if ( o == null ) return false; if ( o == this ) return true; - if ( ! ( o instanceof AnnotationMirrorImpl ) ) return false; + if ( ! ( o instanceof AnnotationInstanceImpl ) ) return false; assert false : "didn't finish equals()"; return false; } Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -18,7 +18,7 @@ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; import org.apache.beehive.netui.compiler.JpfLanguageConstants; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration; @@ -124,7 +124,7 @@ throw new UnsupportedOperationException( "NYI" ); } - public AnnotationMirror[] getAnnotationMirrors() + public AnnotationInstance[] getAnnotationInstances() { assert false : "NYI"; throw new UnsupportedOperationException( "NYI" ); Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -17,19 +17,15 @@ */ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue; import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier; import org.apache.beehive.netui.compiler.typesystem.declaration.ParameterDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition; -import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; -import org.apache.beehive.netui.xdoclet.NetuiSubTask; import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils; -import xjavadoc.Type; -import xjavadoc.XClass; import java.util.Set; import java.util.HashSet; @@ -38,7 +34,7 @@ implements AnnotationTypeElementDeclaration { private String _name; - private TypeMirror _type; + private TypeInstance _type; private String _typeName; private AnnotationValue _defaultVal; private HashSet _validValues; @@ -66,70 +62,18 @@ return _defaultVal; } - public TypeMirror getReturnType() + public TypeInstance getReturnType() { if ( _typeName != null ) { - boolean isArray = false; - - if ( _typeName.endsWith( "[]" ) ) - { - _typeName = _typeName.substring( 0, _typeName.length() - 2 ); - assert ! _typeName.endsWith( "[]" ) : "don't currently handle multidimensional arrays: " + _typeName; - isArray = true; - } - - XClass baseType = XDocletCompilerUtils.getXClass( _typeName ); - assert ! XDocletCompilerUtils.isUnknownClass( baseType ) : "unknown type: " + _typeName; - - if ( isArray ) - { - _type = WrapperFactory.get().getArrayType( new SynthesizedArrayType( baseType, 1 ) ); - } - else - { - _type = WrapperFactory.get().getTypeMirror( baseType ); - } - + _type = XDocletCompilerUtils.resolveType( _typeName, false, null ); + assert _type != null : "unresolvable type " + _typeName; _typeName = null; } return _type; } - private static class SynthesizedArrayType - implements Type - { - private XClass _baseType; - private int _dimension; - - public SynthesizedArrayType( XClass type, int dimension ) - { - _baseType = type; - _dimension = dimension; - } - - public int getDimension() - { - return _dimension; - } - - public String getDimensionAsString() - { - StringBuffer buf = new StringBuffer(); - for ( int i = 0; i < _dimension; ++i ) - { - buf.append( "[]" ); - } - return buf.toString(); - } - - public XClass getType() - { - return _baseType; - } - } - public ParameterDeclaration[] getParameters() { assert false : "NYI"; @@ -142,7 +86,7 @@ throw new UnsupportedOperationException( "NYI" ); } - public AnnotationMirror[] getAnnotationMirrors() + public AnnotationInstance[] getAnnotationInstances() { assert false : "NYI"; throw new UnsupportedOperationException( "NYI" ); Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -104,7 +104,7 @@ public List getParameters() { - return Collections.emptyList(); + return Collections.EMPTY_LIST; } public List getThrownExceptions() Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -18,7 +18,7 @@ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; import org.apache.beehive.netui.compiler.JpfLanguageConstants; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue; @@ -27,14 +27,14 @@ import org.apache.beehive.netui.compiler.typesystem.type.AnnotationType; import org.apache.beehive.netui.compiler.typesystem.type.ClassType; import org.apache.beehive.netui.compiler.typesystem.type.PrimitiveType; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; +import org.apache.beehive.netui.compiler.typesystem.type.ArrayType; +import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType; import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl; -import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.env.SourcePositionImpl; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.AnnotationTypeImpl; import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils; -import xjavadoc.XClass; import xjavadoc.XDoc; import xjavadoc.XProgramElement; import xjavadoc.XTag; @@ -62,6 +62,7 @@ private static final HashMap MODIFIERS = new HashMap(); private static final HashMap MEMBER_ARRAY_ANNOTATIONS = new HashMap(); private static final HashMap MEMBER_ANNOTATIONS = new HashMap(); + private static final HashSet MEMBER_OR_TOPLEVEL_ANNOTATIONS = new HashSet(); static { @@ -101,16 +102,18 @@ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX + VALIDATE_CREDIT_CARD_TAG_NAME, VALIDATE_CREDIT_CARD_ATTR ); MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX + VALIDATE_EMAIL_TAG_NAME, VALIDATE_EMAIL_ATTR ); MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX + VALIDATE_VALID_WHEN_TAG_NAME, VALIDATE_VALID_WHEN_ATTR ); + + MEMBER_OR_TOPLEVEL_ANNOTATIONS.add( ANNOTATION_INTERFACE_PREFIX + VALIDATABLE_PROPERTY_TAG_NAME ); } private HashSet _modifiers; - private AnnotationMirror[] _annotations; + private AnnotationInstance[] _annotations; public DeclarationImpl( XProgramElement delegate ) { super( delegate ); ArrayList annotations = getAnnotations( delegate ); - _annotations = ( AnnotationMirror[] ) annotations.toArray( new AnnotationMirror[ annotations.size() ] ); + _annotations = ( AnnotationInstance[] ) annotations.toArray( new AnnotationInstance[ annotations.size() ] ); } public String getDocComment() @@ -118,7 +121,7 @@ return getDelegateXProgramElement().getDoc().getCommentText(); } - public AnnotationMirror[] getAnnotationMirrors() + public AnnotationInstance[] getAnnotationInstances() { return _annotations; } @@ -146,7 +149,9 @@ public String getSimpleName() { - return getDelegateXProgramElement().getName(); + String name = getDelegateXProgramElement().getName(); + int lastDot = name.lastIndexOf( '.' ); + return lastDot != -1 ? name.substring( lastDot + 1 ) : name; } public SourcePosition getPosition() @@ -420,19 +425,19 @@ { if ( expectedType.equals( "int" ) ) { - return Integer.valueOf( ( int ) defaultNumber ); + return new Integer( ( int ) defaultNumber ); } else if ( expectedType.equals( "long" ) ) { - return Long.valueOf( ( long ) defaultNumber ); + return new Long( ( long ) defaultNumber ); } else if ( expectedType.equals( "float" ) ) { - return Float.valueOf( ( float ) defaultNumber ); + return new Float( ( float ) defaultNumber ); } else if ( expectedType.equals( "double" ) ) { - return Double.valueOf( defaultNumber ); + return new Double( defaultNumber ); } assert false : "type " + expectedType + " cannot accept value " + defaultNumber; @@ -471,7 +476,7 @@ /** * Get all the annotations for the given element. * @param element the element (class, method, etc.) to examine - * @return an ArrayList of AnnotationMirrors. + * @return an ArrayList of AnnotationInstances. */ private static ArrayList getAnnotations( XProgramElement element ) { @@ -497,23 +502,29 @@ { String attrName = ( String ) j.next(); AnnotationTypeElementDeclaration memberDecl = decl.getMember( attrName ); - SourcePosition pos = SourcePositionImpl.get( tag, attrName, element ); + SourcePositionImpl pos = SourcePositionImpl.get( tag, attrName, element ); Object val = parseValue( memberDecl, tag.getAttributeValue( attrName ), pos ); AnnotationValue value = new AnnotationValueImpl( val, pos, memberDecl ); elementValues.put( memberDecl, value ); } - AnnotationMirrorImpl ann = new AnnotationMirrorImpl( tag, element, type, elementValues ); + AnnotationInstanceImpl ann = new AnnotationInstanceImpl( tag, element, type, elementValues ); String memberName = ( String ) MEMBER_ARRAY_ANNOTATIONS.get( tag.getName() ); if ( memberName != null ) { - addAnnotationToParent( annotations, ann, memberName, true, parentAnnotations ); + if ( ! addAnnotationToParent( annotations, ann, memberName, true, parentAnnotations ) ) + { + annotations.add( ann ); + } } else if ( ( memberName = ( String ) MEMBER_ANNOTATIONS.get( tag.getName() ) ) != null ) { - addAnnotationToParent( annotations, ann, memberName, false, parentAnnotations ); + if ( ! addAnnotationToParent( annotations, ann, memberName, false, parentAnnotations ) ) + { + annotations.add( ann ); + } } else { @@ -522,7 +533,7 @@ for ( int j = 0, len = parentAnnotations.size(); j < len; ++j ) { - AnnotationMirrorImpl parentAnn = ( AnnotationMirrorImpl ) parentAnnotations.get( j ); + AnnotationInstanceImpl parentAnn = ( AnnotationInstanceImpl ) parentAnnotations.get( j ); if ( parentAnn.getAnnotationType().equals( ann.getAnnotationType() ) ) { @@ -543,17 +554,20 @@ return annotations; } - private static void addAnnotationToParent( ArrayList annotations, AnnotationMirrorImpl ann, String memberArrayName, - boolean memberIsArray, ArrayList parentAnnotations ) + private static boolean addAnnotationToParent( ArrayList annotations, AnnotationInstanceImpl ann, String memberArrayName, + boolean memberIsArray, ArrayList parentAnnotations ) { if ( annotations.size() == 0 ) { + String annName = ann.getDelegateXTag().getName(); + if ( MEMBER_OR_TOPLEVEL_ANNOTATIONS.contains( annName ) ) return false; + XDocletCompilerUtils.addError( ann.getPosition(), "error.no-parent-annotation", new String[]{ ann.getAnnotationType().getAnnotationTypeDeclaration().getQualifiedName() } ); } else { - AnnotationMirrorImpl foundTheRightParent = null; + AnnotationInstanceImpl foundTheRightParent = null; // // Look through the hierarchy of parent annotations, for the first one that can accept the given annotation @@ -561,7 +575,7 @@ // for ( int i = parentAnnotations.size() - 1; i >= 0; --i ) { - AnnotationMirrorImpl parentAnnotation = ( AnnotationMirrorImpl ) parentAnnotations.get( i ); + AnnotationInstanceImpl parentAnnotation = ( AnnotationInstanceImpl ) parentAnnotations.get( i ); AnnotationTypeElementDeclaration elementDecl = parentAnnotation.getAnnotationType().getAnnotationTypeDeclaration().getMember( memberArrayName ); @@ -572,7 +586,7 @@ // // Blow away everything past the found parent annotation in the hierarchy. // - for ( int j = i + 1; j < parentAnnotations.size(); ++j ) + for ( int j = i + 1, len = parentAnnotations.size(); j < len; ++j ) { parentAnnotations.remove( i + 1 ); } @@ -587,15 +601,20 @@ } else { + String annName = ann.getDelegateXTag().getName(); + if ( MEMBER_OR_TOPLEVEL_ANNOTATIONS.contains( annName ) ) return false; + XDocletCompilerUtils.addError( ann.getPosition(), "error.no-parent-annotation", new String[]{ ann.getAnnotationType().getAnnotationTypeDeclaration().getQualifiedName() } ); } } + + return true; } - private static Object parseValue( AnnotationTypeElementDeclaration memberDecl, String strValue, SourcePosition pos ) + private static Object parseValue( AnnotationTypeElementDeclaration memberDecl, String strValue, SourcePositionImpl pos ) { - TypeMirror type = memberDecl.getReturnType(); + TypeInstance type = memberDecl.getReturnType(); if ( type instanceof ClassType ) { @@ -608,20 +627,37 @@ } else if ( typeName.equals( "java.lang.Class" ) ) { - XClass classValue = XDocletCompilerUtils.getXClass( strValue ); + TypeInstance retVal = XDocletCompilerUtils.resolveType( strValue, false, pos.getOuterClass() ); - if ( XDocletCompilerUtils.isUnknownClass( classValue ) ) + if ( retVal == null ) { XDocletCompilerUtils.addError( pos, "error.unknown-class", new String[]{ strValue, memberDecl.getSimpleName() } ); } - return WrapperFactory.get().getTypeMirror( classValue ); + return XDocletCompilerUtils.resolveType( strValue, true, pos.getOuterClass() ); } else { assert false : "unexpected type in annotation declaration: " + typeName; } + } + else if ( type instanceof ArrayType ) + { + ArrayType arrayType = ( ArrayType ) type; + TypeInstance componentType = arrayType.getComponentType(); + + // We only handle an array of strings -- nothing else at this point. + assert componentType instanceof DeclaredType : componentType.getClass().getName(); + assert ( ( DeclaredType ) componentType ).getDeclaration().getQualifiedName().equals( String.class.getName() ) + : ( ( DeclaredType ) componentType ).getDeclaration().getQualifiedName(); + StringTokenizer tok = new StringTokenizer( strValue, "," ); + ArrayList arrayValues = new ArrayList(); + while ( tok.hasMoreTokens() ) + { + arrayValues.add( new AnnotationValueImpl( tok.nextToken().trim(), pos, memberDecl ) ); + } + return arrayValues; } assert type instanceof PrimitiveType : type.getClass().getName(); Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -19,8 +19,10 @@ import org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; +import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils; import xjavadoc.XField; +import xjavadoc.XClass; public class FieldDeclarationImpl extends MemberDeclarationImpl @@ -31,9 +33,11 @@ super( delegate ); } - public TypeMirror getType() + public TypeInstance getType() { - return WrapperFactory.get().getTypeMirror( getDelegateXField().getType() ); + XClass fieldType = getDelegateXField().getType(); + int dimension = getDelegateXField().getDimension(); + return WrapperFactory.get().getTypeInstance( fieldType, dimension ); } public XField getDelegateXField() Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -19,7 +19,7 @@ import org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; import xjavadoc.XMethod; public class MethodDeclarationImpl @@ -31,9 +31,9 @@ super( delegate ); } - public TypeMirror getReturnType() + public TypeInstance getReturnType() { - return WrapperFactory.get().getTypeMirror( getDelegateXMethod().getReturnType() ); + return WrapperFactory.get().getTypeInstance( getDelegateXMethod().getReturnType() ); } public XMethod getDelegateXMethod() Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -18,11 +18,11 @@ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; import org.apache.beehive.netui.compiler.typesystem.declaration.ParameterDeclaration; -import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror; +import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition; import xjavadoc.XParameter; @@ -37,12 +37,12 @@ super( delegate ); } - public TypeMirror getType() + public TypeInstance getType() { - return WrapperFactory.get().getTypeMirror( getDelegateXParameter().getType() ); + return WrapperFactory.get().getTypeInstance( getDelegateXParameter().getType() ); } - public AnnotationMirror[] getAnnotationMirrors() + public AnnotationInstance[] getAnnotationInstances() { throw new UnsupportedOperationException( ParameterDeclaration.class.getName() + " cannot have annotations" ); } Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java Mon Apr 11 23:42:11 2005 @@ -95,10 +95,12 @@ { Collection delegateCollection = getDelegateXClass().getMethods(); MethodDeclaration[] array = new MethodDeclaration[delegateCollection.size()]; - int j = 0; + int j = array.length; + + // Doing this loop in reverse makes the ordering like what we see in apt/Mirror. for ( Iterator i = delegateCollection.iterator(); i.hasNext(); ) { - array[j++] = WrapperFactory.get().getMethodDeclaration( ( XMethod ) i.next() ); + array[--j] = WrapperFactory.get().getMethodDeclaration( ( XMethod ) i.next() ); } _methods = array; } @@ -122,7 +124,13 @@ return _nestedTypes; } - + + public boolean equals( Object o ) + { + return super.equals( o ) || + ( o instanceof TypeDeclaration && ( ( TypeDeclaration ) o ).getQualifiedName().equals( getQualifiedName() )); + } + protected XClass getDelegateXClass() { return ( XClass ) super.getDelegate(); Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java Mon Apr 11 23:42:11 2005 @@ -95,7 +95,7 @@ public TypeDeclaration getTypeDeclaration( String s ) { - return WrapperFactory.get().getTypeDeclaration( XDocletCompilerUtils.getXClass( s ) ); + return XDocletCompilerUtils.resolveTypeDeclaration( s ); } public Declaration[] getDeclarationsAnnotatedWith( AnnotationTypeDeclaration decl ) Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java Mon Apr 11 23:42:11 2005 @@ -70,7 +70,7 @@ return outerClass instanceof SourceClass ? new SourcePositionImpl( tag, ( SourceClass ) outerClass ) : null; } - public static SourcePosition get( XTag tag, String memberName, XProgramElement element ) + public static SourcePositionImpl get( XTag tag, String memberName, XProgramElement element ) { if ( element == null ) return null; XClass outerClass = XDocletUtils.getOutermostClass( element ); @@ -91,5 +91,15 @@ { assert false : "NYI"; return 0; + } + + public XClass getOuterClass() + { + return _outerClass; + } + + public String getMemberName() + { + return _memberName; } } Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java Mon Apr 11 23:42:11 2005 @@ -18,7 +18,7 @@ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type; import org.apache.beehive.netui.compiler.typesystem.type.ArrayType; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory; import xjavadoc.Type; @@ -31,9 +31,12 @@ super( delegate ); } - public TypeMirror getComponentType() + public TypeInstance getComponentType() { - return WrapperFactory.get().getTypeMirror( getDelegateType().getType() ); + Type componentType = getDelegateType(); + int dimension = componentType.getDimension(); + assert dimension > 0 : "bad dimension " + dimension + " for array type " + componentType.getType(); + return WrapperFactory.get().getTypeInstance( componentType.getType(), dimension - 1 ); } public Type getDelegateType() Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java Mon Apr 11 23:42:11 2005 @@ -51,4 +51,10 @@ { return ( XClass ) super.getDelegate(); } + + public boolean equals( Object o ) + { + return super.equals( o ) || + ( o instanceof DeclaredType && ( ( DeclaredType ) o ).getDeclaration().equals( getDeclaration() ) ); + } } Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java Mon Apr 11 23:42:11 2005 @@ -24,7 +24,7 @@ import xjavadoc.XClass; public class PrimitiveTypeImpl - extends TypeMirrorImpl + extends TypeInstanceImpl implements PrimitiveType { private static final HashMap PRIMITIVE_TYPES = new HashMap(); Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java Mon Apr 11 23:42:11 2005 @@ -20,7 +20,7 @@ import org.apache.beehive.netui.compiler.typesystem.type.ReferenceType; public class ReferenceTypeImpl - extends TypeMirrorImpl + extends TypeInstanceImpl implements ReferenceType { public ReferenceTypeImpl( Object delegate ) Copied: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeInstanceImpl.java (from r159330, incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java) URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeInstanceImpl.java?view=diff&rev=161025&p1=incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java&r1=159330&p2=incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeInstanceImpl.java&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeInstanceImpl.java Mon Apr 11 23:42:11 2005 @@ -17,14 +17,14 @@ */ package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type; -import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror; +import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance; import org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl; -public class TypeMirrorImpl +public class TypeInstanceImpl extends DelegatingImpl - implements TypeMirror + implements TypeInstance { - public TypeMirrorImpl( Object delegate ) + public TypeInstanceImpl( Object delegate ) { super( delegate ); } Modified: incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/VoidTypeImpl.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/VoidTypeImpl.java?view=diff&r1=161024&r2=161025 ============================================================================== --- incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/VoidTypeImpl.java (original) +++ incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/VoidTypeImpl.java Mon Apr 11 23:42:11 2005 @@ -21,7 +21,7 @@ import xjavadoc.XClass; public class VoidTypeImpl - extends TypeMirrorImpl + extends TypeInstanceImpl implements VoidType { public VoidTypeImpl( XClass delegate )
