Skip default methods on single abstract method search
Fix for KT-4886: SAM conversion doesn't work for interfaces with default methods #KT-4886 Fixed
This commit is contained in:
+6
@@ -339,6 +339,12 @@ public class SingleAbstractMethodUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (JavaMethod method : javaClass.getMethods()) {
|
for (JavaMethod method : javaClass.getMethods()) {
|
||||||
|
|
||||||
|
//skip java 8 default methods
|
||||||
|
if (!method.isAbstract()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (DescriptorResolverUtils.isObjectMethod(method)) { // e.g., ignore toString() declared in interface
|
if (DescriptorResolverUtils.isObjectMethod(method)) { // e.g., ignore toString() declared in interface
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user