Corrected util method getFunctionTypeForSamType for flexible types.

This commit is contained in:
Stanislav Erokhin
2016-06-02 06:17:33 +03:00
parent a6da15f8e2
commit dd362f683c
6 changed files with 31 additions and 19 deletions
@@ -21,18 +21,18 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.SimpleType
interface SamConversionResolver {
companion object EMPTY : SamConversionResolver {
override fun <D : FunctionDescriptor> resolveSamAdapter(original: D) = null
override fun resolveSamConstructor(constructorOwner: DeclarationDescriptor, classifier: () -> ClassifierDescriptor?) = null
override fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): KotlinType? = null
override fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType? = null
}
fun resolveSamConstructor(constructorOwner: DeclarationDescriptor, classifier: () -> ClassifierDescriptor?): SamConstructorDescriptor?
fun <D : FunctionDescriptor> resolveSamAdapter(original: D): D?
fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): KotlinType?
fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType?
}
@@ -18,9 +18,9 @@ package org.jetbrains.kotlin.load.java.descriptors;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.SimpleType;
public interface JavaClassDescriptor extends ClassDescriptor {
@Nullable
KotlinType getFunctionTypeForSamInterface();
SimpleType getFunctionTypeForSamInterface();
}
@@ -126,7 +126,7 @@ class LazyJavaClassDescriptor(
override fun getDeclaredTypeParameters() = declaredParameters()
override fun getFunctionTypeForSamInterface(): KotlinType? = functionTypeForSamInterface()
override fun getFunctionTypeForSamInterface(): SimpleType? = functionTypeForSamInterface()
override fun isCompanionObject() = false