parse.y (process_imports): Consider that one might be trying to import an innerclass.
authorAlexandre Petit-Bianco <apbianco@cygnus.com>
Thu, 19 Oct 2000 07:51:54 +0000 (07:51 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Thu, 19 Oct 2000 07:51:54 +0000 (00:51 -0700)
2000-07-19  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * parse.y (process_imports): Consider that one might be trying to
        import an innerclass. Fixes gcj/254

(http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00631.html)

From-SVN: r36948

gcc/java/ChangeLog
gcc/java/parse.y

index ea73dc4a1c2d6f86c401d1ab5937b3a0ef016cd5..191b20930e865e3fd0b7f373e32ea7ea447523d2 100644 (file)
@@ -669,6 +669,11 @@ Sun Aug  6 00:47:24 2000  Ovidiu Predescu  <ovidiu@cup.hp.com>
        * parse.h (SET_TYPE_FOR_RESOLUTION): Use GET_CPC.
        * parse.y (method_header): Likewise.
 
+2000-07-19  Alexandre Petit-Bianco  <apbianco@cygnus.com>
+
+       * parse.y (process_imports): Consider that one might be trying to
+       import an innerclass. Fixes gcj/254
+
 2000-07-19  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
        * parse.y (find_as_inner_class): Handle the case where the
index b3c2d87cba717bf8efa39a95205621792306bec7..15426246734bb05ed516eb20340548c943d43ff0 100644 (file)
@@ -6492,10 +6492,29 @@ process_imports ()
       /* Don't load twice something already defined. */
       if (IDENTIFIER_CLASS_VALUE (to_be_found))
        continue;
-      QUALIFIED_P (to_be_found) = 1;
-      load_class (to_be_found, 0);
-      error_found =
-       check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
+      
+      while (1)
+       {
+         tree left;
+
+         QUALIFIED_P (to_be_found) = 1;
+         load_class (to_be_found, 0);
+         error_found =
+           check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
+         
+         /* We found it, we can bail out */
+         if (IDENTIFIER_CLASS_VALUE (to_be_found))
+           break;
+
+         /* We haven't found it. Maybe we're trying to access an
+            inner class.  The only way for us to know is to try again
+            after having dropped a qualifier. If we can't break it further,
+            we have an error. */
+         if (breakdown_qualified (&left, NULL, to_be_found))
+           break;
+
+         to_be_found = left;
+       }
       if (!IDENTIFIER_CLASS_VALUE (to_be_found))
        {
          parse_error_context (TREE_PURPOSE (import),