This patch fixes a gjdoc bug we ran into while building Eclipse 3.1.
I'm not checking it in yet as I am not a gjdoc expert; I'd rather
someone else look it over first.

Consider this code:

package z;
/** hi jane */
public class base extends der {}

package z;
import p.base;
/** hi bob */
public class der extends base {}


Note that there is no visible 'p.base'.  If you run gjdoc on this, it
will hang, because it thinks the 'base' in z/der.java refers to
z/base.java -- which it does not.

This patch fixes the problem by changing not-found single-type imports
to return a result when match() is called.

Tom

Index: ChangeLog
from  Tom Tromey  <[EMAIL PROTECTED]>
        * src/gnu/classpath/tools/gjdoc/RootDocImpl.java
        (ResolvedImportNotFound.name): New field.
        (ResolvedImportNotFound): Initialize it.
        (ResolvedImportNotFound.match): Implemented.

Index: src/gnu/classpath/tools/gjdoc/RootDocImpl.java
===================================================================
RCS file: 
/cvsroot/classpath/gjdoc/src/gnu/classpath/tools/gjdoc/RootDocImpl.java,v
retrieving revision 1.22
diff -u -r1.22 RootDocImpl.java
--- src/gnu/classpath/tools/gjdoc/RootDocImpl.java 18 May 2005 11:52:30 -0000 
1.22
+++ src/gnu/classpath/tools/gjdoc/RootDocImpl.java 1 Jul 2005 18:45:52 -0000
@@ -664,10 +664,18 @@
       implements ResolvedImport
    {
       private String importSpecifier;
+      private String name;
 
       ResolvedImportNotFound(String importSpecifier)
       {
          this.importSpecifier = importSpecifier;
+         int ndx = importSpecifier.lastIndexOf('.');
+         if (ndx >= 0) {
+            this.name = importSpecifier.substring(ndx + 1);
+         }
+         else {
+            this.name = importSpecifier;
+         }
       }
 
       public String toString()
@@ -677,7 +685,10 @@
 
       public String match(String name)
       {
-         return null; // FIXME!
+        if (name.equals(this.name))
+           return this.name;
+        // FIXME: note that we don't handle on-demand imports here.
+         return null;
       }
 
       public boolean mismatch(String name)


_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to