[patch] Fix PR23230 - wrong code generated in inner class

Robin Green greenrd@greenrd.org
Fri Aug 5 15:22:00 GMT 2005


This one-liner fixes PR java/23230 by saying "if the inner class has a matching
method, don't call a matching method in an outer class." In other words, always
use the innermost scope.

Tested against libjava/testsuite and jacks - no new failures (or passes). I'll
submit a new test case to jacks.

-- 
Robin

:ADDPATCH java:

2005-08-05  Robin Green <greenrd@greenrd.org>

        * maybe_use_access_method: Fix PR23230: Generalize check from
      java.lang.Object to any superclass of current_class

-------------- next part --------------
--- gcc/java/parse.y.orig	2005-08-05 12:53:24.000000000 +0100
+++ gcc/java/parse.y	2005-08-05 13:40:36.000000000 +0100
@@ -10945,7 +10945,7 @@ maybe_use_access_method (int is_super_in
      invoking a static method. Note that if MD's type is unrelated to
      CURRENT_CLASS, then the current this can be used. */
 
-  if (non_static_context && DECL_CONTEXT (md) != object_type_node)
+  if (non_static_context && !inherits_from_p (current_class, DECL_CONTEXT (md)))
     {
       ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
       if (inherits_from_p (ctx, DECL_CONTEXT (md)))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050805/65bb38f8/attachment.sig>


More information about the Java-patches mailing list