Support netsted classes
This commit is contained in:
+6
-4
@@ -67,10 +67,12 @@ class LazyJavaAnnotationDescriptor(
|
|||||||
|
|
||||||
private val _allValueArguments = c.storageManager.createLazyValue {
|
private val _allValueArguments = c.storageManager.createLazyValue {
|
||||||
val constructors = getAnnotationClass().getConstructors()
|
val constructors = getAnnotationClass().getConstructors()
|
||||||
if (constructors.isEmpty()) mapOf<ValueParameterDescriptor, CompileTimeConstant<out Any?>>()
|
if (constructors.isEmpty())
|
||||||
constructors.first().getValueParameters().keysToMapExceptNulls {
|
mapOf<ValueParameterDescriptor, CompileTimeConstant<out Any?>>()
|
||||||
vp -> getValueArgument(vp)
|
else
|
||||||
}
|
constructors.first().getValueParameters().keysToMapExceptNulls {
|
||||||
|
vp -> getValueArgument(vp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAllValueArguments() = _allValueArguments()
|
override fun getAllValueArguments() = _allValueArguments()
|
||||||
|
|||||||
+4
-3
@@ -20,11 +20,12 @@ import org.jetbrains.jet.lang.resolve.java.lazy.child
|
|||||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.resolveAnnotations
|
import org.jetbrains.jet.lang.resolve.java.lazy.resolveAnnotations
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.types.toAttributes
|
import org.jetbrains.jet.lang.resolve.java.lazy.types.toAttributes
|
||||||
|
import org.jetbrains.jet.lang.resolve.scopes.InnerClassesScopeWrapper
|
||||||
|
|
||||||
class LazyJavaClassDescriptor(
|
class LazyJavaClassDescriptor(
|
||||||
private val c: LazyJavaResolverContextWithTypes,
|
private val c: LazyJavaResolverContextWithTypes,
|
||||||
containingDeclaration: DeclarationDescriptor,
|
containingDeclaration: DeclarationDescriptor,
|
||||||
fqName: FqName,
|
internal val fqName: FqName,
|
||||||
private val jClass: JavaClass
|
private val jClass: JavaClass
|
||||||
) : ClassDescriptorBase(containingDeclaration, fqName.shortName()), LazyJavaDescriptor {
|
) : ClassDescriptorBase(containingDeclaration, fqName.shortName()), LazyJavaDescriptor {
|
||||||
|
|
||||||
@@ -49,8 +50,8 @@ class LazyJavaClassDescriptor(
|
|||||||
private val _thisAsReceiverParameter = c.storageManager.createLazyValue { DescriptorFactory.createLazyReceiverParameterDescriptor(this) }
|
private val _thisAsReceiverParameter = c.storageManager.createLazyValue { DescriptorFactory.createLazyReceiverParameterDescriptor(this) }
|
||||||
override fun getThisAsReceiverParameter() = _thisAsReceiverParameter()
|
override fun getThisAsReceiverParameter() = _thisAsReceiverParameter()
|
||||||
|
|
||||||
// TODO
|
private val _innerClassesScope = InnerClassesScopeWrapper(getScopeForMemberLookup())
|
||||||
override fun getUnsubstitutedInnerClassesScope(): JetScope = JetScope.EMPTY
|
override fun getUnsubstitutedInnerClassesScope(): JetScope = _innerClassesScope
|
||||||
|
|
||||||
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = null
|
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = null
|
||||||
|
|
||||||
|
|||||||
+20
-4
@@ -45,7 +45,7 @@ import org.jetbrains.jet.lang.resolve.java.structure.JavaValueParameter
|
|||||||
|
|
||||||
public class LazyJavaClassMemberScope(
|
public class LazyJavaClassMemberScope(
|
||||||
c: LazyJavaResolverContextWithTypes,
|
c: LazyJavaResolverContextWithTypes,
|
||||||
containingDeclaration: DeclarationDescriptor,
|
containingDeclaration: LazyJavaClassDescriptor,
|
||||||
private val jClass: JavaClass,
|
private val jClass: JavaClass,
|
||||||
classAsPackage: Boolean
|
classAsPackage: Boolean
|
||||||
) : LazyJavaMemberScope(c, containingDeclaration) {
|
) : LazyJavaMemberScope(c, containingDeclaration) {
|
||||||
@@ -147,9 +147,21 @@ public class LazyJavaClassMemberScope(
|
|||||||
override fun getProperties(name: Name): Collection<VariableDescriptor> = listOf()
|
override fun getProperties(name: Name): Collection<VariableDescriptor> = listOf()
|
||||||
override fun getAllPropertyNames(): Collection<Name> = listOf()
|
override fun getAllPropertyNames(): Collection<Name> = listOf()
|
||||||
|
|
||||||
// TODO
|
private val nestedClassIndex = c.storageManager.createLazyValue {
|
||||||
override fun getClassifier(name: Name): ClassifierDescriptor? = null
|
jClass.getInnerClasses().valuesToMap { c -> c.getName() }
|
||||||
override fun getAllClassNames(): Collection<Name> = listOf()
|
}
|
||||||
|
|
||||||
|
private val nestedClasses = c.storageManager.createMemoizedFunctionWithNullableValues {
|
||||||
|
(name: Name) ->
|
||||||
|
val jNestedClass = nestedClassIndex()[name]
|
||||||
|
if (jNestedClass == null)
|
||||||
|
null
|
||||||
|
else
|
||||||
|
LazyJavaClassDescriptor(c, getContainingDeclaration(), getContainingDeclaration().fqName.child(name), jNestedClass)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getClassifier(name: Name): ClassifierDescriptor? = nestedClasses(name)
|
||||||
|
override fun getAllClassNames(): Collection<Name> = nestedClassIndex().keySet()
|
||||||
|
|
||||||
override fun addExtraDescriptors(result: MutableCollection<in DeclarationDescriptor>) {
|
override fun addExtraDescriptors(result: MutableCollection<in DeclarationDescriptor>) {
|
||||||
// TODO
|
// TODO
|
||||||
@@ -158,4 +170,8 @@ public class LazyJavaClassMemberScope(
|
|||||||
// TODO
|
// TODO
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> = listOf()
|
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> = listOf()
|
||||||
|
|
||||||
|
|
||||||
|
override fun getContainingDeclaration(): LazyJavaClassDescriptor {
|
||||||
|
return super.getContainingDeclaration() as LazyJavaClassDescriptor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user