Changeset 76
- Timestamp:
- 10/21/09 16:21:22 (2 years ago)
- Files:
-
- trunk/src/org/fluffnstuff/asdoclet/generator/utils/GeneratorUtils.java (modified) (9 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/AbstractHandler.java (modified) (4 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/ClassHandler.java (modified) (5 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/EnumHandler.java (modified) (2 diffs)
- trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java (modified) (6 diffs)
- trunk/test (modified) (1 prop)
- trunk/test/TestAsdoclet.java (modified) (1 diff)
- trunk/test/asdoclet/test (modified) (1 prop)
- trunk/test/asdoclet/test/TestException.java (modified) (1 diff)
- trunk/test/asdoclet/test/TestIgnoreGeneric.java (added)
- trunk/test/expectations/actionscript/asdoclet/test/TestException.as (modified) (1 diff)
- trunk/test/expectations/actionscript/asdoclet/test/TestIgnoreGeneric.as (added)
- trunk/test/expectations/cs/asdoclet/test/TestIgnoreGeneric.cs (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/org/fluffnstuff/asdoclet/generator/utils/GeneratorUtils.java
r71 r76 24 24 private static Map<String, org.fluffnstuff.asdoclet.generator.Type> enumerationTypes = new HashMap<String, org.fluffnstuff.asdoclet.generator.Type>(); 25 25 26 public static org.fluffnstuff.asdoclet.generator.Type getType(MethodDoc doc, Generator generator ) {26 public static org.fluffnstuff.asdoclet.generator.Type getType(MethodDoc doc, Generator generator, Collection<String> ignore) { 27 27 if (generator.isDebug()) System.out.println(MessageFormat.format("Generating type {0} <{1}>", doc.name(), doc.getClass().getCanonicalName())); 28 28 … … 32 32 if (generator.isDebug()) System.out.println(MessageFormat.format("Parameters {0}", Arrays.toString(doc.typeParameters()))); 33 33 for (Type argument : doc.typeParameters()) { 34 processArgument(argument, generator, arguments, bounds, new HashSet<String>());34 processArgument(argument, generator, arguments, bounds, ignore, new HashSet<String>()); 35 35 } 36 36 … … 41 41 } 42 42 43 private static void processArgument(Type argument, Generator generator, Collection<org.fluffnstuff.asdoclet.generator.Type> arguments, Map<String, org.fluffnstuff.asdoclet.generator.Type> bounds, Collection<String> visited) {43 private static void processArgument(Type argument, Generator generator, Collection<org.fluffnstuff.asdoclet.generator.Type> arguments, Map<String, org.fluffnstuff.asdoclet.generator.Type> bounds, Collection<String> ignore, Collection<String> visited) { 44 44 if (generator.isDebug()) System.out.println(MessageFormat.format("Processing argument {0} <{1}>", argument.qualifiedTypeName(), argument.getClass().getCanonicalName())); 45 45 46 org.fluffnstuff.asdoclet.generator.Type argumentType = getType(argument, generator, visited);46 org.fluffnstuff.asdoclet.generator.Type argumentType = getType(argument, generator, ignore, visited); 47 47 if (argumentType != org.fluffnstuff.asdoclet.generator.Type.NULL) { 48 getTypeBounds(argument, generator, bounds, visited);48 getTypeBounds(argument, generator, bounds, ignore, visited); 49 49 if (arguments != null) arguments.add(argumentType); 50 50 } 51 51 } 52 52 53 private static org.fluffnstuff.asdoclet.generator.Type getType(Type type, Generator generator, Collection<String> visited) {53 private static org.fluffnstuff.asdoclet.generator.Type getType(Type type, Generator generator, Collection<String> ignore, Collection<String> visited) { 54 54 if (generator.isDebug()) System.out.println(MessageFormat.format("Generating type {0} <{1}>", type.qualifiedTypeName(), type.getClass().getCanonicalName())); 55 56 if (ignore.contains(type.qualifiedTypeName())) return org.fluffnstuff.asdoclet.generator.Type.NULL; 55 57 56 58 if (visited.contains(type.toString())) return getType(type.qualifiedTypeName(), generator); … … 67 69 if (generator.isDebug()) System.out.println(MessageFormat.format("Arguments {0}", Arrays.toString(parameterizedType.typeArguments()))); 68 70 for (Type argument : parameterizedType.typeArguments()) { 69 processArgument(argument, generator, arguments, bounds, visited);71 processArgument(argument, generator, arguments, bounds, ignore, visited); 70 72 } 71 73 } else if (type instanceof ClassDoc) { … … 73 75 if (generator.isDebug()) System.out.println(MessageFormat.format("Parameters {0}", Arrays.toString(classDoc.typeParameters()))); 74 76 for (Type argument : classDoc.typeParameters()) { 75 processArgument(argument, generator, arguments, bounds, visited);77 processArgument(argument, generator, arguments, bounds, ignore, visited); 76 78 } 77 79 } … … 100 102 for (AnnotationDesc annotationDesc : methodDoc.annotations()) { 101 103 if (annotationDesc.annotationType().qualifiedTypeName().equals(enumAnnotation.getCanonicalName())) { 102 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(methodDoc.returnType(), generator );104 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(methodDoc.returnType(), generator, new HashSet<String>()); 103 105 enumerationTypes.put(typeName, type); 104 106 return type; … … 113 115 } 114 116 115 public static org.fluffnstuff.asdoclet.generator.Type getType(Type type, Generator generator ) {116 return getType(type, generator, new HashSet<String>());117 public static org.fluffnstuff.asdoclet.generator.Type getType(Type type, Generator generator, Collection<String> ignore) { 118 return getType(type, generator, ignore, new HashSet<String>()); 117 119 } 118 120 … … 125 127 } 126 128 127 private static void getTypeBounds(Type argument, Generator generator, Map<String, org.fluffnstuff.asdoclet.generator.Type> bounds, Collection<String> visited) {129 private static void getTypeBounds(Type argument, Generator generator, Map<String, org.fluffnstuff.asdoclet.generator.Type> bounds, Collection<String> ignore, Collection<String> visited) { 128 130 Type[] types = null; 129 131 if (argument instanceof TypeVariable) { … … 137 139 138 140 if (boundType != null) { 139 org.fluffnstuff.asdoclet.generator.Type bound = getType(boundType, generator, visited);141 org.fluffnstuff.asdoclet.generator.Type bound = getType(boundType, generator, ignore, visited); 140 142 141 143 if (bound != org.fluffnstuff.asdoclet.generator.Type.NULL) { trunk/src/org/fluffnstuff/asdoclet/handler/AbstractHandler.java
r71 r76 62 62 63 63 if (fieldType == null) { 64 fieldType = GeneratorUtils.getType(methodDoc.returnType(), getGenerator() );65 methodType = GeneratorUtils.getType(methodDoc, getGenerator() );64 fieldType = GeneratorUtils.getType(methodDoc.returnType(), getGenerator(), ignore); 65 methodType = GeneratorUtils.getType(methodDoc, getGenerator(), ignore); 66 66 } 67 67 … … 165 165 if (classDoc.isInterface()) { 166 166 for (ClassDoc interfaceDoc : classDoc.interfaces()) { 167 org.fluffnstuff.asdoclet.generator.Type interfaceClass = GeneratorUtils.getType(interfaceDoc, getGenerator(), ignore); 168 169 if (interfaceClass == org.fluffnstuff.asdoclet.generator.Type.NULL) return false; 167 170 if (ignore.contains(interfaceDoc.qualifiedTypeName() + "." + name)) return false; 168 171 if (ignore.contains(interfaceDoc.qualifiedTypeName())) return false; … … 176 179 } 177 180 } else { 178 for (ClassDoc superClass = classDoc.superclass(); superClass != null; superClass = superClass.superclass()) { 179 if (ignore.contains(superClass.qualifiedTypeName() + "." + name)) return false; 180 if (ignore.contains(superClass.qualifiedTypeName())) return false; 181 if (findMethod(name, superClass)) return true; 182 183 Map<String, String> commands = TagParser.processClassTags(getGenerator(), superClass); 181 for (ClassDoc superClassDoc = classDoc.superclass(); superClassDoc != null; superClassDoc = superClassDoc.superclass()) { 182 org.fluffnstuff.asdoclet.generator.Type superClass = GeneratorUtils.getType(superClassDoc, getGenerator(), ignore); 183 184 if (superClass == org.fluffnstuff.asdoclet.generator.Type.NULL) return false; 185 if (ignore.contains(superClassDoc.qualifiedTypeName() + "." + name)) return false; 186 if (ignore.contains(superClassDoc.qualifiedTypeName())) return false; 187 if (findMethod(name, superClassDoc)) return true; 188 189 Map<String, String> commands = TagParser.processClassTags(getGenerator(), superClassDoc); 184 190 ignore.addAll(getIgnore(commands)); 185 191 } … … 230 236 protected void processInterfaces(ClassDoc classDoc, Set<String> ignore) { 231 237 for (Type type : classDoc.interfaceTypes()) { 232 org.fluffnstuff.asdoclet.generator.Type interfaceName = GeneratorUtils.getType(type, getGenerator() );238 org.fluffnstuff.asdoclet.generator.Type interfaceName = GeneratorUtils.getType(type, getGenerator(), ignore); 233 239 234 240 if (interfaceName != org.fluffnstuff.asdoclet.generator.Type.NULL && !ignore.contains(interfaceName.getName())) { trunk/src/org/fluffnstuff/asdoclet/handler/ClassHandler.java
r71 r76 3 3 import java.util.Map; 4 4 import java.util.Set; 5 import java.util.Collection; 5 6 6 7 import org.fluffnstuff.asdoclet.generator.Generator; … … 24 25 Set<String> ignore = getIgnore(commands); 25 26 26 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(classDoc, getGenerator() );27 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(classDoc, getGenerator(), ignore); 27 28 28 29 getGenerator().beginClass(type); … … 33 34 processInterfaces(classDoc, ignore); 34 35 processClassComment(classDoc); 35 processClassConstants(type, classDoc );36 processClassConstants(type, classDoc, ignore); 36 37 processBeanProperties(type, classDoc, ignore, commands); 37 38 … … 45 46 } 46 47 47 private void processClassConstants(org.fluffnstuff.asdoclet.generator.Type classType, ClassDoc classDoc ) {48 private void processClassConstants(org.fluffnstuff.asdoclet.generator.Type classType, ClassDoc classDoc, Collection<String> ignore) { 48 49 for (FieldDoc fieldDoc : classDoc.fields()) { 49 50 if (fieldDoc.isFinal() && fieldDoc.isPublic()) { 50 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(fieldDoc.type(), getGenerator() );51 org.fluffnstuff.asdoclet.generator.Type type = GeneratorUtils.getType(fieldDoc.type(), getGenerator(), ignore); 51 52 getGenerator().addConstant(classType, type, fieldDoc.name(), fieldDoc.constantValueExpression(), fieldDoc.commentText()); 52 53 } … … 54 55 } 55 56 56 private void processSuperClass(ClassDoc classDoc, Set<String> ignore) {57 private void processSuperClass(ClassDoc classDoc, Collection<String> ignore) { 57 58 Type type = classDoc.superclassType(); 58 59 if ((type != null) && !type.qualifiedTypeName().equals(Object.class.getCanonicalName())) { 59 org.fluffnstuff.asdoclet.generator.Type superClass = GeneratorUtils.getType(type, getGenerator() );60 org.fluffnstuff.asdoclet.generator.Type superClass = GeneratorUtils.getType(type, getGenerator(), ignore); 60 61 61 62 if (superClass != org.fluffnstuff.asdoclet.generator.Type.NULL && !ignore.contains(superClass.getName())) { trunk/src/org/fluffnstuff/asdoclet/handler/EnumHandler.java
r71 r76 4 4 import java.lang.reflect.InvocationTargetException; 5 5 import java.lang.reflect.Method; 6 import java.util.HashSet; 6 7 7 8 import org.fluffnstuff.asdoclet.generator.Generator; … … 36 37 private void processEnumConstants(Type type, ClassDoc classDoc) throws InvocationTargetException, IllegalAccessException, ClassNotFoundException { 37 38 Method getter = findGetter(classDoc); 38 Type valueType = GeneratorUtils.getType(classDoc, getGenerator() );39 Type valueType = GeneratorUtils.getType(classDoc, getGenerator(), new HashSet<String>()); 39 40 40 41 for (FieldDoc fieldDoc : classDoc.enumConstants()) { trunk/src/org/fluffnstuff/asdoclet/handler/InterfaceHandler.java
r71 r76 6 6 import java.util.Map; 7 7 import java.util.Set; 8 import java.util.HashSet; 8 9 9 10 import org.fluffnstuff.asdoclet.generator.Generator; … … 27 28 boolean proxy = TagParser.getBooleanCommand(Constants.COMMAND_PROXY, commands); 28 29 if (proxy) { 29 org.fluffnstuff.asdoclet.generator.Type interfaceName = GeneratorUtils.getType(classDoc, getGenerator() );30 org.fluffnstuff.asdoclet.generator.Type interfaceName = GeneratorUtils.getType(classDoc, getGenerator(), new HashSet<String>()); 30 31 String proxyName = TagParser.getStringCommand(Constants.COMMAND_PROXY_NAME, interfaceName + "Proxy", commands); 31 32 String baseType = TagParser.getStringCommand(Constants.COMMAND_PROXY_SUPER_CLASS, commands); … … 47 48 48 49 private void processInterfaceInternal(ClassDoc classDoc, Map<String, String> commands) { 49 org.fluffnstuff.asdoclet.generator.Type interfaceName = GeneratorUtils.getType(classDoc, getGenerator());50 51 50 boolean bean = TagParser.getBooleanCommand(Constants.COMMAND_BEAN, commands); 52 51 Set<String> ignore = getIgnore(commands); 52 53 org.fluffnstuff.asdoclet.generator.Type interfaceName = GeneratorUtils.getType(classDoc, getGenerator(), ignore); 53 54 54 55 getGenerator().beginInterface(interfaceName); … … 79 80 Map<String, String> methodCommands = new HashMap<String, String>(commands); 80 81 Map<String, String> methodOnlyCommands = new HashMap<String, String>(); 81 org.fluffnstuff.asdoclet.generator.Type returnType = GeneratorUtils.getType(methodDoc.returnType(), getGenerator()); 82 org.fluffnstuff.asdoclet.generator.Type methodType = GeneratorUtils.getType(methodDoc, getGenerator()); 82 83 org.fluffnstuff.asdoclet.generator.Type returnType = GeneratorUtils.getType(methodDoc.returnType(), getGenerator(), ignore); 84 org.fluffnstuff.asdoclet.generator.Type methodType = GeneratorUtils.getType(methodDoc, getGenerator(), ignore); 83 85 84 86 if (typeMap != null) { … … 128 130 129 131 for (Parameter parameter : methodDoc.parameters()) { 130 getGenerator().addParameter(classType, methodType, GeneratorUtils.getType(parameter.type(), getGenerator() ), parameter.name());132 getGenerator().addParameter(classType, methodType, GeneratorUtils.getType(parameter.type(), getGenerator(), ignore), parameter.name()); 131 133 } 132 134 … … 151 153 ClassDoc classDoc = type.asClassDoc(); 152 154 153 org.fluffnstuff.asdoclet.generator.Type interfaceType = GeneratorUtils.getType(type, getGenerator() );155 org.fluffnstuff.asdoclet.generator.Type interfaceType = GeneratorUtils.getType(type, getGenerator(), ignore); 154 156 155 157 if (interfaceType != org.fluffnstuff.asdoclet.generator.Type.NULL && !ignore.contains(interfaceType.getName())) { 156 org.fluffnstuff.asdoclet.generator.Type interfaceClass = GeneratorUtils.getType(classDoc, getGenerator() );158 org.fluffnstuff.asdoclet.generator.Type interfaceClass = GeneratorUtils.getType(classDoc, getGenerator(), ignore); 157 159 Map<String, org.fluffnstuff.asdoclet.generator.Type> typeMap = null; 158 160 trunk/test
- Property svn:ignore changed from
results
to
results
*.class
- Property svn:ignore changed from
trunk/test/TestAsdoclet.java
r71 r76 3 3 public class TestAsdoclet { 4 4 public static void main(String[] args) { 5 Main.execute(new String[]{"-d", "test/results/cs", "-doclet", "org.fluffnstuff.asdoclet.AsDoclet", "-generator", "cs", "asdoclet.test", "test/asdoclet/test/TestI nterfaceAnnotations.java"});5 Main.execute(new String[]{"-d", "test/results/cs", "-doclet", "org.fluffnstuff.asdoclet.AsDoclet", "-generator", "cs", "asdoclet.test", "test/asdoclet/test/TestIgnoreGeneric.java"}); 6 6 } 7 7 } trunk/test/asdoclet/test
- Property svn:ignore set to
*.class
- Property svn:ignore set to
trunk/test/asdoclet/test/TestException.java
r71 r76 20 20 super(message, cause); 21 21 } 22 23 /** 24 * @return message 25 * @cs.property ignore=<code>true</code> 26 */ 27 @Override 28 public String getMessage() { 29 return super.getMessage(); 30 } 22 31 } trunk/test/expectations/actionscript/asdoclet/test/TestException.as
r71 r76 6 6 [RemoteClass(alias="asdoclet.test.TestException")] 7 7 public class TestException { 8 private var _message:String; 9 public function get message():String { 10 return _message; 11 } 12 public function set message(value:String):void { 13 _message=value; 14 } 8 15 } 9 16 }