From bddefd4f80c73d80c3370a71ebb351b1acc164c1 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Thu, 26 Feb 2004 15:34:05 +0000 Subject: [PATCH] re PR java/14231 (Incorrect interface method called when compiling against .class files) 2004-02-26 Andrew Haley PR java/14231: * parse.y (check_interface_throws_clauses): Check for !METHOD_INVISIBLE (iface_method). * class.c (layout_class_methods): Check for CLASS_INTERFACE as well as CLASS_ABSTRACT. From-SVN: r78505 --- gcc/java/ChangeLog | 8 ++++++++ gcc/java/class.c | 5 +++-- gcc/java/parse.y | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index a1a368508ce..b300dd3acd9 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2004-02-26 Andrew Haley + + PR java/14231: + * parse.y (check_interface_throws_clauses): Check for + !METHOD_INVISIBLE (iface_method). + * class.c (layout_class_methods): Check for CLASS_INTERFACE as + well as CLASS_ABSTRACT. + 2004-02-25 Per Bothner * parse.y (build_assertion): If we're in an inner class, create the diff --git a/gcc/java/class.c b/gcc/java/class.c index f6471ef5c49..be9958b31e4 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -2053,7 +2053,7 @@ void layout_class_methods (tree this_class) { tree method_decl, dtable_count; - tree super_class; + tree super_class, type_name; if (TYPE_NVIRTUALS (this_class)) return; @@ -2070,7 +2070,8 @@ layout_class_methods (tree this_class) else dtable_count = integer_zero_node; - if (CLASS_ABSTRACT (TYPE_NAME (this_class))) + type_name = TYPE_NAME (this_class); + if (CLASS_ABSTRACT (type_name) || CLASS_INTERFACE (type_name)) { /* An abstract class can have methods which are declared only in an implemented interface. These are called "Miranda diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 8e419a55d77..446661b93fd 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -6525,7 +6525,8 @@ check_interface_throws_clauses (tree check_class_decl, tree class_decl) Also, multiple inheritance with conflicting throws clauses is fine in the absence of a concrete implementation. */ - if (method != NULL_TREE && !METHOD_ABSTRACT (method)) + if (method != NULL_TREE && !METHOD_ABSTRACT (method) + && !METHOD_INVISIBLE (iface_method)) { tree method_wfl = DECL_FUNCTION_WFL (method); check_throws_clauses (method, method_wfl, iface_method); -- 2.30.2