Kapt: Handle parameter with Java names clashing with Java keywords properly (KT-18377)
This commit is contained in:
committed by
Yan Zhulanow
parent
e56e3d78c8
commit
a983137978
+1
-1
@@ -437,7 +437,7 @@ class ClassFileToSourceStubConverter(
|
|||||||
info.visibleAnnotations,
|
info.visibleAnnotations,
|
||||||
info.invisibleAnnotations)
|
info.invisibleAnnotations)
|
||||||
|
|
||||||
val name = treeMaker.name(getValidIdentifierName(info.name) ?: "p${index}_" + info.name.hashCode())
|
val name = treeMaker.name(getValidIdentifierName(info.name) ?: "p${index}_" + info.name.hashCode().ushr(1))
|
||||||
val type = treeMaker.Type(info.type)
|
val type = treeMaker.Type(info.type)
|
||||||
treeMaker.VarDef(modifiers, name, type, null)
|
treeMaker.VarDef(modifiers, name, type, null)
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -180,6 +180,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt18377.kt")
|
||||||
|
public void testKt18377() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/kt18377.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mapEntry.kt")
|
@TestMetadata("mapEntry.kt")
|
||||||
public void testMapEntry() throws Exception {
|
public void testMapEntry() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/mapEntry.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/mapEntry.kt");
|
||||||
|
|||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
fun Date(double: Double): Date = Date(double.times(1000).toLong())
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
@kotlin.Metadata()
|
||||||
|
public final class Kt18377Kt {
|
||||||
|
|
||||||
|
public Kt18377Kt() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.jetbrains.annotations.NotNull()
|
||||||
|
public static final java.util.Date Date(double p0_1484504552) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -50,7 +50,7 @@ public final class Test {
|
|||||||
|
|
||||||
public final void strangeFun4(@org.jetbrains.annotations.NotNull()
|
public final void strangeFun4(@org.jetbrains.annotations.NotNull()
|
||||||
java.lang.String a, @org.jetbrains.annotations.NotNull()
|
java.lang.String a, @org.jetbrains.annotations.NotNull()
|
||||||
java.lang.String p1_1899121793) {
|
java.lang.String p1_949560896) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Test() {
|
public Test() {
|
||||||
|
|||||||
Reference in New Issue
Block a user