[PATCH] Java: Fix `make check' regression.

Alexandre Petit-Bianco apbianco@cygnus.com
Fri Mar 23 18:07:00 GMT 2001


This patch fixes the inner_1.java `make check' regression. I tested it
and I didn't find any regressions.

I'm going to check this in the trunk and the branch pretty soon.

./A

2001-03-23  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* parse.y (find_as_inner_class): Follow current package indications
	not to mistakingly load an unrelated class.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.251.2.10
diff -u -p -r1.251.2.10 parse.y
--- parse.y	2001/03/24 01:16:02	1.251.2.10
+++ parse.y	2001/03/24 02:06:41
@@ -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



More information about the Gcc-patches mailing list