This is the mail archive of the
java-prs@sources.redhat.com
mailing list for the Java project.
gcj/285: Overriding method in Interface confuses gcj
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/285: Overriding method in Interface confuses gcj
- From: mark at klomp dot org
- Date: 17 Jul 2000 14:13:53 -0000
- Reply-To: mark at klomp dot org
- Resent-Cc: java-prs at sourceware dot cygnus dot com, green at cygnus dot com
- Resent-Reply-To: java-gnats@sourceware.cygnus.com, mark@klomp.org
>Number: 285
>Category: gcj
>Synopsis: Overriding method in Interface confuses gcj
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 17 07:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: mark@klomp.org
>Release: gcc version 2.96 20000714 (experimental)
>Organization:
>Environment:
>Description:
It is valid to override a method in a subinterface.
(Although only really usefull for documentation purposes.)
But gcj gets confused which method to call.
This does actually occur when trying to compile AbstractSet
from Classpath. (The workaround is to remove all methods
from the Set interface since all those methods are already
defined in Collection which is the super interface of Set.)
The following is the shortest example I could come up with:
public class A extends B implements I2 {
public void m() {
mi();
}
}
abstract class B implements I {
public void mi() {
}
}
interface I {
void mi();
}
interface I2 extends I {
void mi();
}
$ gcj -C A.java
A.java: In class `A':
A.java: In method `m()':
A.java:3: Can't find method `mi()' in type `A'. Candidates are:
`mi()' in `I2'
`mi()' in `B'.
mi();
^
1 error
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: