With a patch to compile libjava on a per-directory basis, I found a bug with 
imports

Take file AWTEvent.java

   package java.awt;
   import java.util.EventObject;
   public abstract class AWTEvent extends EventObject {}

and file B.java

   package java.awt;
   import java.awt.event.ComponentEvent;
   public class B {
     Object[] o = ComponentEvent.class.getFields();
   }

When processing ComponentEvent in B.java, it finds AWTEvent (the superclass of
ComponentEvent) but it cannot resolve the EventObject class there.  That's
because java_complete_class was not called yet for AWTEvent, and its
TYPE_IMPORTS_LIST is not set yet.

If I move the setting of TYPE_IMPORS_LIST to create_class, then in
maybe_layout_super_class another bug is hit and the TYPE_IMPORTS_LIST of
AWTEvent is not used to resolve the EventObject class.  I have a patch to fix
all this but I have not tested it yet, and it does not allow anyway to finish
bootstrap with per-directory builds.  I suspect a (theoretically) simpler fix is
to call java_complete_class earlier (at least once per file), but I am not sure
about what java_complete_class is doing at all.

Paolo

-- 
           Summary: imports not remembered for previously compiled files
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21436

Reply via email to