Kapt3: Convert reference to KMutableMap.Entry correctly (KT-17567)
This commit is contained in:
committed by
Yan Zhulanow
parent
254e8156ac
commit
99a05f5d61
@@ -37,7 +37,7 @@ class KaptTreeMaker(context: Context) : TreeMaker(context) {
|
||||
}
|
||||
|
||||
fun FqName(internalOrFqName: String): JCTree.JCExpression {
|
||||
val path = internalOrFqName.replace('/', '.').split('.')
|
||||
val path = internalOrFqName.replace('/', '.').convertSpecialFqName().split('.')
|
||||
assert(path.isNotEmpty())
|
||||
if (path.size == 1) return SimpleName(path.single())
|
||||
|
||||
@@ -48,6 +48,15 @@ class KaptTreeMaker(context: Context) : TreeMaker(context) {
|
||||
return expr
|
||||
}
|
||||
|
||||
private fun String.convertSpecialFqName(): String {
|
||||
// Hard-coded in ImplementationBodyCodegen, KOTLIN_MARKER_INTERFACES
|
||||
if (this == "kotlin.jvm.internal.markers.KMutableMap\$Entry") {
|
||||
return replace('$', '.')
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
fun convertBuiltinType(type: Type): JCTree.JCExpression? {
|
||||
val typeTag = when (type) {
|
||||
BYTE_TYPE -> TypeTag.BYTE
|
||||
|
||||
+6
@@ -168,6 +168,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt17567.kt")
|
||||
public void testKt17567() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/kt17567.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mapEntry.kt")
|
||||
public void testMapEntry() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/mapEntry.kt");
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
internal class MutableEntry<K, V>(
|
||||
private val internal: MutableMap<K, V>,
|
||||
override val key: K, value: V
|
||||
): MutableMap.MutableEntry<K, V>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package test;
|
||||
|
||||
public final class MutableEntry<K extends java.lang.Object, V extends java.lang.Object> implements java.util.Map.Entry<K, V>, kotlin.jvm.internal.markers.KMutableMap.Entry {
|
||||
private final java.util.Map<K, V> internal = null;
|
||||
private final K key = null;
|
||||
|
||||
@java.lang.Override()
|
||||
public K getKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public MutableEntry(@org.jetbrains.annotations.NotNull()
|
||||
java.util.Map<K, V> internal, K key, V value) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user