New J2K: add default null value to property with type parameter type when it is implicit in Java
#KT-32436 fixed
This commit is contained in:
@@ -32,9 +32,8 @@ class ImplicitInitializerConversion(private val context: NewJ2kConverterContext)
|
||||
return recurse(element)
|
||||
}
|
||||
|
||||
val fieldType = element.type.type
|
||||
val newInitializer = when (fieldType) {
|
||||
is JKClassType -> JKNullLiteral()
|
||||
val newInitializer = when (val fieldType = element.type.type) {
|
||||
is JKClassType, is JKTypeParameterType -> JKNullLiteral()
|
||||
is JKJavaPrimitiveType -> createPrimitiveTypeInitializer(fieldType)
|
||||
else -> null
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class JClass<T> {
|
||||
private T name;
|
||||
public T getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class JClass<T> {
|
||||
val name: T? = null
|
||||
}
|
||||
+5
@@ -2871,6 +2871,11 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
||||
runTest("nj2k/testData/newJ2k/issues/kt-31818.java");
|
||||
}
|
||||
|
||||
@TestMetadata("kt-32436.java")
|
||||
public void testKt_32436() throws Exception {
|
||||
runTest("nj2k/testData/newJ2k/issues/kt-32436.java");
|
||||
}
|
||||
|
||||
@TestMetadata("kt-5294.java")
|
||||
public void testKt_5294() throws Exception {
|
||||
runTest("nj2k/testData/newJ2k/issues/kt-5294.java");
|
||||
|
||||
Reference in New Issue
Block a user