Abstract lazy type moved to descriptors
This commit is contained in:
+1
-2
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames.*
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.types.LazyJavaType
|
||||
import org.jetbrains.jet.utils.valuesToMap
|
||||
import org.jetbrains.jet.utils.keysToMapExceptNulls
|
||||
import org.jetbrains.jet.lang.resolve.java.lazy.types.toAttributes
|
||||
@@ -164,7 +163,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
|
||||
val arguments = listOf(TypeProjectionImpl(type))
|
||||
|
||||
val javaClassObjectType = object : LazyJavaType(c.storageManager) {
|
||||
val javaClassObjectType = object : AbstractLazyType(c.storageManager) {
|
||||
override fun computeTypeConstructor() = jlClass.getTypeConstructor()
|
||||
override fun computeArguments() = arguments
|
||||
override fun computeMemberScope() = jlClass.getMemberScope(arguments)
|
||||
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.java.lazy.types
|
||||
|
||||
import org.jetbrains.jet.storage.StorageManager
|
||||
import org.jetbrains.jet.lang.types.*
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||
|
||||
abstract class LazyJavaType(storageManager: StorageManager) : AbstractJetType(), LazyType {
|
||||
|
||||
private val _typeConstructor = storageManager.createLazyValue {computeTypeConstructor()}
|
||||
override fun getConstructor(): TypeConstructor = _typeConstructor()
|
||||
|
||||
protected abstract fun computeTypeConstructor(): TypeConstructor
|
||||
|
||||
private val _arguments = storageManager.createLazyValue {computeArguments()}
|
||||
override fun getArguments(): List<TypeProjection> = _arguments()
|
||||
|
||||
protected abstract fun computeArguments(): List<TypeProjection>
|
||||
|
||||
private val _memberScope = storageManager.createLazyValue {computeMemberScope()}
|
||||
override fun getMemberScope() = _memberScope()
|
||||
|
||||
protected abstract fun computeMemberScope(): JetScope
|
||||
|
||||
override fun isNullable() = false
|
||||
|
||||
override fun isError() = getConstructor().getDeclarationDescriptor()?.let { d -> ErrorUtils.isError(d) } ?: false
|
||||
|
||||
override fun getAnnotations() = Annotations.EMPTY
|
||||
|
||||
override fun toString(): String {
|
||||
if (!_typeConstructor.isComputed()) {
|
||||
return "Type constructor is not computed"
|
||||
}
|
||||
if (!_arguments.isComputed()) {
|
||||
return "" + getConstructor() + "<arguments are not computed>"
|
||||
}
|
||||
return super<AbstractJetType>.toString()
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -104,7 +104,7 @@ class LazyJavaTypeResolver(
|
||||
private inner class LazyJavaClassifierType(
|
||||
private val javaType: JavaClassifierType,
|
||||
private val attr: JavaTypeAttributes
|
||||
) : LazyJavaType(c.storageManager) {
|
||||
) : AbstractLazyType(c.storageManager) {
|
||||
|
||||
private val classifier = c.storageManager.createNullableLazyValue { javaType.getClassifier() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user