*** .cvsignore 23 Mar 2004 16:31:47 -0000 1.8 --- .cvsignore 7 Sep 2004 15:14:26 -0000 *************** *** 6,8 **** --- 6,10 ---- tmp .classpath .project + qdox-orig.iws + qdox.iml *** src/java/com/thoughtworks/qdox/model/DefaultDocletTag.java 18 Jun 2004 16:38:59 -0000 1.10 --- src/java/com/thoughtworks/qdox/model/DefaultDocletTag.java 7 Sep 2004 14:27:24 -0000 *************** *** 3,8 **** --- 3,9 ---- import com.thoughtworks.qdox.model.util.TagParser; import java.util.Map; + import java.net.URL; public class DefaultDocletTag implements DocletTag { *************** *** 60,65 **** --- 61,85 ---- public int getLineNumber() { return lineNumber; + } + + public String getLocation(DocletTag tag) { + String location = null; + URL sourceURL = tag.getContext().getSource().getURL(); + if (sourceURL != null) { + location = sourceURL.toExternalForm(); + } else { + // dunno what file it is (might be from a reader). + JavaClass clazz; + if (tag.getContext() instanceof JavaClass) { + // it's on a class (outer class) + clazz = (JavaClass) tag.getContext(); + } else { + clazz = (JavaClass) tag.getContext().getParent(); + } + location = clazz.getFullyQualifiedName(); + } + return location; } } *** src/java/com/thoughtworks/qdox/model/DefaultDocletTagFactory.java 17 May 2004 13:31:08 -0000 1.6 --- src/java/com/thoughtworks/qdox/model/DefaultDocletTagFactory.java 7 Sep 2004 14:27:24 -0000 *************** *** 1,20 **** package com.thoughtworks.qdox.model; /** * @author Aslak Hellesøy * @version $Revision: 1.6 $ */ public class DefaultDocletTagFactory implements DocletTagFactory { ! ! public DocletTag createDocletTag( ! String tag, String text, ! AbstractJavaEntity context, int lineNumber ! ) { ! return new DefaultDocletTag(tag, text, context, lineNumber); ! } public DocletTag createDocletTag(String tag, String text) { return createDocletTag(tag, text, null, 0); } ! } --- 1,79 ---- package com.thoughtworks.qdox.model; + import java.lang.reflect.Constructor; + import java.lang.reflect.InvocationTargetException; + import java.util.Map; + import java.util.Set; + import java.util.Iterator; + import java.util.List; + import java.util.ArrayList; + import java.util.HashMap; + /** * @author Aslak Hellesøy * @version $Revision: 1.6 $ */ public class DefaultDocletTagFactory implements DocletTagFactory { ! private List unknownTags = new ArrayList(); ! private final Map registeredTags = new HashMap(); public DocletTag createDocletTag(String tag, String text) { return createDocletTag(tag, text, null, 0); } ! ! public DocletTag createDocletTag(String tag, String text, AbstractJavaEntity context, int lineNumber) { ! Class tagClass = (Class) registeredTags.get(tag); ! ! boolean isKnown = true; ! if( tagClass == null ) { ! tagClass = DefaultDocletTag.class; ! isKnown = false; ! } ! try { ! Constructor newTag = tagClass.getConstructor(new Class[] {String.class, String.class, AbstractJavaEntity.class, Integer.TYPE}); ! DocletTag result = (DocletTag) newTag.newInstance(new Object[]{tag, text, context, new Integer(lineNumber)}); ! ! if (!isKnown) { ! unknownTags.add(result); ! } ! return result; ! } catch (ClassCastException e) { ! throw new RuntimeException(e); ! } catch (NoSuchMethodException e) { ! throw new RuntimeException("No (String, String, AbstractJavaEntity, int) constructor in " + tagClass.getName()); ! } catch (SecurityException e) { ! throw new RuntimeException(e); ! } catch (InstantiationException e) { ! throw new RuntimeException(e); ! } catch (IllegalAccessException e) { ! throw new RuntimeException(e); ! } catch (IllegalArgumentException e) { ! throw new RuntimeException(e); ! } catch (InvocationTargetException e) { ! throw new RuntimeException(e.getTargetException()); ! } ! } ! ! public void registerTag(String tagName, Class tagClass) { ! registeredTags.put(tagName, tagClass != null ? tagClass : DefaultDocletTag.class); ! } ! ! public void registerTags(Map tags) { ! Set tagNames = tags.keySet(); ! for (Iterator iterator = tagNames.iterator(); iterator.hasNext();) { ! String tagName = (String) iterator.next(); ! registerTag(tagName, (Class) tags.get(tagName)); ! } ! } ! ! public List getUnknownTags() { ! return unknownTags; ! } ! ! public void printUnknownTags() { ! for (Iterator iterator = unknownTags.iterator(); iterator.hasNext();) { ! DocletTag docletTag = (DocletTag) iterator.next(); ! System.out.println("Unknown tag: @" + docletTag.getName() + " in " + docletTag.getLocation(docletTag) + " (line " + docletTag.getLineNumber() + ")"); ! } ! } } *** src/java/com/thoughtworks/qdox/model/DocletTag.java 17 May 2004 13:31:08 -0000 1.15 --- src/java/com/thoughtworks/qdox/model/DocletTag.java 7 Sep 2004 14:27:24 -0000 *************** *** 48,51 **** --- 48,52 ---- */ AbstractJavaEntity getContext(); + String getLocation(DocletTag tag); } *** src/java/com/thoughtworks/qdox/model/DocletTagFactory.java 27 May 2004 14:38:38 -0000 1.6 --- src/java/com/thoughtworks/qdox/model/DocletTagFactory.java 7 Sep 2004 14:33:12 -0000 *************** *** 18,21 **** --- 18,22 ---- DocletTag createDocletTag(String tag, String text); + void registerTag(String tagName, Class tagClass); } *** src/java/com/thoughtworks/qdox/model/JavaClass.java 8 Jul 2004 00:23:47 -0000 1.42 --- src/java/com/thoughtworks/qdox/model/JavaClass.java 11 Oct 2004 08:03:22 -0000 *************** *** 1,7 **** package com.thoughtworks.qdox.model; - import com.thoughtworks.qdox.JavaDocBuilder; - import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; --- 1,5 ---- *************** *** 511,517 **** */ public JavaClass[] getDerivedClasses() { List result = new ArrayList(); ! JavaDocBuilder builder = (JavaDocBuilder) javaClassCache; JavaClass[] classes = builder.getClasses(); for (int i = 0; i < classes.length; i++) { --- 509,515 ---- */ public JavaClass[] getDerivedClasses() { List result = new ArrayList(); ! JavaClassCache builder = javaClassCache; JavaClass[] classes = builder.getClasses(); for (int i = 0; i < classes.length; i++) { *** src/java/com/thoughtworks/qdox/model/JavaClassCache.java 22 Jul 2003 00:37:33 -0000 1.3 --- src/java/com/thoughtworks/qdox/model/JavaClassCache.java 11 Oct 2004 08:01:48 -0000 *************** *** 2,5 **** --- 2,6 ---- public interface JavaClassCache { public JavaClass getClassByName(String name); + JavaClass[] getClasses(); } *** src/java/com/thoughtworks/qdox/model/ModelBuilder.java 20 Jun 2004 00:12:18 -0000 1.25 --- src/java/com/thoughtworks/qdox/model/ModelBuilder.java 11 Oct 2004 04:47:20 -0000 *************** *** 181,186 **** --- 181,187 ---- { String[] modifiers = new String[def.modifiers.size()]; def.modifiers.toArray(modifiers); + currentField.setModifiers(modifiers); } *** src/test/com/thoughtworks/qdox/ant/AbstractQdoxTaskTest.java 17 May 2004 13:31:08 -0000 1.14 --- src/test/com/thoughtworks/qdox/ant/AbstractQdoxTaskTest.java 7 Sep 2004 14:33:56 -0000 *************** *** 52,57 **** --- 52,60 ---- fail(); return null; } + public void registerTag(String tagName, Class tagClass) { + fail(); + } }; } *** src/test/com/thoughtworks/qdox/model/ClassLibraryTest.java 20 Dec 2003 14:05:38 -0000 1.11 --- src/test/com/thoughtworks/qdox/model/ClassLibraryTest.java 11 Oct 2004 08:07:52 -0000 *************** *** 16,21 **** --- 16,25 ---- return clazz; } + public JavaClass[] getClasses() { + return new JavaClass[0]; + } + public void testAdd() throws Exception { ClassLibrary c = new ClassLibrary(this); c.add("com.blah.Ping");