Loading SAM adapters with wildcard types.

This commit is contained in:
Evgeny Gerashchenko
2013-04-15 20:51:40 +04:00
parent c8e02f75b0
commit be0238a61e
3 changed files with 11 additions and 1 deletions
@@ -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) {