User: rinkrank
  Date: 02/03/01 02:44:40

  Modified:    src/xjavadoc XProgramElement.java XPackage.java
                        XJavaDocTest.java XJavaDoc.java XDoc.java
                        SourceClass.java SimpleNode.java ProxyClass.java
                        Primitive.java FieldImpl.java DefaultXTag.java
                        ConstructorImpl.java AbstractProgramElement.java
                        AbstractClass.java
  Log:
  Automatic JUnit test generation
  Various bug fixes and optimisations
  Deadlock! FIXME
  
  Revision  Changes    Path
  1.4       +1 -1      xjavadoc/src/xjavadoc/XProgramElement.java
  
  Index: XProgramElement.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XProgramElement.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- XProgramElement.java      20 Feb 2002 00:12:01 -0000      1.3
  +++ XProgramElement.java      1 Mar 2002 10:44:39 -0000       1.4
  @@ -43,7 +43,7 @@
    * @created February 16, 2002
    * @todo-javadoc Write javadocs for interface
    */
  -public interface XProgramElement {
  +public interface XProgramElement extends Comparable {
   
        /**
         * Describe what the method does
  
  
  
  1.7       +11 -44    xjavadoc/src/xjavadoc/XPackage.java
  
  Index: XPackage.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XPackage.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- XPackage.java     20 Feb 2002 00:12:01 -0000      1.6
  +++ XPackage.java     1 Mar 2002 10:44:39 -0000       1.7
  @@ -44,7 +44,7 @@
    * @created 3. januar 2002
    * @todo-javadoc Write javadocs
    */
  -public class XPackage implements Comparable {
  +public class XPackage {
   
        /**
         * @todo-javadoc Describe the field
  @@ -66,7 +66,7 @@
         * @todo-javadoc Write javadocs for method parameter
         */
        public XPackage(String name) {
  -             setName(name);
  +             _name = name;
        }
   
   
  @@ -75,7 +75,7 @@
         *
         * @return The DefaultPackage value
         */
  -     public boolean isDefaultPackage() {
  +     public final boolean isDefaultPackage() {
                return name().equals("");
        }
   
  @@ -87,28 +87,12 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public String name() {
  +     public final String name() {
                return _name;
        }
   
   
        /**
  -      * Describe the method
  -      *
  -      * @param clazz Describe the method parameter
  -      * @todo-javadoc Describe the method
  -      * @todo-javadoc Describe the method parameter
  -      */
  -     public void addClass(XClass clazz) {
  -             _classes.add(clazz);
  -//_log.debug( clazz.getClass().getName() + ":" + clazz.qualifiedName() );
  -//        if( clazz.isFromSource() ) {
  -//                   _sourceClasses.add( clazz );
  -//           }
  -     }
  -
  -
  -     /**
         * Describe what the method does
         *
         * @return Describe the return value
  @@ -121,26 +105,6 @@
        }
   
   
  -     /*
  -      *  public XClass[] sourceClasses() {
  -      *  XClass[] result = new XClass[ _sourceClasses.size() ];
  -      *  return (XClass[]) _sourceClasses.toArray(result);
  -      *  }
  -      */
  -     /**
  -      * Describe what the method does
  -      *
  -      * @param o Describe what the parameter does
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for method
  -      * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for return value
  -      */
  -     public int compareTo(Object o) {
  -             return name().compareTo(((XPackage)o).name());
  -     }
  -
  -
        /**
         * Describe what the method does
         *
  @@ -154,11 +118,14 @@
   
   
        /**
  -      * Sets the Name attribute of the XPackage object
  +      * Describe the method
         *
  -      * @param name The new Name value
  +      * @param clazz Describe the method parameter
  +      * @todo-javadoc Write javadocs for return value
  +      * @todo-javadoc Describe the method
  +      * @todo-javadoc Describe the method parameter
         */
  -     void setName(String name) {
  -             _name = name;
  +     void addClass(XClass clazz) {
  +             _classes.add(clazz);
        }
   }
  
  
  
  1.17      +2 -14     xjavadoc/src/xjavadoc/XJavaDocTest.java
  
  Index: XJavaDocTest.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDocTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -r1.16 -r1.17
  --- XJavaDocTest.java 25 Feb 2002 01:03:10 -0000      1.16
  +++ XJavaDocTest.java 1 Mar 2002 10:44:40 -0000       1.17
  @@ -104,7 +104,7 @@
                assertEquals("beer=\"good\" tea=\"bad\"", tags[0].value());
                XMethod[] methods = clazz.methods();
   
  -             doc = methods[0].doc();
  +             doc = clazz.getMethod("nonsense()").doc();
                assertEquals("This is nonsense.", doc.firstSentence());
                tags = doc.tags();
                assertEquals("star:wars", tags[0].name());
  @@ -112,7 +112,7 @@
                assertEquals("empty:tag", tags[1].name());
                assertEquals("", tags[1].value());
   
  -             doc = methods[1].doc();
  +             doc = clazz.getMethod("whatever(java.lang.String[][],int)").doc();
                assertEquals("", doc.firstSentence());
                tags = doc.tags();
                assertEquals("more", tags[0].name());
  @@ -200,18 +200,6 @@
         *      File("build/junit/testAddCommentToUncommentedMethod"); String fileName
         *      = clazz.save(testDir); }
         */
  -
  -     /**
  -      * A unit test for JUnit
  -      *
  -      * @exception Exception Describe the exception
  -      * @todo-javadoc Write javadocs for exception
  -      */
  -     public void testProxyClass() throws Exception {
  -             XClass clazz = XJavaDoc.getInstance().getXClass("Hello");
  -             assert("The class should be a proxy class", clazz instanceof 
ProxyClass);
  -     }
  -
   
        /**
         * A unit test for JUnit
  
  
  
  1.20      +134 -104  xjavadoc/src/xjavadoc/XJavaDoc.java
  
  Index: XJavaDoc.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDoc.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -w -r1.19 -r1.20
  --- XJavaDoc.java     25 Feb 2002 01:03:10 -0000      1.19
  +++ XJavaDoc.java     1 Mar 2002 10:44:40 -0000       1.20
  @@ -140,8 +140,7 @@
         * @param dir The new Dir value
         */
        public void setDir(File dir) {
  -             System.out.println("setFile " + dir.getAbsolutePath());
  -             _log.debug("setFile " + dir.getAbsolutePath());
  +             //_log.debug("setFile " + dir.getAbsolutePath());
                this._dir = dir;
        }
   
  @@ -215,70 +214,6 @@
   
   
        /**
  -      * Get the XClass corresponding to the qualifiedName. This can be a class from
  -      * source, a precompiled class or a primitive. UnknownClass is never returned
  -      * from this method. If a class can't be resolved, null is returned.
  -      *
  -      * @param qualifiedName Describe what the parameter does
  -      * @param proxy return a proxy instance (for performance) if the class hasn't
  -      *      been loaded before.
  -      * @return The XClass value
  -      * @todo-javadoc Write javadocs for method parameter
  -      * @pre qualifiedName != null
  -      * @post return != null
  -      */
  -     public XClass getXClass(String qualifiedName, boolean proxy) {
  -             if (_dir == null) {
  -                     throw new IllegalStateException("setDir must pe called 
first!");
  -             }
  -             if (qualifiedName.equals("")) {
  -                     throw new IllegalStateException("Classname can't be empty 
String");
  -             }
  -             // first, see if we have the class among the sources
  -             XClass result = (XClass)_sourceClasses.get(qualifiedName);
  -             if (result == null) {
  -                     // Couldn't find the class among the sources. Try a Primitive 
class.
  -                     result = getPrimitive(qualifiedName);
  -                     if (result == null) {
  -                             // Couldn't find the class among the sources and 
wasn't primitive.
  -                             // Try a BinaryClass first
  -                             Class clazz = getClass(qualifiedName);
  -                             if (clazz != null) {
  -                                     // there is a known binary class
  -                                     if (proxy) {
  -                                             // Just return a proxy. The proxy
  -                                             // will ask for a non-proxy later
  -                                             return getProxyClass(qualifiedName);
  -                                     }
  -                                     else {
  -                                             return getBinaryClass(clazz);
  -                                     }
  -                             }
  -                             else {
  -                                     // No known binary either. Last resort is
  -                                     // a source class
  -                                     File f = new File(_dir, 
qualifiedName.replace('.', '/') + ".java");
  -                                     if (f.exists()) {
  -                                             // The source exists. Let's parse it.
  -                                             if (proxy) {
  -                                                     return 
getProxyClass(qualifiedName);
  -                                             }
  -                                             else {
  -                                                     try {
  -                                                             return 
scan(qualifiedName);
  -                                                     } catch (XJavaDocException e1) 
{
  -                                                             throw new 
IllegalStateException("Error during parse:" + e1.getMessage());
  -                                                     }
  -                                             }
  -                                     }
  -                             }
  -                     }
  -             }
  -             return result;
  -     }
  -
  -
  -     /**
         * Describe what the method does
         *
         * @todo-javadoc Write javadocs for method
  @@ -374,7 +309,8 @@
   
   
        /**
  -      * Describe what the method does
  +      * This method is used if we're using the doclet functionality. Otherwise,
  +      * don't call this method.
         *
         * @exception XJavaDocException Describe the exception
         * @todo-javadoc Write javadocs for method
  @@ -390,8 +326,7 @@
                        String qualifiedName = _files[i].replace('/', '.');
                        qualifiedName = qualifiedName.replace('\\', '.');
                        qualifiedName = qualifiedName.substring(0, 
qualifiedName.length() - 5);
  -                     XClass clazz = scan(qualifiedName);
  -                     _sourceClasses.put(qualifiedName, clazz);
  +                     XClass clazz = scanAndPut(qualifiedName);
                }
                long end = System.currentTimeMillis();
                System.out.println("Scanned " + _sourceClasses.size() + " classes in " 
+ (end - start) + " milliseconds.");
  @@ -453,6 +388,83 @@
   
   
        /**
  +      * Get the XClass corresponding to the qualifiedName. This can be a class from
  +      * source, a precompiled class or a primitive. UnknownClass is never returned
  +      * from this method. If a class can't be resolved, null is returned.
  +      *
  +      * @param qualifiedName Describe what the parameter does
  +      * @param proxyIfNotCached Describe what the parameter does
  +      * @return The XClass value
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @pre qualifiedName != null
  +      */
  +     XClass getXClass(String qualifiedName, boolean proxyIfNotCached) {
  +             if (_dir == null) {
  +                     throw new IllegalStateException("setDir must pe called 
first!");
  +             }
  +             if (qualifiedName.equals("")) {
  +                     throw new IllegalStateException("Classname can't be empty 
String");
  +             }
  +             XClass result = null;
  +
  +             Primitive primitive;
  +             SourceClass sourceClass;
  +             BinaryClass binaryClass;
  +             UnknownClass unknownClass;
  +
  +             // first, check all caches regardless of whether or not a proxy is 
requested.
  +             if ((primitive = getPrimitive(qualifiedName)) != null) {
  +                     result = primitive;
  +             }
  +             else if ((sourceClass = 
(SourceClass)_sourceClasses.get(qualifiedName)) != null) {
  +                     result = sourceClass;
  +             }
  +             else if ((binaryClass = 
(BinaryClass)_binaryClasses.get(qualifiedName)) != null) {
  +                     result = binaryClass;
  +             }
  +             else if ((unknownClass = 
(UnknownClass)_unknownClasses.get(qualifiedName)) != null) {
  +                     result = unknownClass;
  +             }
  +             else {
  +                     // not found in any caches
  +                     if (proxyIfNotCached) {
  +                             // Return a proxy class since proxyIfNotCached is true
  +                             // The will ask for a non-proxy later
  +                             ProxyClass proxyClass = getProxyClass(qualifiedName);
  +                             result = proxyClass;
  +                     }
  +                     else {
  +                             // The real subject was requested (by a proxy class)
  +                             // Let's try to read the class from source
  +                             if (sourceExists(qualifiedName, false)) {
  +                                     // The source exists. Let's parse it.
  +                                     try {
  +                                             sourceClass = 
scanAndPut(qualifiedName);
  +                                             result = sourceClass;
  +                                     } catch (XJavaDocException e1) {
  +                                             throw new IllegalStateException("Error 
during parse:" + e1.getMessage());
  +                                     }
  +                             }
  +                             else {
  +                                     // Couldn't find the class among the sources.
  +                                     // Try a BinaryClass
  +                                     Class clazz = getClass(qualifiedName);
  +                                     if (clazz != null) {
  +                                             binaryClass = new BinaryClass(clazz);
  +                                             _binaryClasses.put(qualifiedName, 
binaryClass);
  +                                             result = binaryClass;
  +                                     }
  +                             }
  +                     }
  +             }
  +             String resultClass = (result == null ? "null" : 
result.getClass().getName());
  +             //_log.debug("getClass(" + qualifiedName + "," + proxyIfNotCached + ") 
--> " + resultClass);
  +             return result;
  +     }
  +
  +
  +     /**
         * @param qualifiedName Describe what the parameter does
         * @return The UnknownClass value
         * @todo-javadoc Write javadocs for method parameter
  @@ -489,57 +501,51 @@
   
   
        /**
  -      * Gets the ProxyClass attribute of the XJavaDoc object
  +      * Checks is the source exists
         *
  -      * @param qualifiedName Describe what the parameter does
  -      * @return The ProxyClass value
  -      * @todo-javadoc Write javadocs for method parameter
  -      */
  -     private ProxyClass getProxyClass(String qualifiedName) {
  -             if (qualifiedName.equals("")) {
  -                     throw new IllegalStateException("Classname can't be empty 
String");
  +      * @param qualifiedName the class to check for
  +      * @param checkCache optimisiation flag. avoids checking cache if that's
  +      *      already checked (as in getXClass())
  +      * @return true if source exists.
  +      */
  +     boolean sourceExists(String qualifiedName, boolean checkCache) {
  +             if (checkCache && _sourceClasses.get(qualifiedName) != null) {
  +                     return true;
                }
  -             ProxyClass result = (ProxyClass)_proxyClasses.get(qualifiedName);
  -             if (result == null) {
  -                     result = new ProxyClass(qualifiedName);
  -                     _proxyClasses.put(qualifiedName, result);
  +             else {
  +                     File f = new File(_dir, qualifiedName.replace('.', '/') + 
".java");
  +                     return f.exists();
                }
  -             return result;
        }
   
   
        /**
  -      * Returns the Class with the given name, or null if unknown.
  +      * Adds a source class to the cache. This method is also called from JavaParser
  +      * when parsing inner classes.
         *
  -      * @param qualifiedName Describe what the parameter does
  -      * @return The Class value
  -      * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for method parameter
  +      * @param sourceClass Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
         */
  -     private Class getClass(String qualifiedName) {
  -             try {
  -                     return Class.forName(qualifiedName);
  -             } catch (ClassNotFoundException e) {
  -                     return null;
  -             }
  +     void addSourceClass(SourceClass sourceClass) {
  +             _sourceClasses.put(sourceClass.qualifiedName(), sourceClass);
        }
   
   
        /**
  -      * Gets the BinaryClass attribute of the XJavaDoc object
  +      * Gets the ProxyClass attribute of the XJavaDoc object
         *
  -      * @param clazz Describe what the parameter does
  -      * @return The BinaryClass value
  -      * @todo-javadoc Write javadocs for method parameter
  +      * @param qualifiedName Describe what the parameter does
  +      * @return The ProxyClass value
         * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for exception
         */
  -     private BinaryClass getBinaryClass(Class clazz) {
  -             BinaryClass result = (BinaryClass)_binaryClasses.get(clazz);
  +     private ProxyClass getProxyClass(String qualifiedName) {
  +             if (qualifiedName.equals("")) {
  +                     throw new IllegalStateException("Classname can't be empty 
String");
  +             }
  +             ProxyClass result = (ProxyClass)_proxyClasses.get(qualifiedName);
                if (result == null) {
  -                     // Couldn't find the binary class in the cache. Try to 
instantiate it.
  -                     result = new BinaryClass(clazz);
  -                     _binaryClasses.put(clazz, result);
  +                     result = new ProxyClass(qualifiedName);
  +                     _proxyClasses.put(qualifiedName, result);
                }
                return result;
        }
  @@ -556,13 +562,17 @@
         * @todo-javadoc Write javadocs for return value
         * @todo-javadoc Write javadocs for exception
         */
  -     private XClass scan(String qualifiedName) throws XJavaDocException {
  +     private SourceClass scanAndPut(String qualifiedName) throws XJavaDocException {
                File f = null;
                f = new File(_dir, qualifiedName.replace('.', '/') + ".java");
                if (!f.exists()) {
                        throw new XJavaDocException("No source found for " + 
qualifiedName + " at " + f.getAbsolutePath());
                }
                SourceClass sourceClass = new SourceClass(null, qualifiedName, f);
  +             addSourceClass(sourceClass);
  +
  +             //sourceClass.parse();
  +
                ParseThread parseThread = new ParseThread(sourceClass);
                _parseThreads.add(parseThread);
                // We must wait here until the first part of the parsing is done.
  @@ -570,11 +580,14 @@
                synchronized (sourceClass.getParseLock()) {
                        parseThread.start();
                        try {
  +                             _log.debug("main thread waiting in scanAndPut() for " 
+ qualifiedName + " header to be parsed");
                                sourceClass.getParseLock().wait();
  +                             _log.debug("main thread waiting in scanAndPut() 
notified. " + qualifiedName + " header is parsed");
                        } catch (InterruptedException e) {
                                _log.debug("The scanning of " + qualifiedName + " has 
been interrupted");
                        }
                }
  +
                return sourceClass;
        }
   
  @@ -634,13 +647,30 @@
   
   
        /**
  +      * Returns the Class with the given name, or null if unknown.
  +      *
  +      * @param qualifiedName Describe what the parameter does
  +      * @return The Class value
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
  +     final static Class getClass(String qualifiedName) {
  +             try {
  +                     return Class.forName(qualifiedName);
  +             } catch (ClassNotFoundException e) {
  +                     return null;
  +             }
  +     }
  +
  +
  +     /**
         * Gets the Primitive attribute of the XJavaDoc class
         *
         * @param name Describe what the parameter does
         * @return The Primitive value
         * @todo-javadoc Write javadocs for method parameter
         */
  -     private static Primitive getPrimitive(String name) {
  +     static Primitive getPrimitive(String name) {
                return (Primitive)_primitiveClasses.get(name);
        }
   
  
  
  
  1.12      +6 -6      xjavadoc/src/xjavadoc/XDoc.java
  
  Index: XDoc.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XDoc.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -r1.11 -r1.12
  --- XDoc.java 24 Feb 2002 04:38:56 -0000      1.11
  +++ XDoc.java 1 Mar 2002 10:44:40 -0000       1.12
  @@ -144,13 +144,13 @@
                XTag[] tags = tags(tagName);
                XTag tag = null;
                if (tags.length == 0 || tags.length <= tagIndex) {
  -                     _log.debug("@" + tagName + " at index " + tagIndex + " doesn't 
exist. creating new tag");
  +                     //_log.debug("@" + tagName + " at index " + tagIndex + " 
doesn't exist. creating new tag");
                        // There was no such tags. Create a new one.
                        String tagValue = parameterName + "=\"" + parameterValue + 
"\"";
                        tag = addTag(tagName, tagValue);
   
                        tags = tags(tagName);
  -                     _log.debug("" + tags.length);
  +                     //_log.debug("" + tags.length);
                }
                else {
                        // (1)
  @@ -158,11 +158,11 @@
                        XTagParameter parameter = tag.getParameter(parameterName);
                        if (parameter == null) {
                                // parameter doesn't exist. Create it.
  -                             _log.debug("@" + tagName + " " + parameterName + " at 
index " + tagIndex + " doesn't exist. creating new tag parameter");
  +                             //_log.debug("@" + tagName + " " + parameterName + " 
at index " + tagIndex + " doesn't exist. creating new tag parameter");
                                parameter = tag.addTagParameter(parameterName, 
parameterValue);
                        }
                        else {
  -                             _log.debug("@" + tagName + " " + parameterName + " at 
index " + tagIndex + " exists. updating tag parameter");
  +                             //_log.debug("@" + tagName + " " + parameterName + " 
at index " + tagIndex + " exists. updating tag parameter");
                                // parameter exists. Modify it.
                                parameter.setValue(parameterValue);
                        }
  @@ -368,7 +368,7 @@
         * @todo-javadoc Describe the method parameter
         */
        public XTag addTag(String tagName, String text) {
  -             _log.debug("addTag: @" + tagName + " " + text);
  +             //_log.debug("addTag: @" + tagName + " " + text);
                ArrayList tags = (ArrayList)_tagMap.get(tagName);
                if (tags == null) {
                        tags = new ArrayList();
  @@ -456,7 +456,7 @@
         * @todo-javadoc Write javadocs for method parameter
         */
        private void parse() {
  -             _log.debug("parse");
  +             //_log.debug("parse");
                // We must read line by line, since a @tags can only begin as the 
first token of a line.
                BufferedReader in = new BufferedReader(new JavaDocReader(new 
StringReader(_javadocToken.image)));
   
  
  
  
  1.12      +116 -135  xjavadoc/src/xjavadoc/SourceClass.java
  
  Index: SourceClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/SourceClass.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -r1.11 -r1.12
  --- SourceClass.java  25 Feb 2002 18:40:29 -0000      1.11
  +++ SourceClass.java  1 Mar 2002 10:44:40 -0000       1.12
  @@ -92,6 +92,7 @@
                super(containingClass, qualifiedName);
                // We need to check if sourceFile is null. All inner classes will have 
it set to null
                if (sourceFile != null) {
  +                     //_log.debug("A normal source class:" + qualifiedName);
                        addImportedPackage("java.lang");
                        try {
                                Reader in = new FileReader(sourceFile);
  @@ -110,7 +111,6 @@
         * @param compilationUnit The new CompilationUnit value
         */
        public void setCompilationUnit(SimpleNode compilationUnit) {
  -//   public void setCompilationUnit(ASTCompilationUnit compilationUnit) {
                _compilationUnit = compilationUnit;
        }
   
  @@ -124,6 +124,8 @@
                if (containingClass() != null) {
                        setQualifiedName(containingClass().qualifiedName() + "." + 
name);
                        name = containingClass().name() + "." + name;
  +
  +                     System.out.println("INNER:" + name);
                }
   
                super.setName(name);
  @@ -179,12 +181,18 @@
         * @throws IOException if the file couldn't be saved
         */
        public String save(File rootDir) throws IOException {
  -             String fileName = fileName();
  -             File javaFile = new File(rootDir, fileName());
  +             if (containingClass() != null) {
  +                     // inner class. can't save these.
  +                     throw new UnsupportedOperationException("Can't save inner 
classes");
  +             }
  +             else {
  +                     String fileName = fileName(qualifiedName());
  +                     File javaFile = new File(rootDir, fileName);
                javaFile.getParentFile().mkdirs();
                print(new PrintStream(new FileOutputStream(javaFile)));
                return fileName;
        }
  +     }
   
   
        /**
  @@ -200,14 +208,9 @@
         */
        public XClass qualify(final String unqualifiedClassName) {
                XClass result = null;
  +             if (containingClass() == null) {
                String qualifiedClassName = null;
   
  -             // A sanity check we can take away when properly tested
  -             int bracketIndex = unqualifiedClassName.indexOf('[');
  -             if (bracketIndex != -1) {
  -                     throw new IllegalStateException("Brackets should have been 
stripped away!");
  -             }
  -
                // If there are dots, consider it to be qualified
                int dot_index = unqualifiedClassName.indexOf('.');
                if (dot_index != -1) {
  @@ -218,32 +221,37 @@
                }
                else {
                        // There are no dots in the class name. It's a primitive or 
unqualified.
  -                     // if it's a primitive, don't qualify.
  -                     result = isUnqualifiedNameAPrimitiveType(unqualifiedClassName, 
result);
  -                     if (result != null) {
  -                             return result;
  +                             Primitive primitive;
  +
  +                             if ((primitive = 
XJavaDoc.getPrimitive(unqualifiedClassName)) != null) {
  +                                     result = primitive;
                        }
  -                     result = 
isUnqualifiedNameInTheSamePackage(unqualifiedClassName, result);
  -                     result = 
isUnqualifiedNameInImportedClasses(unqualifiedClassName, result);
  -                     if (result != null) {
  -                             return result;
  +                             else {
  +                                     String qualifiedName;
  +                                     if ((qualifiedName = 
qualifiedNameInImportedClasses(unqualifiedClassName)) != null) {
  +                                             result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
                        }
  -                     result = 
isUnqualifiedNameInImportedPackages(unqualifiedClassName, result);
  -                     result = 
isUnqualifiedNameInJavaLangPackage(unqualifiedClassName, result);
  +                                     else if ((qualifiedName = 
qualifiedNameInImportedPackages(unqualifiedClassName)) != null) {
  +                                             result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
                }
  -             if (result == null) {
  -                     // We'll get here when we use inner classes and nonexisting 
classes
  -                     //throw new IllegalStateException("In class " + 
qualifiedName() + ": Couldn't resolve the unqualified class: " + unqualifiedClassName);
  -
  -                     // Until we fix inner classes...
  -                     return new UnknownClass(unqualifiedClassName);
  +                                     else if ((qualifiedName = 
qualifiedNameInTheSamePackage(unqualifiedClassName)) != null) {
  +                                             result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
  +                                     }
  +                                     else {
  +                                             result = new 
UnknownClass(unqualifiedClassName);
  +                                     }
  +                             }
  +                     }
  +             }
  +             else {
  +                     result = containingClass().qualify(unqualifiedClassName);
                }
                return result;
        }
   
   
        /**
  -      * Describe what the method does
  +      * Completes the parsing of the class
         *
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
  @@ -251,178 +259,151 @@
        protected void complete() {
                if (containingClass() == null) {
                        if (!_isParseCompleted) {
  +
                                // wake up the waiting parser thread
  +                             _log.debug("parse thread " + qualifiedName() + " 
completing. entering synchronized block...");
                                synchronized (getParseLock()) {
  +                                     _log.debug("parse thread " + qualifiedName() + 
" inside synchronized block. notifying main thread waiting in scanAndPut()");
                                        getParseLock().notify();
  -
  -                                     // and wait until it's done with the rest
  +                             }
  +                             synchronized (getParseLock()) {
  +                                     /// and wait until it's done with the rest
                                        try {
                                                getParseLock().wait();
                                        } catch (InterruptedException e) {
                                                _log.debug("The complete() of " + 
qualifiedName() + " has been interrupted");
                                        }
                                }
  -                             _isParseCompleted = true;
  -                     }
  -             }
  -     }
  -
   
  -     /**
  -      * Gets the UnqualifiedNameAPrimitiveType attribute of the SourceClass object
  -      *
  -      * @param unqualifiedClassName Describe what the parameter does
  -      * @param result Describe what the parameter does
  -      * @return The UnqualifiedNameAPrimitiveType value
  -      * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for method parameter
  -      */
  -     private XClass isUnqualifiedNameAPrimitiveType(String unqualifiedClassName, 
XClass result) {
  -             if (XJavaDoc.PRIMITIVES.contains(unqualifiedClassName)) {
  -                     String qualifiedClassName = unqualifiedClassName;
  -                     result = XJavaDoc.getInstance().getXClass(qualifiedClassName, 
false);
  -                     if (result == null) {
  -                             throw new IllegalStateException(qualifiedClassName + " 
supposed to be a primitive!");
  +                             _isParseCompleted = true;
                        }
                }
  -             return result;
        }
   
   
        /**
  -      * Gets the UnqualifiedNameInImportedClasses attribute of the SourceClass
  -      * object
  -      *
         * @param unqualifiedClassName Describe what the parameter does
  -      * @param result Describe what the parameter does
         * @return The UnqualifiedNameInImportedClasses value
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     private XClass isUnqualifiedNameInImportedClasses(String unqualifiedClassName, 
XClass result) {
  +     private final String qualifiedNameInImportedClasses(final String 
unqualifiedClassName) {
   
                if (!hasImportedClasses()) {
  -                     return result;
  +                     return null;
                }
   
  -             String suffix = "." + unqualifiedClassName;
  -
  +             final String suffix = "." + unqualifiedClassName;
  +             String candidate = null;
                for (int i = 0; i < getImportedClassCount(); i++) {
  -                     String importedClassName = getImportedClassName(i);
  +                     String qualifiedClassName = getImportedClassName(i);
   
  -                     if (importedClassName.endsWith(suffix)) {
  -                             // We've found a candidate. Get a proxy for it.
  -                             XClass clazz = 
XJavaDoc.getInstance().getXClass(importedClassName, true);
  -                             if (clazz != null && result != null && result != 
clazz) {
  -                                     throw new IllegalStateException("In class " + 
qualifiedName() + ": Ambiguous class:" + unqualifiedClassName);
  -                             }
  -                             if (clazz != null) {
  -                                     result = clazz;
  +                     if (qualifiedClassName.endsWith(suffix)) {
  +                             // We've found a candidate. See if source or binary is 
available.
  +                             if (candidateExists(qualifiedClassName)) {
  +                                     if (candidate != null) {
  +                                             // ambiguous class import
  +                                             throw new IllegalStateException("In 
class " + qualifiedName() + ": Ambiguous class:" + unqualifiedClassName + ". Is it " + 
candidate + " or " + qualifiedClassName + "?");
                                }
                                else {
  -                                     // found an import match, but couldn't find 
the class
  -                                     result = 
XJavaDoc.getInstance().getUnknownClass(unqualifiedClassName);
  +                                             candidate = qualifiedClassName;
                                }
                        }
                }
  -
  -             return result;
  +             }
  +             return candidate;
        }
   
   
        /**
  -      * Gets the UnqualifiedNameInImportedPackages attribute of the SourceClass
  -      * object
  +      * Describe what the method does
         *
         * @param unqualifiedClassName Describe what the parameter does
  -      * @param result Describe what the parameter does
  -      * @return The UnqualifiedNameInImportedPackages value
  -      * @todo-javadoc Write javadocs for method parameter
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for return value
         */
  -     private XClass isUnqualifiedNameInImportedPackages(String 
unqualifiedClassName, XClass result) {
  +     private final String qualifiedNameInImportedPackages(final String 
unqualifiedClassName) {
   
                if (!hasImportedPackages()) {
  -                     return result;
  +                     return null;
                }
   
  -             String suffix = "." + unqualifiedClassName;
  -
  +             final String suffix = "." + unqualifiedClassName;
  +             String candidate = null;
                for (int i = 0; i < getImportedPackageCount(); i++) {
  -                     String importedPackageName = getImportedPackageName(i);
  +                     String qualifiedClassName = getImportedPackageName(i) + suffix;
   
  -                     String qualifiedClassName = importedPackageName + "." + 
unqualifiedClassName;
  -                     XClass clazz = 
XJavaDoc.getInstance().getXClass(qualifiedClassName, true);
  -
  -                     if (result != null && clazz != null && result != clazz) {
  -                             throw new IllegalStateException("In class " + 
qualifiedName() + ": Ambiguous class:" + unqualifiedClassName);
  +                     if (candidateExists(qualifiedClassName)) {
  +                             if (candidate != null) {
  +                                     // ambiguous class import
  +                                     throw new IllegalStateException("In class " + 
qualifiedName() + ": Ambiguous class:" + unqualifiedClassName + ". Is it " + candidate 
+ " or " + qualifiedClassName + "?");
                        }
  -
  -                     if (clazz != null) {
  -                             result = clazz;
  +                             else {
  +                                     candidate = qualifiedClassName;
                        }
                }
  -
  -             return result;
  +             }
  +             return candidate;
        }
   
   
        /**
  -      * Gets the UnqualifiedNameInTheSamePackage attribute of the SourceClass object
  +      * Describe what the method does
         *
         * @param unqualifiedClassName Describe what the parameter does
  -      * @param result Describe what the parameter does
  -      * @return The UnqualifiedNameInTheSamePackage value
  -      * @todo-javadoc Write javadocs for method parameter
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for return value
         */
  -     private XClass isUnqualifiedNameInTheSamePackage(String unqualifiedClassName, 
XClass result) {
  +     private final String qualifiedNameInTheSamePackage(final String 
unqualifiedClassName) {
                String qualifiedClassName = containingPackage().name() + "." + 
unqualifiedClassName;
  -             XClass clazz = XJavaDoc.getInstance().getXClass(qualifiedClassName, 
true);
  -             if (result != null && clazz != null && result != clazz) {
  -                     throw new IllegalStateException("In class " + qualifiedName() 
+ ": Ambiguous class:" + unqualifiedClassName + " " + result.qualifiedName() + " or " 
+ clazz.qualifiedName() + " ?");
  +             if (candidateExists(qualifiedClassName)) {
  +                     return qualifiedClassName;
                }
  -             if (clazz != null) {
  -                     result = clazz;
  +             else {
  +                     return null;
                }
  -             return result;
        }
   
   
        /**
  -      * Gets the UnqualifiedNameInJavaLangPackage attribute of the SourceClass
  -      * object
  +      * Describe what the method does
         *
  -      * @param unqualifiedClassName Describe what the parameter does
  -      * @param result Describe what the parameter does
  -      * @return The UnqualifiedNameInJavaLangPackage value
  +      * @param qualifiedClassName Describe what the parameter does
  +      * @return Describe the return value
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for return value
         */
  -     private XClass isUnqualifiedNameInJavaLangPackage(String unqualifiedClassName, 
XClass result) {
  -             String qualifiedClassName = "java.lang." + unqualifiedClassName;
  -             XClass clazz = XJavaDoc.getInstance().getXClass(qualifiedClassName, 
true);
  -             if (result != null && clazz != null && result != clazz) {
  -                     throw new IllegalStateException("In class " + qualifiedName() 
+ ": Ambiguous class:" + unqualifiedClassName);
  +     private final boolean candidateExists(final String qualifiedClassName) {
  +             boolean candidateExists = false;
  +             if (XJavaDoc.getInstance().sourceExists(qualifiedClassName, true)) {
  +                     return true;
                }
  -             if (clazz != null) {
  -                     result = clazz;
  +             else if (XJavaDoc.getClass(qualifiedClassName) != null) {
  +                     return true;
  +             }
  +             else {
  +                     return false;
                }
  -             return result;
        }
   
   
        /**
         * Describe what the method does
         *
  +      * @param qualifiedName Describe what the parameter does
         * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     private String fileName() {
  -             XPackage pakkage = containingPackage();
  -             String packageName = pakkage.name();
  -             return packageName.replace('.', File.separatorChar) + 
File.separatorChar + name() + ".java";
  +     public static String fileName(String qualifiedName) {
  +             return qualifiedName.replace('.', File.separatorChar) + ".java";
        }
   }
   
  
  
  
  1.3       +2 -0      xjavadoc/src/xjavadoc/SimpleNode.java
  
  Index: SimpleNode.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/SimpleNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- SimpleNode.java   22 Feb 2002 20:22:30 -0000      1.2
  +++ SimpleNode.java   1 Mar 2002 10:44:40 -0000       1.3
  @@ -61,6 +61,8 @@
         */
        protected JavaParser parser;
        /**
  +      * This comment is not shared among first and last
  +      *
         * @todo-javadoc Describe the field
         */
        protected Token first, last;
  
  
  
  1.7       +17 -2     xjavadoc/src/xjavadoc/ProxyClass.java
  
  Index: ProxyClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/ProxyClass.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- ProxyClass.java   24 Feb 2002 20:33:50 -0000      1.6
  +++ ProxyClass.java   1 Mar 2002 10:44:40 -0000       1.7
  @@ -195,6 +195,21 @@
        /**
         * Describe what the method does
         *
  +      * @param o Describe what the parameter does
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public int compareTo(Object o) {
  +             XProgramElement other = (XProgramElement)o;
  +             return qualifiedName().compareTo(other.qualifiedName());
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
         * @return Describe the return value
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
  @@ -242,7 +257,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public XClass containingClass() {
  -             //resolve();
  +             resolve();
                return _subject.containingClass();
        }
   
  @@ -281,7 +296,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public XPackage containingPackage() {
  -             //resolve();
  +             resolve();
                return _subject.containingPackage();
        }
   
  
  
  
  1.7       +12 -1     xjavadoc/src/xjavadoc/Primitive.java
  
  Index: Primitive.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/Primitive.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- Primitive.java    24 Feb 2002 04:38:56 -0000      1.6
  +++ Primitive.java    1 Mar 2002 10:44:40 -0000       1.7
  @@ -56,7 +56,18 @@
        public Primitive(String name) {
                super(null, name);
                setName(name);
  -             setContainingPackage(null);
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public XPackage containingPackage() {
  +             return null;
        }
   
   
  
  
  
  1.4       +11 -11    xjavadoc/src/xjavadoc/FieldImpl.java
  
  Index: FieldImpl.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/FieldImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- FieldImpl.java    22 Feb 2002 18:14:49 -0000      1.3
  +++ FieldImpl.java    1 Mar 2002 10:44:40 -0000       1.4
  @@ -41,7 +41,7 @@
    * @author Ara Abrahamian ([EMAIL PROTECTED])
    * @author <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
    * @created Feb 15, 2002
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   class FieldImpl extends AbstractProgramElement implements XField {
   
  @@ -91,16 +91,6 @@
   
   
        /**
  -      * Gets the Type attribute of the FieldImpl object
  -      *
  -      * @return The Type value
  -      */
  -     public String getType() {
  -             return _type;
  -     }
  -
  -
  -     /**
         * Gets the TypeDimension attribute of the FieldImpl object
         *
         * @return The TypeDimension value
  @@ -127,6 +117,16 @@
         */
        public final boolean isVolatile() {
                return (modifierSpecifier() & Modifier.VOLATILE) != 0;
  +     }
  +
  +
  +     /**
  +      * The type as String. Required for badProgrammingStyleFieldImpl in the grammar
  +      *
  +      * @return The Type value
  +      */
  +     public String getType() {
  +             return _type;
        }
   
   
  
  
  
  1.4       +4 -4      xjavadoc/src/xjavadoc/DefaultXTag.java
  
  Index: DefaultXTag.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/DefaultXTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- DefaultXTag.java  20 Feb 2002 00:12:01 -0000      1.3
  +++ DefaultXTag.java  1 Mar 2002 10:44:40 -0000       1.4
  @@ -72,7 +72,7 @@
        /**
         * Get static reference to Log4J Logger
         */
  -     private static org.apache.log4j.Category _log = 
org.apache.log4j.Category.getInstance(XTag.class.getName());
  +     private static org.apache.log4j.Category _log = 
org.apache.log4j.Category.getInstance(DefaultXTag.class.getName());
   
   
        /**
  @@ -318,7 +318,7 @@
                                i++;
                        }
                        else {
  -                             _log.debug("Error in @tag: \" sign expected but 
something different found, @tags=" + value);
  +                             //_log.debug("Error in @tag: \" sign expected but 
something different found, @tags=" + value);
                                return;
                        }
   
  @@ -342,7 +342,7 @@
                                                        }
                                                        else {
                                                                //probably user does 
not know escaping is needed!
  -                                                             _log.debug("Error in 
@tag: to put \" in a parameter value you need to escape \" character with \\\", 
@tags=" + value);
  +                                                             //_log.debug("Error in 
@tag: to put \" in a parameter value you need to escape \" character with \\\", 
@tags=" + value);
                                                                return;
                                                        }
                                                }
  @@ -371,7 +371,7 @@
                                i++;
                        }
                        else {
  -                             _log.warn("Error in @tag: tailing \" sign expected but 
not found, @tags=" + value);
  +                             //_log.warn("Error in @tag: tailing \" sign expected 
but not found, @tags=" + value);
                                return;
                        }
   
  
  
  
  1.4       +0 -1      xjavadoc/src/xjavadoc/ConstructorImpl.java
  
  Index: ConstructorImpl.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/ConstructorImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- ConstructorImpl.java      22 Feb 2002 20:22:30 -0000      1.3
  +++ ConstructorImpl.java      1 Mar 2002 10:44:40 -0000       1.4
  @@ -62,7 +62,6 @@
         */
        public ConstructorImpl(XClass containingClass, String qualifiedName) {
                super(containingClass, qualifiedName);
  -             setName(containingClass().name());
                instanceCount++;
        }
   
  
  
  
  1.5       +15 -14    xjavadoc/src/xjavadoc/AbstractProgramElement.java
  
  Index: AbstractProgramElement.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/AbstractProgramElement.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- AbstractProgramElement.java       24 Feb 2002 20:44:49 -0000      1.4
  +++ AbstractProgramElement.java       1 Mar 2002 10:44:40 -0000       1.5
  @@ -35,10 +35,6 @@
    */
   package xjavadoc;
   
  -import xjavadoc.Token;
  -import xjavadoc.JavaParserConstants;
  -import xjavadoc.SimpleNode;
  -
   import java.lang.reflect.Modifier;
   
   /**
  @@ -131,16 +127,6 @@
   
   
        /**
  -      * Sets the QualifiedName attribute of the AbstractProgramElement object
  -      *
  -      * @return The Final value
  -      */
  -     //public final void setQualifiedName(String qualifiedName) {
  -     //      _qualifiedName = qualifiedName;
  -     //}
  -
  -
  -     /**
         * Gets the Final attribute of the AbstractProgramElement object
         *
         * @return The Final value
  @@ -197,6 +183,21 @@
         */
        public final boolean isStatic() {
                return (_modifiers & Modifier.STATIC) != 0;
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @param o Describe what the parameter does
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public int compareTo(Object o) {
  +             XProgramElement other = (XProgramElement)o;
  +             return qualifiedName().compareTo(other.qualifiedName());
        }
   
   
  
  
  
  1.10      +35 -64    xjavadoc/src/xjavadoc/AbstractClass.java
  
  Index: AbstractClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/AbstractClass.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -r1.9 -r1.10
  --- AbstractClass.java        25 Feb 2002 01:03:10 -0000      1.9
  +++ AbstractClass.java        1 Mar 2002 10:44:40 -0000       1.10
  @@ -35,8 +35,6 @@
    */
   package xjavadoc;
   
  -import xjavadoc.XPackage;
  -
   import java.lang.reflect.Modifier;
   import java.util.*;
   import java.io.IOException;
  @@ -115,15 +113,16 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     private boolean _isInterface;
  +     private XPackage _xcontainingPackage;
  +
        /**
         * @todo-javadoc Describe the field
         */
  -     private String _superclass;
  +     private boolean _isInterface;
        /**
         * @todo-javadoc Describe the field
         */
  -     private String _containingPackage = "";
  +     private String _superclass;
        /**
         * @todo-javadoc Describe the field
         */
  @@ -170,10 +169,21 @@
         *
         * @param containingPackage The new ContainingPackage value
         */
  -     public void setContainingPackage(String containingPackage) {
  -             if (containingPackage != null) {
  -                     _containingPackage = containingPackage;
  +     public final void setContainingPackage(String containingPackage) {
  +             // Do a sanity check
  +             String packageName = null;
  +             int lastDotIndex = qualifiedName().lastIndexOf('.');
  +             if (lastDotIndex == -1) {
  +                     // default package
  +                     packageName = "";
  +             }
  +             else {
  +                     packageName = qualifiedName().substring(0, lastDotIndex);
  +             }
  +             if (!packageName.equals(containingPackage)) {
  +                     throw new IllegalStateException("Package mismatch. In source: 
" + containingPackage + ", from class name/file name: " + packageName);
                }
  +             _xcontainingPackage = 
XJavaDoc.getInstance().addPackageMaybe(packageName);
        }
   
   
  @@ -188,7 +198,6 @@
        }
   
   
  -
        /**
         * Sets the SuperClass attribute of the SourceClass object
         *
  @@ -269,11 +278,12 @@
        /**
         * Returns an XField with the given name. Example: getField("id");
         *
  -      * @param filedName Describe what the parameter does
  +      * @param fieldName Describe what the parameter does
         * @return The Field value
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         */
  -     public final XField getField(String filedName) {
  +     public final XField getField(String fieldName) {
   
                if (_fields == null) {
                        return null;
  @@ -282,7 +292,7 @@
                for (int i = 0; i < _fields.size(); i++) {
                        XField field = (XField)_fields.get(i);
   
  -                     if (field.name().equals(filedName)) {
  +                     if (field.name().equals(fieldName)) {
                                return field;
                        }
                }
  @@ -332,43 +342,23 @@
                        _interfaces = new ArrayList();
                }
                _interfaces.add(interfaceName);
  -
  -             /*
  -              *  StringTokenizer st = new StringTokenizer(nameList, ",");
  -              *  _xinterfaces = new Object[st.countTokens()];
  -              *  int i = 0;
  -              *  while (st.hasMoreTokens()) {
  -              *  _xinterfaces[i] = st.nextToken();
  -              *  i++;
  -              *  }
  -              */
  -             /*
  -              *  XClass interfaze = qualify(implementedInterface);
  -              *  _interfaces.add(interfaze);
  -              *  _interfaces.addAll(Arrays.asList(interfaze.interfaces()));
  -              *  /_log.debug("ADD INTERFACE: " + implementedInterface + " to " + 
qualifiedName());
  -              *  /_log.debug("-------------> " + interfaze.qualifiedName());
  -              *  for (int i = interfaze.interfaces().length - 1; i >= 0; i--) {
  -              *  /_log.debug("-------------> " + 
interfaze.interfaces()[i].qualifiedName());
  -              *  }
  -              */
        }
   
   
        /**
         * Describe what the method does
         *
  +      * @todo handle primitives. (But nobody will ask for a primitive's package I
  +      *      hope)
         * @return Describe the return value
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
        public XPackage containingPackage() {
  -             if (_containingPackage != null) {
  -                     return 
XJavaDoc.getInstance().addPackageMaybe(_containingPackage);
  -             }
  -             else {
  -                     return null;
  +             if (_xcontainingPackage == null) {
  +                     _xcontainingPackage = 
XJavaDoc.getInstance().addPackageMaybe("");
                }
  +             return _xcontainingPackage;
        }
   
   
  @@ -392,6 +382,7 @@
                                String imported_class = 
(String)_importedClasses.get(i);
                                _ximportedClasses[i] = qualify(imported_class);
                        }
  +                     Arrays.sort(_ximportedClasses);
                }
   
                return _ximportedClasses;
  @@ -417,6 +408,7 @@
                        for (int i = 0; i < _innerClasses.size(); i++) {
                                _xinnerClasses[i] = (XClass)_innerClasses.get(i);
                        }
  +                     //Arrays.sort(_xinnerClasses);
                }
   
                return _xinnerClasses;
  @@ -443,6 +435,7 @@
                                String imported_package = 
(String)_importedPackages.get(i);
                                _ximportedPackages[i] = 
XJavaDoc.getInstance().addPackageMaybe(imported_package);
                        }
  +                     //Arrays.sort(_ximportedPackages);
                }
   
                return _ximportedPackages;
  @@ -464,6 +457,7 @@
                if (_xmethods == null) {
                        _xmethods = new XMethod[_methods.size()];
                        _xmethods = (XMethod[])_methods.toArray(_xmethods);
  +                     Arrays.sort(_xmethods);
                }
                return _xmethods;
        }
  @@ -484,6 +478,7 @@
                if (_xfields == null) {
                        _xfields = new XField[_fields.size()];
                        _xfields = (XField[])_fields.toArray(_xfields);
  +                     Arrays.sort(_xfields);
                }
   
                return _xfields;
  @@ -521,6 +516,7 @@
   
                        _xconstructors = new XConstructor[_constructors.size()];
                        _xconstructors = 
(XConstructor[])_constructors.toArray(_xconstructors);
  +                     Arrays.sort(_xconstructors);
                }
   
                return _xconstructors;
  @@ -546,19 +542,6 @@
                        }
                }
                return _xinterfaces;
  -             /*
  -              *  if (_xinterfaces == null) {
  -              *  return ZERO_CLASSES;
  -              *  }
  -              *  /elements of the array may be Strings so iterate and convert them 
to XClass
  -              *  for (int i = 0; i < _xinterfaces.length; i++) {
  -              *  Object xinterface = _xinterfaces[i];
  -              *  if (xinterface instanceof String) {
  -              *  _xinterfaces[i] = qualify((String)xinterface);
  -              *  }
  -              *  }
  -              *  return (XClass[])_xinterfaces;
  -              */
        }
   
   
  @@ -649,19 +632,6 @@
         *
         * @return Describe the return value
         * @todo-javadoc Write javadocs for method
  -      * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for return value
  -      */
  -//   public int compareTo(Object o) {
  -//           return name().compareTo(((XClass)o).name());
  -//   }
  -
  -
  -     /**
  -      * Describe what the method does
  -      *
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
        public final String toString() {
  @@ -743,7 +713,8 @@
                }
   
                _methods.add(method);
  -             _namedMethods.put(method.name() + method.signature(), method);
  +             String methodWithSignature = method.name() + method.signature();
  +             _namedMethods.put(methodWithSignature, method);
        }
   
   
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to