KT-20421 fixing code generation for the case when "object" extends "class". It should look like: "object: class()".
This commit is contained in:
committed by
Ilya Kirillov
parent
26ca205f7e
commit
a5368e443c
@@ -226,7 +226,7 @@ internal class JKCodeBuilder(context: NewJ2kConverterContext) {
|
||||
?.let { it as? JKDelegationConstructorCall }
|
||||
if (delegationCall != null) {
|
||||
printer.par { delegationCall.arguments.accept(this) }
|
||||
} else if (!superType.isInterface() && primaryConstructor != null) {
|
||||
} else if (!superType.isInterface() && (primaryConstructor != null || parentClass.isObjectOrCompanionObject)) {
|
||||
printer.print("()")
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Base {
|
||||
static final int F = 0;
|
||||
}
|
||||
final class A extends Base {
|
||||
static final int F1 = 0;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
internal open class Base {
|
||||
companion object {
|
||||
const val F = 0
|
||||
}
|
||||
}
|
||||
|
||||
internal object A : Base() {
|
||||
const val F1 = 0
|
||||
}
|
||||
+5
@@ -3071,6 +3071,11 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
||||
runTest("nj2k/testData/newJ2k/issues/kt-19943.java");
|
||||
}
|
||||
|
||||
@TestMetadata("kt-20421.java")
|
||||
public void testKt_20421() throws Exception {
|
||||
runTest("nj2k/testData/newJ2k/issues/kt-20421.java");
|
||||
}
|
||||
|
||||
@TestMetadata("kt-21189.java")
|
||||
public void testKt_21189() throws Exception {
|
||||
runTest("nj2k/testData/newJ2k/issues/kt-21189.java");
|
||||
|
||||
Reference in New Issue
Block a user