Generate private constructors for Enums
#KT-2680 Fixed #KT-16867 Fixed
This commit is contained in:
@@ -546,16 +546,8 @@ public class AsmUtil {
|
|||||||
return NO_FLAG_PACKAGE_PRIVATE;
|
return NO_FLAG_PACKAGE_PRIVATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the following code is only for PRIVATE visibility of member
|
if (memberDescriptor instanceof ConstructorDescriptor && isEnumEntry(containingDeclaration)) {
|
||||||
if (memberDescriptor instanceof ConstructorDescriptor) {
|
return NO_FLAG_PACKAGE_PRIVATE;
|
||||||
if (isEnumEntry(containingDeclaration)) {
|
|
||||||
return NO_FLAG_PACKAGE_PRIVATE;
|
|
||||||
}
|
|
||||||
if (isEnumClass(containingDeclaration)) {
|
|
||||||
//TODO: should be ACC_PRIVATE
|
|
||||||
// see http://youtrack.jetbrains.com/issue/KT-2680
|
|
||||||
return ACC_PROTECTED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ public enum E {
|
|||||||
@kotlin.Deprecated(message = "b")
|
@kotlin.Deprecated(message = "b")
|
||||||
Entry3;
|
Entry3;
|
||||||
|
|
||||||
protected E() { /* compiled code */ }
|
private E() { /* compiled code */ }
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ public final enum class TestEnum {
|
|||||||
public final static field ANSWER: TestEnum
|
public final static field ANSWER: TestEnum
|
||||||
private final field z: int
|
private final field z: int
|
||||||
static method <clinit>(): void
|
static method <clinit>(): void
|
||||||
protected method <init>(p0: java.lang.String, p1: int, p2: int): void
|
private method <init>(p0: java.lang.String, p1: int, p2: int): void
|
||||||
public final method getZ(): int
|
public final method getZ(): int
|
||||||
public static method valueOf(p0: java.lang.String): TestEnum
|
public static method valueOf(p0: java.lang.String): TestEnum
|
||||||
public static method values(): TestEnum[]
|
public static method values(): TestEnum[]
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
enum class Foo {
|
||||||
|
A, B, C
|
||||||
|
}
|
||||||
|
|
||||||
|
// TESTED_OBJECT_KIND: function
|
||||||
|
// TESTED_OBJECTS: Foo, <init>
|
||||||
|
// FLAGS: ACC_PRIVATE
|
||||||
+5
@@ -444,6 +444,11 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
|
|||||||
runTest("compiler/testData/writeFlags/function/constructors/classObject.kt");
|
runTest("compiler/testData/writeFlags/function/constructors/classObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("enum.kt")
|
||||||
|
public void testEnum() throws Exception {
|
||||||
|
runTest("compiler/testData/writeFlags/function/constructors/enum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("objectInClass.kt")
|
@TestMetadata("objectInClass.kt")
|
||||||
public void testObjectInClass() throws Exception {
|
public void testObjectInClass() throws Exception {
|
||||||
runTest("compiler/testData/writeFlags/function/constructors/objectInClass.kt");
|
runTest("compiler/testData/writeFlags/function/constructors/objectInClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user