JVM_IR: skip private declarations in imported classes
This commit is contained in:
+5
-3
@@ -37,11 +37,13 @@ abstract class IrLazyDeclarationBase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun generateChildStubs(descriptors: Collection<DeclarationDescriptor>, declarations: MutableList<IrDeclaration>) {
|
protected fun generateChildStubs(descriptors: Collection<DeclarationDescriptor>, declarations: MutableList<IrDeclaration>) {
|
||||||
descriptors.mapTo(declarations) { generateMemberStub(it) }
|
descriptors.mapNotNullTo(declarations) { generateMemberStub(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateMemberStub(descriptor: DeclarationDescriptor): IrDeclaration =
|
private fun generateMemberStub(descriptor: DeclarationDescriptor): IrDeclaration? {
|
||||||
stubGenerator.generateMemberStub(descriptor)
|
if (descriptor is DeclarationDescriptorWithVisibility && Visibilities.isPrivate(descriptor.visibility)) return null
|
||||||
|
return stubGenerator.generateMemberStub(descriptor)
|
||||||
|
}
|
||||||
|
|
||||||
override var parent: IrDeclarationParent by lazyVar {
|
override var parent: IrDeclarationParent by lazyVar {
|
||||||
createLazyParent()!!
|
createLazyParent()!!
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// FILE: C.java
|
||||||
|
public enum C {
|
||||||
|
OK(0);
|
||||||
|
|
||||||
|
private final int ordinal;
|
||||||
|
|
||||||
|
C(int ordinal) { this.ordinal = ordinal; }
|
||||||
|
|
||||||
|
public int getOrdinal() { return ordinal; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
fun box(): String {
|
||||||
|
val ok = C.OK
|
||||||
|
return when (ok) {
|
||||||
|
C.OK -> "OK"
|
||||||
|
else -> "fail"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public superTypes:[<unbound IrClassSymbolImpl>; <unbound IrClassSymbolImpl><kotlin.Int>; <unbound IrClassSymbolImpl>]
|
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public superTypes:[<unbound IrClassSymbolImpl>; <unbound IrClassSymbolImpl><kotlin.Int>; <unbound IrClassSymbolImpl>]
|
||||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int
|
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int
|
||||||
CONSTRUCTOR IR_EXTERNAL_DECLARATION_STUB visibility:private <> () returnType:kotlin.Int [primary]
|
|
||||||
FUN IR_EXTERNAL_DECLARATION_STUB name:and visibility:public modality:FINAL <> ($this:kotlin.Int, other:kotlin.Int) returnType:kotlin.Int
|
FUN IR_EXTERNAL_DECLARATION_STUB name:and visibility:public modality:FINAL <> ($this:kotlin.Int, other:kotlin.Int) returnType:kotlin.Int
|
||||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int
|
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int
|
||||||
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Int
|
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Int
|
||||||
@@ -239,7 +238,6 @@ CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:publ
|
|||||||
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Int
|
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Int
|
||||||
CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[<unbound IrClassSymbolImpl>]
|
CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[<unbound IrClassSymbolImpl>]
|
||||||
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int.Companion
|
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int.Companion
|
||||||
CONSTRUCTOR IR_EXTERNAL_DECLARATION_STUB visibility:private <> () returnType:kotlin.Int.Companion [primary]
|
|
||||||
PROPERTY IR_EXTERNAL_DECLARATION_STUB name:MAX_VALUE visibility:public modality:FINAL [const,val]
|
PROPERTY IR_EXTERNAL_DECLARATION_STUB name:MAX_VALUE visibility:public modality:FINAL [const,val]
|
||||||
FIELD IR_EXTERNAL_DECLARATION_STUB name:MAX_VALUE type:kotlin.Int visibility:public [final]
|
FIELD IR_EXTERNAL_DECLARATION_STUB name:MAX_VALUE type:kotlin.Int visibility:public [final]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
|
|||||||
+5
@@ -220,6 +220,11 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxAga
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/enum"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/enum"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nameConflict.kt")
|
||||||
|
public void testNameConflict() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxAgainstJava/enum/nameConflict.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simpleJavaEnum.kt")
|
@TestMetadata("simpleJavaEnum.kt")
|
||||||
public void testSimpleJavaEnum() throws Exception {
|
public void testSimpleJavaEnum() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt");
|
runTest("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt");
|
||||||
|
|||||||
Generated
+5
@@ -221,6 +221,11 @@ public class IrBlackBoxAgainstJavaCodegenTestGenerated extends AbstractIrBlackBo
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/enum"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/enum"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nameConflict.kt")
|
||||||
|
public void testNameConflict() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxAgainstJava/enum/nameConflict.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simpleJavaEnum.kt")
|
@TestMetadata("simpleJavaEnum.kt")
|
||||||
public void testSimpleJavaEnum() throws Exception {
|
public void testSimpleJavaEnum() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt");
|
runTest("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user