aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorGodmar Back <gback@cs.utah.edu>1999-11-18 03:59:48 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>1999-11-17 19:59:48 -0800
commit7c2e3b9b525dd16f20ec372f867b3d2d1d4feb20 (patch)
tree37384a8f1d7fcf9d2abb90b7b44b7013c39a41fb /gcc/java
parent13aa2d0521d1ec7ad385511d24ee1ef68ce9a79d (diff)
downloadgcc-7c2e3b9b525dd16f20ec372f867b3d2d1d4feb20.zip
gcc-7c2e3b9b525dd16f20ec372f867b3d2d1d4feb20.tar.gz
gcc-7c2e3b9b525dd16f20ec372f867b3d2d1d4feb20.tar.bz2
typeck.c: (lookup_java_method): search all inherited interfaces when...
Wed Nov 3 15:20:02 MST 1999 Godmar Back <gback@cs.utah.edu> * typeck.c: (lookup_java_method): search all inherited interfaces when looking up interface method. From-SVN: r30566
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/typeck.c56
2 files changed, 56 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 14f65aaf..e2d8fa8 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -16,6 +16,11 @@ Tue Nov 9 12:12:38 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (finish_class): Emit inlined methods if any native
methods exist in the class. Fixes PR gcj/85.
+Wed Nov 3 15:20:02 MST 1999 Godmar Back <gback@cs.utah.edu>
+
+ * typeck.c: (lookup_java_method): search all inherited
+ interfaces when looking up interface method.
+
Mon Nov 1 23:42:00 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (method_header:): Issue error message for rule `type
diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c
index 924265f..331de1c 100644
--- a/gcc/java/typeck.c
+++ b/gcc/java/typeck.c
@@ -743,13 +743,15 @@ lookup_argument_method (clas, method_name, method_signature)
(Contrast lookup_argument_method, which ignores return type.) */
tree
-lookup_java_method (clas, method_name, method_signature)
- tree clas, method_name, method_signature;
+lookup_java_method (searched_class, method_name, method_signature)
+ tree searched_class, method_name, method_signature;
{
tree method;
- while (clas != NULL_TREE)
+ tree currently_searched = searched_class;
+
+ while (currently_searched != NULL_TREE)
{
- for (method = TYPE_METHODS (clas);
+ for (method = TYPE_METHODS (currently_searched);
method != NULL_TREE; method = TREE_CHAIN (method))
{
tree method_sig = build_java_signature (TREE_TYPE (method));
@@ -757,7 +759,51 @@ lookup_java_method (clas, method_name, method_signature)
&& method_sig == method_signature)
return method;
}
- clas = CLASSTYPE_SUPER (clas);
+ currently_searched = CLASSTYPE_SUPER (currently_searched);
+ }
+
+ /* If this class is an interface class, search its superinterfaces as
+ * well. A superinterface is not an interface's superclass: a
+ * super interface is implemented by the interface.
+ */
+
+ currently_searched = searched_class;
+ if (CLASS_INTERFACE (TYPE_NAME (currently_searched)))
+ {
+ int i;
+ int interface_len =
+ TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (currently_searched)) - 1;
+
+ for (i = interface_len; i > 0; i--)
+ {
+ tree child =
+ TREE_VEC_ELT (TYPE_BINFO_BASETYPES (currently_searched), i);
+ tree iclass = BINFO_TYPE (child);
+
+ /* If the superinterface hasn't been loaded yet, do so now. */
+ if (! CLASS_LOADED_P (iclass))
+ load_class (iclass, 1);
+
+ for (method = TYPE_METHODS (iclass);
+ method != NULL_TREE; method = TREE_CHAIN (method))
+ {
+ tree method_sig = build_java_signature (TREE_TYPE (method));
+
+ if (DECL_NAME (method) == method_name
+ && method_sig == method_signature)
+ return method;
+ }
+
+ /* it could be defined in a supersuperinterface */
+ if (CLASS_INTERFACE (TYPE_NAME (iclass)))
+ {
+ method = lookup_java_method (iclass,
+ method_name,
+ method_signature);
+ if (method != NULL_TREE)
+ return method;
+ }
+ }
}
return NULL_TREE;
}