Fix unbound class literals for inline classes
#KT-28361 Fixed
This commit is contained in:
@@ -1217,8 +1217,16 @@ public class AsmUtil {
|
||||
return JvmClassName.byFqNameWithoutInnerClasses(fqName).getInternalName();
|
||||
}
|
||||
|
||||
public static void putJavaLangClassInstance(@NotNull InstructionAdapter v, @NotNull Type type) {
|
||||
if (isPrimitive(type)) {
|
||||
public static void putJavaLangClassInstance(
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull Type type,
|
||||
@Nullable KotlinType kotlinType,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
if (kotlinType != null && InlineClassesUtilsKt.isInlineClassType(kotlinType)) {
|
||||
v.aconst(boxType(type, kotlinType, state));
|
||||
}
|
||||
else if (isPrimitive(type)) {
|
||||
v.getstatic(boxType(type).getInternalName(), "TYPE", "Ljava/lang/Class;");
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -402,7 +402,9 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
|
||||
if (container instanceof ClassDescriptor) {
|
||||
// TODO: would it work for arrays?
|
||||
putJavaLangClassInstance(iv, state.getTypeMapper().mapClass((ClassDescriptor) container));
|
||||
SimpleType containerKotlinType = ((ClassDescriptor) container).getDefaultType();
|
||||
Type containerType = state.getTypeMapper().mapClass((ClassDescriptor) container);
|
||||
putJavaLangClassInstance(iv, containerType, containerKotlinType, state);
|
||||
}
|
||||
else if (container instanceof PackageFragmentDescriptor) {
|
||||
iv.aconst(state.getTypeMapper().mapOwner(descriptor));
|
||||
|
||||
@@ -3123,7 +3123,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(type, ReifiedTypeInliner.OperationKind.JAVA_CLASS);
|
||||
}
|
||||
|
||||
putJavaLangClassInstance(v, typeMapper.mapType(type));
|
||||
putJavaLangClassInstance(v, typeMapper.mapType(type), type, state);
|
||||
}
|
||||
|
||||
if (wrapIntoKClass) {
|
||||
|
||||
Reference in New Issue
Block a user