Refactor KClassValue to store ClassLiteralValue internally
Only invariant array projections and non-null element types will be supported soon (see KT-26568), so it makes no sense to store the complete type in KClassValue. What we need is only the ClassId of the class, and the number of times it's wrapped into kotlin/Array, which is exactly what ClassLiteralValue represents. This change helps in decoupling annotation values from descriptors/types. The only constant value that depends on descriptors is now AnnotationValue. #KT-26582 Fixed
This commit is contained in:
@@ -287,6 +287,10 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
String elementDesc = nestedness == 0 ? typeDesc : type.getElementType().getDescriptor();
|
||||
JvmPrimitiveType primType = JvmPrimitiveType.getByDesc(elementDesc);
|
||||
if (primType != null) {
|
||||
if (nestedness > 0) {
|
||||
// "int[][]" should be loaded as "Array<IntArray>", not as "Array<Array<Int>>"
|
||||
return new ClassLiteralValue(ClassId.topLevel(primType.getPrimitiveType().getArrayTypeFqName()), nestedness - 1);
|
||||
}
|
||||
return new ClassLiteralValue(ClassId.topLevel(primType.getPrimitiveType().getTypeFqName()), nestedness);
|
||||
}
|
||||
ClassId javaClassId = resolveNameByDesc(elementDesc, innerClasses);
|
||||
|
||||
Reference in New Issue
Block a user