Obtain regenerated class name through RegeneratedInfo
This commit is contained in:
+13
-14
@@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.codegen.inline
|
package org.jetbrains.kotlin.codegen.inline
|
||||||
|
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import java.util.*
|
||||||
|
|
||||||
import java.util.HashMap
|
|
||||||
|
|
||||||
class AnonymousObjectRegenerationInfo internal constructor(
|
class AnonymousObjectRegenerationInfo internal constructor(
|
||||||
private val ownerInternalName: String,
|
private val ownerInternalName: String,
|
||||||
@@ -27,9 +25,12 @@ class AnonymousObjectRegenerationInfo internal constructor(
|
|||||||
private val capturedOuterRegenerated: Boolean,
|
private val capturedOuterRegenerated: Boolean,
|
||||||
private val alreadyRegenerated: Boolean,
|
private val alreadyRegenerated: Boolean,
|
||||||
val constructorDesc: String?,
|
val constructorDesc: String?,
|
||||||
private val isStaticOrigin: Boolean) : RegenerationInfo() {
|
private val isStaticOrigin: Boolean,
|
||||||
|
private val nameGenerator: NameGenerator) : RegenerationInfo() {
|
||||||
|
|
||||||
private var newLambdaType: Type? = null
|
private val newLambdaType: String by lazy {
|
||||||
|
nameGenerator.genLambdaClassName()
|
||||||
|
}
|
||||||
|
|
||||||
var newConstructorDescriptor: String? = null
|
var newConstructorDescriptor: String? = null
|
||||||
|
|
||||||
@@ -38,11 +39,14 @@ class AnonymousObjectRegenerationInfo internal constructor(
|
|||||||
var capturedLambdasToInline: Map<String, LambdaInfo>? = null
|
var capturedLambdasToInline: Map<String, LambdaInfo>? = null
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
ownerInternalName: String, needReification: Boolean,
|
ownerInternalName: String,
|
||||||
|
needReification: Boolean,
|
||||||
alreadyRegenerated: Boolean,
|
alreadyRegenerated: Boolean,
|
||||||
isStaticOrigin: Boolean) : this(
|
isStaticOrigin: Boolean,
|
||||||
|
nameGenerator: NameGenerator
|
||||||
|
) : this(
|
||||||
ownerInternalName, needReification,
|
ownerInternalName, needReification,
|
||||||
HashMap<Int, LambdaInfo>(), false, alreadyRegenerated, null, isStaticOrigin) {
|
HashMap<Int, LambdaInfo>(), false, alreadyRegenerated, null, isStaticOrigin, nameGenerator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getOldClassName(): String {
|
override fun getOldClassName(): String {
|
||||||
@@ -60,11 +64,6 @@ class AnonymousObjectRegenerationInfo internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getNewClassName(): String {
|
override fun getNewClassName(): String {
|
||||||
return newLambdaType!!.internalName
|
return newLambdaType
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setNewLambdaType(newLambdaType: Type) {
|
|
||||||
this.newLambdaType = newLambdaType
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class MethodInliner {
|
|||||||
if (anonymousObjectGen.shouldRegenerate(isSameModule)) {
|
if (anonymousObjectGen.shouldRegenerate(isSameModule)) {
|
||||||
//TODO: need poping of type but what to do with local funs???
|
//TODO: need poping of type but what to do with local funs???
|
||||||
String oldClassName = anonymousObjectGen.getOldClassName();
|
String oldClassName = anonymousObjectGen.getOldClassName();
|
||||||
String newClassName = inliningContext.nameGenerator.genLambdaClassName();
|
String newClassName = anonymousObjectGen.getNewClassName();
|
||||||
remapper.addMapping(oldClassName, newClassName);
|
remapper.addMapping(oldClassName, newClassName);
|
||||||
AnonymousObjectTransformer transformer =
|
AnonymousObjectTransformer transformer =
|
||||||
new AnonymousObjectTransformer((AnonymousObjectRegenerationInfo) anonymousObjectGen,
|
new AnonymousObjectTransformer((AnonymousObjectRegenerationInfo) anonymousObjectGen,
|
||||||
@@ -500,7 +500,8 @@ public class MethodInliner {
|
|||||||
if (isAnonymousSingletonLoad(owner, fieldInsnNode.name)) {
|
if (isAnonymousSingletonLoad(owner, fieldInsnNode.name)) {
|
||||||
anonymousObjectRegenerations.add(
|
anonymousObjectRegenerations.add(
|
||||||
new AnonymousObjectRegenerationInfo(
|
new AnonymousObjectRegenerationInfo(
|
||||||
owner, awaitClassReification, isAlreadyRegenerated(owner), true
|
owner, awaitClassReification, isAlreadyRegenerated(owner), true,
|
||||||
|
inliningContext.nameGenerator
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
awaitClassReification = false;
|
awaitClassReification = false;
|
||||||
@@ -560,7 +561,8 @@ public class MethodInliner {
|
|||||||
inliningContext.classRegeneration,
|
inliningContext.classRegeneration,
|
||||||
isAlreadyRegenerated(anonymousType),
|
isAlreadyRegenerated(anonymousType),
|
||||||
desc,
|
desc,
|
||||||
false
|
false,
|
||||||
|
inliningContext.nameGenerator
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user