classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: gjdoc import ordering fix


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: gjdoc import ordering fix
Date: 01 Jul 2005 12:33:40 -0600

I'm checking this in.

gjdoc processes imports in the wrong order.  In particular it searches
java.lang.* first, followed by the current package, and only then
followed by any explicit imports.

This patch fixes the bug by deferring the addition of the package and
java.lang.* imports until after all the other import statements have
been processed.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * src/gnu/classpath/tools/gjdoc/Parser.java
        (PackageComponent.process): Don't add to importedStatementList.
        (processSourceFile): Don't add java.lang.* to
        importedStatementList.
        (classOpened): Update importedStatementList here.

Index: src/gnu/classpath/tools/gjdoc/Parser.java
===================================================================
RCS file: /cvsroot/classpath/gjdoc/src/gnu/classpath/tools/gjdoc/Parser.java,v
retrieving revision 1.24
diff -u -r1.24 Parser.java
--- src/gnu/classpath/tools/gjdoc/Parser.java 18 May 2005 11:52:31 -0000 1.24
+++ src/gnu/classpath/tools/gjdoc/Parser.java 1 Jul 2005 18:36:20 -0000
@@ -1,5 +1,5 @@
 /* gnu.classpath.tools.gjdoc.Parser
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
 
    This file is part of GNU Classpath.
 
@@ -208,7 +208,6 @@
       int process(Parser parser, char[] source, int startIndex, int endIndex) {
         String packageName=new 
String(source,startIndex+8,endIndex-startIndex-8-1).trim();
         parser.packageOpened(packageName);
-         parser.importedStatementList.add(packageName + ".*");
         return endIndex;
       }
    }
@@ -733,7 +732,6 @@
       importedStringList.clear();
       importedPackagesList.clear();
       importedStatementList.clear();
-      importedStatementList.add("java.lang.*");
       
       currentLine = 1;
 
@@ -841,6 +839,10 @@
          }
       }
 
+      if (currentPackageName != null)
+        importedStatementList.add(currentPackageName + ".*");
+      importedStatementList.add("java.lang.*");
+
       ClassDocImpl classDoc
         = ClassDocImpl.createInstance((ctx!=null)?(ctx.classDoc):null, 
currentPackage, 
                                       null,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]