Optimize getSingleAbstractMethodOrNull
Searching for the single abstract method leads to computing whole member scopes of given intrefaces, especially when they contain a lot of methods (i.e. they're definitely not SAMs) On the other side this method is very hot because it's called for each Java interface used as a type for some value parameter (for building SAM adapters) The idea is to apply some heuristics to understand using only JavaMethod and supertypes that this interface is definitely not a SAM
This commit is contained in:
+2
-4
@@ -128,10 +128,8 @@ public class SingleAbstractMethodUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static FunctionDescriptor getSingleAbstractMethodOrNull(@NotNull ClassDescriptor klass) {
|
||||
if (klass.getKind() != ClassKind.INTERFACE) {
|
||||
return null;
|
||||
}
|
||||
public static FunctionDescriptor getSingleAbstractMethodOrNull(@NotNull JavaClassDescriptor klass) {
|
||||
if (klass.isDefinitelyNotSamInterface()) return null;
|
||||
|
||||
if (DescriptorUtilsKt.getFqNameSafe(klass).asString().equals("android.databinding.DataBindingComponent")) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user