GlobalJavaResolverContext -> JavaResolverComponents
This commit is contained in:
+1
-1
@@ -99,7 +99,7 @@ abstract class AbstractJavaAnnotationDescriptor(
|
||||
annotation: JavaAnnotation?,
|
||||
private val kotlinAnnotationClassDescriptor: ClassDescriptor
|
||||
): AnnotationDescriptor {
|
||||
private val source = annotation?.let { c.sourceElementFactory.source(it) } ?: SourceElement.NO_SOURCE
|
||||
private val source = annotation?.let { c.components.sourceElementFactory.source(it) } ?: SourceElement.NO_SOURCE
|
||||
|
||||
override fun getType() = kotlinAnnotationClassDescriptor.defaultType
|
||||
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ class LazyJavaAnnotations(
|
||||
private val c: LazyJavaResolverContext,
|
||||
private val annotationOwner: JavaAnnotationOwner
|
||||
) : Annotations {
|
||||
private val annotationDescriptors = c.storageManager.createMemoizedFunctionWithNullableValues {
|
||||
private val annotationDescriptors = c.components.storageManager.createMemoizedFunctionWithNullableValues {
|
||||
annotation: JavaAnnotation -> JavaAnnotationMapper.mapOrResolveJavaAnnotation(annotation, c)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class LazyJavaAnnotations(
|
||||
?: JavaAnnotationMapper.findMappedJavaAnnotation(fqName, annotationOwner, c)
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) =
|
||||
c.externalAnnotationResolver.findExternalAnnotation(annotationOwner, fqName)?.let(annotationDescriptors)
|
||||
c.components.externalAnnotationResolver.findExternalAnnotation(annotationOwner, fqName)?.let(annotationDescriptors)
|
||||
|
||||
override fun iterator() =
|
||||
(annotationOwner.annotations.asSequence().map(annotationDescriptors)
|
||||
|
||||
+5
-5
@@ -28,18 +28,18 @@ import org.jetbrains.kotlin.storage.MemoizedFunctionToNullable
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
public class LazyJavaPackageFragmentProvider(
|
||||
outerContext: GlobalJavaResolverContext,
|
||||
components: JavaResolverComponents,
|
||||
module: ModuleDescriptor,
|
||||
reflectionTypes: ReflectionTypes
|
||||
) : PackageFragmentProvider {
|
||||
|
||||
private val c =
|
||||
LazyJavaResolverContext(outerContext, this, FragmentClassResolver(), module, reflectionTypes, TypeParameterResolver.EMPTY)
|
||||
LazyJavaResolverContext(components, this, FragmentClassResolver(), module, reflectionTypes, TypeParameterResolver.EMPTY)
|
||||
|
||||
private val packageFragments: MemoizedFunctionToNullable<FqName, LazyJavaPackageFragment> =
|
||||
c.storageManager.createMemoizedFunctionWithNullableValues {
|
||||
fqName ->
|
||||
val jPackage = c.finder.findPackage(fqName)
|
||||
val jPackage = c.components.finder.findPackage(fqName)
|
||||
if (jPackage != null) {
|
||||
LazyJavaPackageFragment(c, jPackage)
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class LazyJavaPackageFragmentProvider(
|
||||
override fun resolveClass(javaClass: JavaClass): ClassDescriptor? {
|
||||
val fqName = javaClass.fqName
|
||||
if (fqName != null && javaClass.originKind == JavaClass.OriginKind.KOTLIN_LIGHT_CLASS) {
|
||||
return c.javaResolverCache.getClassResolvedFromSource(fqName)
|
||||
return c.components.javaResolverCache.getClassResolvedFromSource(fqName)
|
||||
}
|
||||
|
||||
javaClass.outerClass?.let { outerClass ->
|
||||
@@ -67,7 +67,7 @@ public class LazyJavaPackageFragmentProvider(
|
||||
return outerClassScope?.getClassifier(javaClass.name) as? ClassDescriptor
|
||||
}
|
||||
|
||||
val kotlinResult = c.resolveKotlinBinaryClass(c.kotlinClassFinder.findKotlinClass(javaClass))
|
||||
val kotlinResult = c.resolveKotlinBinaryClass(c.components.kotlinClassFinder.findKotlinClass(javaClass))
|
||||
if (kotlinResult is KotlinClassLookupResult.Found) return kotlinResult.descriptor
|
||||
|
||||
if (fqName == null) return null
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.load.kotlin.KotlinClassFinder
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ErrorReporter
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
open class GlobalJavaResolverContext(
|
||||
class JavaResolverComponents(
|
||||
val storageManager: StorageManager,
|
||||
val finder: JavaClassFinder,
|
||||
val kotlinClassFinder: KotlinClassFinder,
|
||||
@@ -49,32 +49,22 @@ open class GlobalJavaResolverContext(
|
||||
)
|
||||
|
||||
open class LazyJavaResolverContext(
|
||||
globalContext: GlobalJavaResolverContext,
|
||||
val components: JavaResolverComponents,
|
||||
val packageFragmentProvider: LazyJavaPackageFragmentProvider,
|
||||
val javaClassResolver: LazyJavaClassResolver,
|
||||
val module: ModuleDescriptor,
|
||||
val reflectionTypes: ReflectionTypes,
|
||||
val typeParameterResolver: TypeParameterResolver
|
||||
) : GlobalJavaResolverContext(
|
||||
globalContext.storageManager,
|
||||
globalContext.finder,
|
||||
globalContext.kotlinClassFinder,
|
||||
globalContext.deserializedDescriptorResolver,
|
||||
globalContext.externalAnnotationResolver,
|
||||
globalContext.externalSignatureResolver,
|
||||
globalContext.errorReporter,
|
||||
globalContext.javaResolverCache,
|
||||
globalContext.javaPropertyInitializerEvaluator,
|
||||
globalContext.samConversionResolver,
|
||||
globalContext.sourceElementFactory,
|
||||
globalContext.moduleClassResolver
|
||||
) {
|
||||
val typeResolver = LazyJavaTypeResolver(this, typeParameterResolver)
|
||||
|
||||
val storageManager: StorageManager
|
||||
get() = components.storageManager
|
||||
}
|
||||
|
||||
fun LazyJavaResolverContext.child(
|
||||
typeParameterResolver: TypeParameterResolver
|
||||
) = LazyJavaResolverContext(this, packageFragmentProvider, javaClassResolver, module, reflectionTypes, typeParameterResolver)
|
||||
) = LazyJavaResolverContext(components, packageFragmentProvider, javaClassResolver, module, reflectionTypes, typeParameterResolver)
|
||||
|
||||
|
||||
fun LazyJavaResolverContext.child(
|
||||
|
||||
+2
-2
@@ -56,11 +56,11 @@ class LazyJavaAnnotationDescriptor(
|
||||
private val type = c.storageManager.createLazyValue {
|
||||
val fqName = fqName() ?: return@createLazyValue ErrorUtils.createErrorType("No fqName: $javaAnnotation")
|
||||
val annotationClass = JavaToKotlinClassMap.INSTANCE.mapJavaToKotlin(fqName)
|
||||
?: javaAnnotation.resolve()?.let { javaClass -> c.moduleClassResolver.resolveClass(javaClass) }
|
||||
?: javaAnnotation.resolve()?.let { javaClass -> c.components.moduleClassResolver.resolveClass(javaClass) }
|
||||
annotationClass?.getDefaultType() ?: ErrorUtils.createErrorType(fqName.asString())
|
||||
}
|
||||
|
||||
private val source = c.sourceElementFactory.source(javaAnnotation)
|
||||
private val source = c.components.sourceElementFactory.source(javaAnnotation)
|
||||
|
||||
private val factory = ConstantValueFactory(c.module.builtIns)
|
||||
|
||||
|
||||
+4
-4
@@ -47,12 +47,12 @@ class LazyJavaClassDescriptor(
|
||||
internal val fqName: FqName,
|
||||
private val jClass: JavaClass
|
||||
) : ClassDescriptorBase(outerC.storageManager, containingDeclaration, fqName.shortName(),
|
||||
outerC.sourceElementFactory.source(jClass)), JavaClassDescriptor {
|
||||
outerC.components.sourceElementFactory.source(jClass)), JavaClassDescriptor {
|
||||
|
||||
private val c: LazyJavaResolverContext = outerC.child(this, jClass)
|
||||
|
||||
init {
|
||||
c.javaResolverCache.recordClass(jClass, this)
|
||||
c.components.javaResolverCache.recordClass(jClass, this)
|
||||
}
|
||||
|
||||
private val kind = when {
|
||||
@@ -96,7 +96,7 @@ class LazyJavaClassDescriptor(
|
||||
override fun getAnnotations() = annotations()
|
||||
|
||||
private val functionTypeForSamInterface = c.storageManager.createNullableLazyValue {
|
||||
c.samConversionResolver.resolveFunctionTypeIfSamInterface(this) { method ->
|
||||
c.components.samConversionResolver.resolveFunctionTypeIfSamInterface(this) { method ->
|
||||
unsubstitutedMemberScope.resolveMethodToFunctionDescriptor(method, false)
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ class LazyJavaClassDescriptor(
|
||||
result.addIfNotNull(purelyImplementedSupertype)
|
||||
|
||||
if (incomplete.isNotEmpty()) {
|
||||
c.errorReporter.reportIncompleteHierarchy(getDeclarationDescriptor(), incomplete.map { javaType ->
|
||||
c.components.errorReporter.reportIncompleteHierarchy(getDeclarationDescriptor(), incomplete.map { javaType ->
|
||||
(javaType as JavaClassifierType).getPresentableText()
|
||||
})
|
||||
}
|
||||
|
||||
+14
-14
@@ -68,7 +68,7 @@ public class LazyJavaClassMemberScope(
|
||||
for (constructor in constructors) {
|
||||
val descriptor = resolveConstructor(constructor)
|
||||
result.add(descriptor)
|
||||
result.addIfNotNull(c.samConversionResolver.resolveSamAdapter(descriptor))
|
||||
result.addIfNotNull(c.components.samConversionResolver.resolveSamAdapter(descriptor))
|
||||
}
|
||||
|
||||
enhanceSignatures(
|
||||
@@ -78,7 +78,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
override fun computeNonDeclaredFunctions(result: MutableCollection<SimpleFunctionDescriptor>, name: Name) {
|
||||
val functionsFromSupertypes = getFunctionsFromSupertypes(name, getContainingDeclaration())
|
||||
result.addAll(DescriptorResolverUtils.resolveOverrides(name, functionsFromSupertypes, result, getContainingDeclaration(), c.errorReporter))
|
||||
result.addAll(DescriptorResolverUtils.resolveOverrides(name, functionsFromSupertypes, result, getContainingDeclaration(), c.components.errorReporter))
|
||||
}
|
||||
|
||||
private fun getFunctionsFromSupertypes(name: Name, descriptor: ClassDescriptor): Set<SimpleFunctionDescriptor> {
|
||||
@@ -95,7 +95,7 @@ public class LazyJavaClassMemberScope(
|
||||
val propertiesFromSupertypes = getPropertiesFromSupertypes(name, getContainingDeclaration())
|
||||
|
||||
result.addAll(DescriptorResolverUtils.resolveOverrides(name, propertiesFromSupertypes, result, getContainingDeclaration(),
|
||||
c.errorReporter))
|
||||
c.components.errorReporter))
|
||||
}
|
||||
|
||||
private fun computeAnnotationProperties(name: Name, result: MutableCollection<PropertyDescriptor>) {
|
||||
@@ -104,7 +104,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
val propertyDescriptor = JavaPropertyDescriptor(
|
||||
getContainingDeclaration(), annotations, method.getVisibility(),
|
||||
/* isVar = */ false, method.getName(), c.sourceElementFactory.source(method), /* original */ null
|
||||
/* isVar = */ false, method.getName(), c.components.sourceElementFactory.source(method), /* original */ null
|
||||
)
|
||||
|
||||
// default getter is necessary because there is no real field in annotation
|
||||
@@ -128,10 +128,10 @@ public class LazyJavaClassMemberScope(
|
||||
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: JetType,
|
||||
valueParameters: LazyJavaScope.ResolvedValueParameters
|
||||
): LazyJavaScope.MethodSignatureData {
|
||||
val propagated = c.externalSignatureResolver.resolvePropagatedSignature(
|
||||
val propagated = c.components.externalSignatureResolver.resolvePropagatedSignature(
|
||||
method, getContainingDeclaration(), returnType, null, valueParameters.descriptors, methodTypeParameters
|
||||
)
|
||||
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
val effectiveSignature = c.components.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
method, !propagated.getSuperMethods().isEmpty(), propagated.getReturnType(),
|
||||
propagated.getReceiverType(), propagated.getValueParameters(), propagated.getTypeParameters(),
|
||||
propagated.hasStableParameterNames()
|
||||
@@ -144,11 +144,11 @@ public class LazyJavaClassMemberScope(
|
||||
val classDescriptor = getContainingDeclaration()
|
||||
|
||||
val constructorDescriptor = JavaConstructorDescriptor.createJavaConstructor(
|
||||
classDescriptor, c.resolveAnnotations(constructor), /* isPrimary = */ false, c.sourceElementFactory.source(constructor)
|
||||
classDescriptor, c.resolveAnnotations(constructor), /* isPrimary = */ false, c.components.sourceElementFactory.source(constructor)
|
||||
)
|
||||
|
||||
val valueParameters = resolveValueParameters(c, constructorDescriptor, constructor.getValueParameters())
|
||||
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
val effectiveSignature = c.components.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
constructor, false, null, null, valueParameters.descriptors, Collections.emptyList(), false)
|
||||
|
||||
constructorDescriptor.initialize(
|
||||
@@ -163,10 +163,10 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
val signatureErrors = effectiveSignature.getErrors()
|
||||
if (!signatureErrors.isEmpty()) {
|
||||
c.externalSignatureResolver.reportSignatureErrors(constructorDescriptor, signatureErrors)
|
||||
c.components.externalSignatureResolver.reportSignatureErrors(constructorDescriptor, signatureErrors)
|
||||
}
|
||||
|
||||
c.javaResolverCache.recordConstructor(constructor, constructorDescriptor)
|
||||
c.components.javaResolverCache.recordConstructor(constructor, constructorDescriptor)
|
||||
|
||||
return constructorDescriptor
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
val classDescriptor = getContainingDeclaration()
|
||||
val constructorDescriptor = JavaConstructorDescriptor.createJavaConstructor(
|
||||
classDescriptor, Annotations.EMPTY, /* isPrimary = */ true, c.sourceElementFactory.source(jClass)
|
||||
classDescriptor, Annotations.EMPTY, /* isPrimary = */ true, c.components.sourceElementFactory.source(jClass)
|
||||
)
|
||||
val typeParameters = classDescriptor.getTypeConstructor().getParameters()
|
||||
val valueParameters = if (isAnnotation) createAnnotationConstructorParameters(constructorDescriptor)
|
||||
@@ -188,7 +188,7 @@ public class LazyJavaClassMemberScope(
|
||||
constructorDescriptor.initialize(typeParameters, valueParameters, getConstructorVisibility(classDescriptor))
|
||||
constructorDescriptor.setHasStableParameterNames(true)
|
||||
constructorDescriptor.setReturnType(classDescriptor.getDefaultType())
|
||||
c.javaResolverCache.recordConstructor(jClass, constructorDescriptor);
|
||||
c.components.javaResolverCache.recordConstructor(jClass, constructorDescriptor);
|
||||
return constructorDescriptor
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public class LazyJavaClassMemberScope(
|
||||
method.hasAnnotationParameterDefaultValue(),
|
||||
// Nulls are not allowed in annotation arguments in Java
|
||||
varargElementType?.let { TypeUtils.makeNotNullable(it) },
|
||||
c.sourceElementFactory.source(method)
|
||||
c.components.sourceElementFactory.source(method)
|
||||
))
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ public class LazyJavaClassMemberScope(
|
||||
EnumEntrySyntheticClassDescriptor.create(c.storageManager, getContainingDeclaration(), name,
|
||||
c.storageManager.createLazyValue {
|
||||
memberIndex().getAllFieldNames() + memberIndex().getMethodNames({true})
|
||||
}, c.sourceElementFactory.source(field))
|
||||
}, c.components.sourceElementFactory.source(field))
|
||||
}
|
||||
else null
|
||||
}
|
||||
|
||||
+5
-5
@@ -45,14 +45,14 @@ public class LazyJavaPackageScope(
|
||||
// TODO: Storing references is a temporary hack until modules infrastructure is implemented.
|
||||
// See JetTypeMapperWithOutDirectories for details
|
||||
public val kotlinBinaryClass: KotlinJvmBinaryClass?
|
||||
= c.kotlinClassFinder.findKotlinClass(PackageClassUtils.getPackageClassId(packageFragment.fqName))
|
||||
= c.components.kotlinClassFinder.findKotlinClass(PackageClassUtils.getPackageClassId(packageFragment.fqName))
|
||||
|
||||
private val deserializedPackageScope = c.storageManager.createLazyValue {
|
||||
val kotlinBinaryClass = kotlinBinaryClass
|
||||
if (kotlinBinaryClass == null)
|
||||
JetScope.Empty
|
||||
else
|
||||
c.deserializedDescriptorResolver.createKotlinPackageScope(packageFragment, kotlinBinaryClass) ?: JetScope.Empty
|
||||
c.components.deserializedDescriptorResolver.createKotlinPackageScope(packageFragment, kotlinBinaryClass) ?: JetScope.Empty
|
||||
}
|
||||
|
||||
private val packageFragment: LazyJavaPackageFragment get() = getContainingDeclaration() as LazyJavaPackageFragment
|
||||
@@ -60,12 +60,12 @@ public class LazyJavaPackageScope(
|
||||
private val classes = c.storageManager.createMemoizedFunctionWithNullableValues<Name, ClassDescriptor> { name ->
|
||||
val classId = ClassId(packageFragment.fqName, name)
|
||||
|
||||
val kotlinResult = c.resolveKotlinBinaryClass(c.kotlinClassFinder.findKotlinClass(classId))
|
||||
val kotlinResult = c.resolveKotlinBinaryClass(c.components.kotlinClassFinder.findKotlinClass(classId))
|
||||
when (kotlinResult) {
|
||||
is KotlinClassLookupResult.Found -> kotlinResult.descriptor
|
||||
is KotlinClassLookupResult.SyntheticClass -> null
|
||||
is KotlinClassLookupResult.NotFound -> {
|
||||
c.finder.findClass(classId)?.let { javaClass ->
|
||||
c.components.finder.findClass(classId)?.let { javaClass ->
|
||||
c.javaClassResolver.resolveClass(javaClass).apply {
|
||||
assert(this == null || this.containingDeclaration == packageFragment) {
|
||||
"Wrong package fragment for $this, expected $packageFragment"
|
||||
@@ -118,7 +118,7 @@ public class LazyJavaPackageScope(
|
||||
)
|
||||
|
||||
override fun computeNonDeclaredFunctions(result: MutableCollection<SimpleFunctionDescriptor>, name: Name) {
|
||||
result.addIfNotNull(c.samConversionResolver.resolveSamConstructor(name, this))
|
||||
result.addIfNotNull(c.components.samConversionResolver.resolveSamConstructor(name, this))
|
||||
}
|
||||
|
||||
override fun getSubPackages() = subPackages()
|
||||
|
||||
+11
-11
@@ -84,7 +84,7 @@ public abstract class LazyJavaScope(
|
||||
val descriptor = resolveMethodToFunctionDescriptor(method, true)
|
||||
result.add(descriptor)
|
||||
if (method.isStatic) {
|
||||
result.addIfNotNull(c.samConversionResolver.resolveSamAdapter(descriptor))
|
||||
result.addIfNotNull(c.components.samConversionResolver.resolveSamAdapter(descriptor))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class LazyJavaScope(
|
||||
fun resolveMethodToFunctionDescriptor(method: JavaMethod, record: Boolean = true): JavaMethodDescriptor {
|
||||
val annotations = c.resolveAnnotations(method)
|
||||
val functionDescriptorImpl = JavaMethodDescriptor.createJavaMethod(
|
||||
containingDeclaration, annotations, method.getName(), c.sourceElementFactory.source(method)
|
||||
containingDeclaration, annotations, method.getName(), c.components.sourceElementFactory.source(method)
|
||||
)
|
||||
|
||||
val c = c.child(functionDescriptorImpl, method)
|
||||
@@ -132,11 +132,11 @@ public abstract class LazyJavaScope(
|
||||
functionDescriptorImpl.setParameterNamesStatus(effectiveSignature.hasStableParameterNames(), valueParameters.hasSynthesizedNames)
|
||||
|
||||
if (record) {
|
||||
c.javaResolverCache.recordMethod(method, functionDescriptorImpl)
|
||||
c.components.javaResolverCache.recordMethod(method, functionDescriptorImpl)
|
||||
}
|
||||
|
||||
if (signatureErrors.isNotEmpty()) {
|
||||
c.externalSignatureResolver.reportSignatureErrors(functionDescriptorImpl, signatureErrors)
|
||||
c.components.externalSignatureResolver.reportSignatureErrors(functionDescriptorImpl, signatureErrors)
|
||||
}
|
||||
|
||||
return functionDescriptorImpl
|
||||
@@ -204,7 +204,7 @@ public abstract class LazyJavaScope(
|
||||
outType,
|
||||
false,
|
||||
varargElementType,
|
||||
c.sourceElementFactory.source(javaParameter)
|
||||
c.components.sourceElementFactory.source(javaParameter)
|
||||
)
|
||||
}.toList()
|
||||
return ResolvedValueParameters(descriptors, synthesizedNames)
|
||||
@@ -242,10 +242,10 @@ public abstract class LazyJavaScope(
|
||||
propertyDescriptor.initialize(null, null)
|
||||
|
||||
val propertyType = getPropertyType(field, propertyDescriptor.getAnnotations())
|
||||
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeFieldSignature(field, propertyType, isVar)
|
||||
val effectiveSignature = c.components.externalSignatureResolver.resolveAlternativeFieldSignature(field, propertyType, isVar)
|
||||
val signatureErrors = effectiveSignature.getErrors()
|
||||
if (!signatureErrors.isEmpty()) {
|
||||
c.externalSignatureResolver.reportSignatureErrors(propertyDescriptor, signatureErrors)
|
||||
c.components.externalSignatureResolver.reportSignatureErrors(propertyDescriptor, signatureErrors)
|
||||
}
|
||||
|
||||
propertyDescriptor.setType(effectiveSignature.getReturnType(), listOf(), getDispatchReceiverParameter(), null : JetType?)
|
||||
@@ -253,11 +253,11 @@ public abstract class LazyJavaScope(
|
||||
if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.getType())) {
|
||||
propertyDescriptor.setCompileTimeInitializer(
|
||||
c.storageManager.createNullableLazyValue {
|
||||
c.javaPropertyInitializerEvaluator.getInitializerConstant(field, propertyDescriptor)
|
||||
c.components.javaPropertyInitializerEvaluator.getInitializerConstant(field, propertyDescriptor)
|
||||
})
|
||||
}
|
||||
|
||||
c.javaResolverCache.recordField(field, propertyDescriptor);
|
||||
c.components.javaResolverCache.recordField(field, propertyDescriptor);
|
||||
|
||||
return propertyDescriptor
|
||||
}
|
||||
@@ -269,7 +269,7 @@ public abstract class LazyJavaScope(
|
||||
val propertyName = field.getName()
|
||||
|
||||
return JavaPropertyDescriptor(containingDeclaration, annotations, visibility, isVar, propertyName,
|
||||
c.sourceElementFactory.source(field), /* original = */ null)
|
||||
c.components.sourceElementFactory.source(field), /* original = */ null)
|
||||
}
|
||||
|
||||
private fun getPropertyType(field: JavaField, annotations: Annotations): JetType {
|
||||
@@ -277,7 +277,7 @@ public abstract class LazyJavaScope(
|
||||
val finalStatic = field.isFinal() && field.isStatic()
|
||||
|
||||
// simple static constants should not have flexible types:
|
||||
val allowFlexible = PLATFORM_TYPES && !(finalStatic && c.javaPropertyInitializerEvaluator.isNotNullCompileTimeConstant(field))
|
||||
val allowFlexible = PLATFORM_TYPES && !(finalStatic && c.components.javaPropertyInitializerEvaluator.isNotNullCompileTimeConstant(field))
|
||||
val propertyType = c.typeResolver.transformJavaType(
|
||||
field.getType(),
|
||||
LazyJavaTypeAttributes(TypeUsage.MEMBER_SIGNATURE_INVARIANT, annotations, allowFlexible)
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class LazyJavaStaticClassScope(
|
||||
|
||||
override fun computeNonDeclaredFunctions(result: MutableCollection<SimpleFunctionDescriptor>, name: Name) {
|
||||
val nestedClassesScope = getContainingDeclaration().getUnsubstitutedInnerClassesScope()
|
||||
result.addIfNotNull(c.samConversionResolver.resolveSamConstructor(name, nestedClassesScope))
|
||||
result.addIfNotNull(c.components.samConversionResolver.resolveSamConstructor(name, nestedClassesScope))
|
||||
|
||||
if (jClass.isEnum()) {
|
||||
when (name) {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public abstract class LazyJavaStaticScope(
|
||||
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: JetType,
|
||||
valueParameters: LazyJavaScope.ResolvedValueParameters
|
||||
): LazyJavaScope.MethodSignatureData {
|
||||
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
val effectiveSignature = c.components.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||
method, false, returnType, null, valueParameters.descriptors, methodTypeParameters, false)
|
||||
return LazyJavaScope.MethodSignatureData(effectiveSignature, effectiveSignature.getErrors())
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ fun LazyJavaResolverContext.resolveKotlinBinaryClass(kotlinClass: KotlinJvmBinar
|
||||
val header = kotlinClass.classHeader
|
||||
return when {
|
||||
!header.isCompatibleAbiVersion -> {
|
||||
errorReporter.reportIncompatibleAbiVersion(kotlinClass.classId, kotlinClass.location, header.version)
|
||||
components.errorReporter.reportIncompatibleAbiVersion(kotlinClass.classId, kotlinClass.location, header.version)
|
||||
KotlinClassLookupResult.NotFound
|
||||
}
|
||||
header.kind == KotlinClassHeader.Kind.CLASS -> {
|
||||
val descriptor = deserializedDescriptorResolver.resolveClass(kotlinClass)
|
||||
val descriptor = components.deserializedDescriptorResolver.resolveClass(kotlinClass)
|
||||
if (descriptor != null) KotlinClassLookupResult.Found(descriptor) else KotlinClassLookupResult.NotFound
|
||||
}
|
||||
else -> {
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ class LazyJavaTypeResolver(
|
||||
is JavaClass -> {
|
||||
val fqName = classifier.getFqName().sure { "Class type should have a FQ name: $classifier" }
|
||||
|
||||
val classData = mapKotlinClass(fqName) ?: c.moduleClassResolver.resolveClass(classifier)
|
||||
val classData = mapKotlinClass(fqName) ?: c.components.moduleClassResolver.resolveClass(classifier)
|
||||
|
||||
classData?.getTypeConstructor()
|
||||
?: ErrorUtils.createErrorTypeConstructor("Unresolved java classifier: " + javaType.getPresentableText())
|
||||
|
||||
Reference in New Issue
Block a user