Show "kotlin.Any" in decompiled text for local/anonymous types

This commit is contained in:
Alexander Udalov
2015-02-25 18:43:48 +03:00
parent 6287055475
commit e136025ac5
14 changed files with 220 additions and 75 deletions
+1
View File
@@ -8,6 +8,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="protobuf-java" level="project" />
<orderEntry type="library" name="javax.inject" level="project" />
<orderEntry type="module" module-name="descriptors" exported="" />
<orderEntry type="module" module-name="util.runtime" />
</component>
@@ -0,0 +1,24 @@
/*
* Copyright 2010-2015 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.kotlin.serialization.deserialization
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.name.ClassId
public trait LocalClassResolver {
public fun resolveLocalClass(classId: ClassId): ClassDescriptor?
}
@@ -0,0 +1,35 @@
/*
* Copyright 2010-2015 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.kotlin.serialization.deserialization
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.name.ClassId
import javax.inject.Inject
import kotlin.properties.Delegates
public class LocalClassResolverImpl : LocalClassResolver {
public var components: DeserializationComponents by Delegates.notNull()
Inject
public fun setDeserializationComponents(components: DeserializationComponents) {
this.components = components
}
override fun resolveLocalClass(classId: ClassId): ClassDescriptor? {
return components.deserializeClass(classId)
}
}
@@ -16,12 +16,12 @@
package org.jetbrains.kotlin.serialization.deserialization
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedTypeParameterDescriptor
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedTypeParameterDescriptor
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.utils.*
import org.jetbrains.kotlin.utils.toReadOnlyList
import java.util.LinkedHashMap
public class TypeDeserializer(
@@ -94,7 +94,7 @@ public class TypeDeserializer(
val id = c.nameResolver.getClassId(fqNameIndex)
if (id.isLocal()) {
// Local classes can't be found in scopes
return c.components.deserializeClass(id)
return c.components.localClassResolver.resolveLocalClass(id)
}
return c.components.moduleDescriptor.findClassAcrossModuleDependencies(id)
}
@@ -29,6 +29,7 @@ public class DeserializationComponents(
public val classDataFinder: ClassDataFinder,
public val annotationAndConstantLoader: AnnotationAndConstantLoader<AnnotationDescriptor, CompileTimeConstant<*>>,
public val packageFragmentProvider: PackageFragmentProvider,
public val localClassResolver: LocalClassResolver,
public val flexibleTypeCapabilitiesDeserializer: FlexibleTypeCapabilitiesDeserializer
) {
public val classDeserializer: ClassDeserializer = ClassDeserializer(this)