gcj/285: Overriding method in Interface confuses gcj

mark@klomp.org mark@klomp.org
Mon Jul 17 07:16:00 GMT 2000


>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:


More information about the Java-prs mailing list