Skip to content

Can't override a Java method that uses raw types #2424

@bjansen

Description

@bjansen

Given the following scenario:

public class A<T> { }
import java.util.Collection;

public interface B {
    void method(Collection<A> a);
}
import java.util { Collection }
class C() satisfies B {
    shared actual void method(Collection<A<out Object>>? a) { }
}

I get the following error:

source/mymodule/run.ceylon:5: error: C is not abstract and does not override abstract method method(Collection<A>) in B
class C() satisfies B {
^
source/mymodule/run.ceylon:7: error: name clash: method(Collection<A<? extends Object>>) in C and method(Collection<A>) in B have the same erasure, yet neither overrides the other
    shared actual void method(Collection<A<out Object>>? a) {
           ^
2 errors

Ceylon forces me to override Collection<A> with Collection<A<out Object>>, and unfortunately I can't fix the Java interface to use Collection<A<Whatever>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions