[Lombok] Fix substitution of java types in K2 implementation

^KT-54020 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-01-11 15:41:11 +02:00
committed by Space Team
parent 8bd3c9d019
commit da0dd519d0
5 changed files with 40 additions and 1 deletions
@@ -215,7 +215,7 @@ private class JavaTypeSubstitutorByMap(val map: Map<JavaClassifier, JavaType>) :
var hasNewArguments = false
val newArguments = type.typeArguments.map { argument ->
if (argument == null) return@map null
val newArgument = substituteOrNull(argument)
val newArgument = substituteOrSelf(argument)
if (newArgument !== argument) {
hasNewArguments = true
newArgument
@@ -0,0 +1,21 @@
// WITH_STDLIB
// ISSUE: KT-54020
// FILE: Celebrities.java
import java.util.List;
import lombok.AllArgsConstructor;
@AllArgsConstructor(staticName = "invite")
public class Celebrities {
private List<String> names;
public List<String> getNames() {
return names;
}
}
// FILE: main.kt
fun box(): String {
val celebrities = Celebrities.invite(listOf())
return if (celebrities.names.isEmpty()) "OK" else "Fail"
}
@@ -38,6 +38,12 @@ public class BlackBoxCodegenTestForLombokGenerated extends AbstractBlackBoxCodeg
runTest("plugins/lombok/testData/box/allArgsConstructor.kt");
}
@Test
@TestMetadata("allArgsConstructorInference.kt")
public void testAllArgsConstructorInference() throws Exception {
runTest("plugins/lombok/testData/box/allArgsConstructorInference.kt");
}
@Test
@TestMetadata("allArgsConstructorStatic.kt")
public void testAllArgsConstructorStatic() throws Exception {
@@ -38,6 +38,12 @@ public class FirBlackBoxCodegenTestForLombokGenerated extends AbstractFirBlackBo
runTest("plugins/lombok/testData/box/allArgsConstructor.kt");
}
@Test
@TestMetadata("allArgsConstructorInference.kt")
public void testAllArgsConstructorInference() throws Exception {
runTest("plugins/lombok/testData/box/allArgsConstructorInference.kt");
}
@Test
@TestMetadata("allArgsConstructorStatic.kt")
public void testAllArgsConstructorStatic() throws Exception {
@@ -38,6 +38,12 @@ public class IrBlackBoxCodegenTestForLombokGenerated extends AbstractIrBlackBoxC
runTest("plugins/lombok/testData/box/allArgsConstructor.kt");
}
@Test
@TestMetadata("allArgsConstructorInference.kt")
public void testAllArgsConstructorInference() throws Exception {
runTest("plugins/lombok/testData/box/allArgsConstructorInference.kt");
}
@Test
@TestMetadata("allArgsConstructorStatic.kt")
public void testAllArgsConstructorStatic() throws Exception {