OSDN Git Service

2001-03-26 Alexandre Petit-Bianco <apbianco@redhat.com>
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Mar 2001 22:12:16 +0000 (22:12 +0000)
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Mar 2001 22:12:16 +0000 (22:12 +0000)
* parse.y (find_as_inner_class): Follow current package
indications not to mistakingly load an unrelated class.

(http://gcc.gnu.org/ml/gcc-patches/2001-03/msg01712.html)

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40851 138bc75d-0d04-0410-961f-82ee72b054a4

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

index a7ffcea..d147154 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-26  Alexandre Petit-Bianco  <apbianco@redhat.com>
+
+       * parse.y (find_as_inner_class): Follow current package
+       indications not to mistakingly load an unrelated class.
+
 2001-03-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * constants.c (PUTN): Use memcpy, not bcopy.
index 782a653..f42d763 100644 (file)
@@ -3521,7 +3521,18 @@ find_as_inner_class (enclosing, name, cl)
          acc = merge_qualified_name (acc, 
                                      EXPR_WFL_NODE (TREE_PURPOSE (qual)));
          BUILD_PTR_FROM_NAME (ptr, acc);
-         decl = do_resolve_class (NULL_TREE, ptr, NULL_TREE, cl);
+
+         /* Don't try to resolve ACC as a class name if it follows
+            the current package name. We don't want to pick something
+            that's accidentally there: for example `a.b.c' in package
+            `a.b' shouldn't trigger loading `a' if it's there by
+            itself. */
+         if (ctxp->package
+             && strstr (IDENTIFIER_POINTER (ctxp->package),
+                        IDENTIFIER_POINTER (acc)))
+           decl = NULL;
+         else
+           decl = do_resolve_class (NULL_TREE, ptr, NULL_TREE, cl);
        }
 
       /* A NULL qual and a decl means that the search ended