Open
Description
Context: kotlin.collections.AbstractList
Imagine we have an interface with a method, and another interface that implements that interface and provides a default
implementation:
package java.util;
public interface SequencedCollection {
SequencedCollection reverse ();
}
public interface List implements SequencedCollection {
default SequencedCollection reversed() { ... }
}
If we have a class that implements List
and does not provide its own implementation of reversed
, when generator
loops through all implemented interfaces, it will make an abstract
Reverse
method because it cannot detect that another interface provides a compatible default method.
// java
public abstract class AbstractList implements SequencedCollection { ... }
// csharp
public abstract class AbstractList : ISequencedCollection {
public abstract ISequencedCollection Reversed ();
}
This causes issues for any bound Java class that inherits AbstractList
, as they are expected to provide a Reversed
method, when they don't provide one in the Java implementation.
AndroidX.Paging.ItemSnapshotList.cs(21,30): error CS0534: 'ItemSnapshotList' does not implement inherited abstract
member 'AbstractList.Reversed()'
This issue is made worse by the fact it cannot be fixed with any existing metadata.