aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2005-09-05 14:57:25 +0000
committerRanjit Mathew <rmathew@gcc.gnu.org>2005-09-05 14:57:25 +0000
commit75d1a48521ad4606c4cccefaafbb08e7eeaee67c (patch)
treed4c2c71bd7d392f0a29c5042cda181f2835df94d /gcc/java
parent7291645b6e1a6b5ee9c2f95ea6cf0b00024c7727 (diff)
downloadgcc-75d1a48521ad4606c4cccefaafbb08e7eeaee67c.zip
gcc-75d1a48521ad4606c4cccefaafbb08e7eeaee67c.tar.gz
gcc-75d1a48521ad4606c4cccefaafbb08e7eeaee67c.tar.bz2
re PR java/23431 (gcj allows overriding with more restrictive access)
PR java/23431 * typeck.c (lookup_do): Look up interfaces for the original class, not the base class. * parse.y (java_check_regular_methods): Fix diagnostic message for more restrictive overriding of a method from an interface. From-SVN: r103909
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/parse.y2
-rw-r--r--gcc/java/typeck.c3
3 files changed, 11 insertions, 2 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 0ecfd8f..8252aad 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-05 Ranjit Mathew <rmathew@hotmail.com>
+
+ PR java/23431
+ * typeck.c (lookup_do): Look up interfaces for the original class,
+ not the base class.
+ * parse.y (java_check_regular_methods): Fix diagnostic message for
+ more restrictive overriding of a method from an interface.
+
2005-08-16 Tom Tromey <tromey@redhat.com>
* class.c (make_class_data): Always emit JV_STATE_PRELOADING for
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index b1de35f..9dd860d 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -6518,7 +6518,7 @@ java_check_regular_methods (tree class_decl)
tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
parse_error_context (method_wfl, "Class %qs must override %qs with a public method in order to implement interface %qs",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- lang_printable_name (method, 2),
+ lang_printable_name (found, 0),
IDENTIFIER_POINTER (DECL_NAME (found_decl)));
}
diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c
index 8616d0b..8b64ac8 100644
--- a/gcc/java/typeck.c
+++ b/gcc/java/typeck.c
@@ -842,6 +842,7 @@ lookup_do (tree searched_class, int flags, tree method_name,
tree signature, tree (*signature_builder) (tree))
{
tree method;
+ tree orig_class = searched_class;
if (searched_class == NULL_TREE)
return NULL_TREE;
@@ -868,7 +869,7 @@ lookup_do (tree searched_class, int flags, tree method_name,
/* If that doesn't work, look in our interfaces. */
if (flags & SEARCH_INTERFACE)
- method = find_method_in_interfaces (searched_class, flags, method_name,
+ method = find_method_in_interfaces (orig_class, flags, method_name,
signature, signature_builder);
return method;