Generate enum entries classes with package private visibility
#KT-6574 Fixed
This commit is contained in:
@@ -407,6 +407,9 @@ public class AsmUtil {
|
|||||||
if (ExpectedActualDeclarationChecker.isOptionalAnnotationClass(descriptor)) {
|
if (ExpectedActualDeclarationChecker.isOptionalAnnotationClass(descriptor)) {
|
||||||
return NO_FLAG_PACKAGE_PRIVATE;
|
return NO_FLAG_PACKAGE_PRIVATE;
|
||||||
}
|
}
|
||||||
|
if (descriptor.getKind() == ClassKind.ENUM_ENTRY) {
|
||||||
|
return NO_FLAG_PACKAGE_PRIVATE;
|
||||||
|
}
|
||||||
if (descriptor.getVisibility() == Visibilities.PUBLIC ||
|
if (descriptor.getVisibility() == Visibilities.PUBLIC ||
|
||||||
descriptor.getVisibility() == Visibilities.PROTECTED ||
|
descriptor.getVisibility() == Visibilities.PROTECTED ||
|
||||||
// TODO: should be package private, but for now Kotlin's reflection can't access members of such classes
|
// TODO: should be package private, but for now Kotlin's reflection can't access members of such classes
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
enum class Foo {
|
||||||
|
A {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TESTED_OBJECT_KIND: class
|
||||||
|
// TESTED_OBJECTS: Foo$A
|
||||||
|
// FLAGS: ACC_FINAL, ACC_SUPER
|
||||||
+18
@@ -248,6 +248,24 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/writeFlags/class/visibility/packageprivate")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Packageprivate extends AbstractWriteFlagsTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInPackageprivate() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/writeFlags/class/visibility/packageprivate"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("enumEntry.kt")
|
||||||
|
public void testEnumEntry() throws Exception {
|
||||||
|
runTest("compiler/testData/writeFlags/class/visibility/packageprivate/enumEntry.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/writeFlags/class/visibility/private")
|
@TestMetadata("compiler/testData/writeFlags/class/visibility/private")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user