Loading SAM adapters with wildcard types.
This commit is contained in:
+2
-1
@@ -137,7 +137,8 @@ public class SingleAbstractMethodUtils {
|
||||
private static boolean isSamType(@NotNull JetType type) {
|
||||
ClassifierDescriptor classifier = type.getConstructor().getDeclarationDescriptor();
|
||||
return classifier instanceof ClassDescriptorFromJvmBytecode &&
|
||||
((ClassDescriptorFromJvmBytecode) classifier).isSamInterface();
|
||||
((ClassDescriptorFromJvmBytecode) classifier).isSamInterface() &&
|
||||
getAbstractMembers(type).size() == 1; // Comparator<*> is not a SAM type, because substituted compare() method doesn't exist
|
||||
}
|
||||
|
||||
public static boolean isSamAdapterNecessary(@NotNull SimpleFunctionDescriptor fun) {
|
||||
|
||||
+6
@@ -9,4 +9,10 @@ public class NonTrivialFunctionType {
|
||||
|
||||
public void foo(Comparator<String> comparator) {
|
||||
}
|
||||
|
||||
public void wildcardUnbound(Comparator<?> comparator) {
|
||||
}
|
||||
|
||||
public void wildcardBound(Comparator<? super CharSequence> comparator) {
|
||||
}
|
||||
}
|
||||
+3
@@ -6,4 +6,7 @@ public open class NonTrivialFunctionType : java.lang.Object {
|
||||
public open /*synthesized*/ fun foo(/*0*/ p0 : ((jet.String?, jet.String?) -> jet.Int)?) : jet.Unit
|
||||
public open fun foo(/*0*/ p0 : java.io.FilenameFilter?) : jet.Unit
|
||||
public open fun foo(/*0*/ p0 : java.util.Comparator<jet.String>?) : jet.Unit
|
||||
public open /*synthesized*/ fun wildcardBound(/*0*/ p0 : ((jet.CharSequence?, jet.CharSequence?) -> jet.Int)?) : jet.Unit
|
||||
public open fun wildcardBound(/*0*/ p0 : java.util.Comparator<in jet.CharSequence?>?) : jet.Unit
|
||||
public open fun wildcardUnbound(/*0*/ p0 : java.util.Comparator<out jet.Any?>?) : jet.Unit
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user