Enum entry has final modality when loaded from binaries.
This commit is contained in:
+3
-2
@@ -1182,10 +1182,11 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
|
|
||||||
DeclarationDescriptor realOwner = getRealOwner(owner, scopeData, anyMember.getMember().isStatic());
|
DeclarationDescriptor realOwner = getRealOwner(owner, scopeData, anyMember.getMember().isStatic());
|
||||||
|
|
||||||
|
boolean isEnumEntry = DescriptorUtils.isEnumClassObject(realOwner);
|
||||||
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
|
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
|
||||||
realOwner,
|
realOwner,
|
||||||
resolveAnnotations(anyMember.getMember().psiMember),
|
resolveAnnotations(anyMember.getMember().psiMember),
|
||||||
resolveModality(anyMember.getMember(), isFinal),
|
resolveModality(anyMember.getMember(), isFinal || isEnumEntry),
|
||||||
visibility,
|
visibility,
|
||||||
isVar,
|
isVar,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -1194,7 +1195,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
//TODO: this is a hack to indicate that this enum entry is an object
|
//TODO: this is a hack to indicate that this enum entry is an object
|
||||||
// class descriptor for enum entries is not used by backends so for now this should be safe to use
|
// class descriptor for enum entries is not used by backends so for now this should be safe to use
|
||||||
// remove this when JavaDescriptorResolver gets rewritten
|
// remove this when JavaDescriptorResolver gets rewritten
|
||||||
if (DescriptorUtils.isEnumClassObject(realOwner)) {
|
if (isEnumEntry) {
|
||||||
ClassDescriptorImpl dummyClassDescriptorForEnumEntryObject =
|
ClassDescriptorImpl dummyClassDescriptorForEnumEntryObject =
|
||||||
new ClassDescriptorImpl(realOwner, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, propertyName);
|
new ClassDescriptorImpl(realOwner, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, propertyName);
|
||||||
dummyClassDescriptorForEnumEntryObject.initialize(
|
dummyClassDescriptorForEnumEntryObject.initialize(
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
private enum class Pr {
|
||||||
|
A
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum class In {
|
||||||
|
A
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum class Pu {
|
||||||
|
A
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
namespace test
|
||||||
|
|
||||||
|
internal final enum class test.In : jet.Enum<test.In> {
|
||||||
|
public final /*constructor*/ fun <init>(/*0*/ p0: jet.String?, /*1*/ p1: jet.Int): test.In
|
||||||
|
public final override /*1*/ fun name(): jet.String
|
||||||
|
public final override /*1*/ fun ordinal(): jet.Int
|
||||||
|
internal final class object test.In.<class-object-for-In> {
|
||||||
|
public final /*constructor*/ fun <init>(): test.In.<class-object-for-In>
|
||||||
|
public final val A: test.In
|
||||||
|
public final fun valueOf(/*0*/ value: jet.String): test.In
|
||||||
|
public final fun values(): jet.Array<test.In>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private final enum class test.Pr : jet.Enum<test.Pr> {
|
||||||
|
public final /*constructor*/ fun <init>(/*0*/ p0: jet.String?, /*1*/ p1: jet.Int): test.Pr
|
||||||
|
public final override /*1*/ fun name(): jet.String
|
||||||
|
public final override /*1*/ fun ordinal(): jet.Int
|
||||||
|
private final class object test.Pr.<class-object-for-Pr> {
|
||||||
|
public final /*constructor*/ fun <init>(): test.Pr.<class-object-for-Pr>
|
||||||
|
public final val A: test.Pr
|
||||||
|
public final fun valueOf(/*0*/ value: jet.String): test.Pr
|
||||||
|
public final fun values(): jet.Array<test.Pr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public final enum class test.Pu : jet.Enum<test.Pu> {
|
||||||
|
public final /*constructor*/ fun <init>(/*0*/ p0: jet.String?, /*1*/ p1: jet.Int): test.Pu
|
||||||
|
public final override /*1*/ fun name(): jet.String
|
||||||
|
public final override /*1*/ fun ordinal(): jet.Int
|
||||||
|
public final class object test.Pu.<class-object-for-Pu> {
|
||||||
|
public final /*constructor*/ fun <init>(): test.Pu.<class-object-for-Pu>
|
||||||
|
public final val A: test.Pu
|
||||||
|
public final fun valueOf(/*0*/ value: jet.String): test.Pu
|
||||||
|
public final fun values(): jet.Array<test.Pu>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ internal final enum class test.MyEnum : jet.Enum<test.MyEnum> {
|
|||||||
public final override /*1*/ fun ordinal(): jet.Int
|
public final override /*1*/ fun ordinal(): jet.Int
|
||||||
internal final class object test.MyEnum.<class-object-for-MyEnum> {
|
internal final class object test.MyEnum.<class-object-for-MyEnum> {
|
||||||
public final /*constructor*/ fun <init>(): test.MyEnum.<class-object-for-MyEnum>
|
public final /*constructor*/ fun <init>(): test.MyEnum.<class-object-for-MyEnum>
|
||||||
public open val ENTRY: test.MyEnum
|
public final val ENTRY: test.MyEnum
|
||||||
public final fun valueOf(/*0*/ value: jet.String): test.MyEnum
|
public final fun valueOf(/*0*/ value: jet.String): test.MyEnum
|
||||||
public final fun values(): jet.Array<test.MyEnum>
|
public final fun values(): jet.Array<test.MyEnum>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,4 +49,10 @@ public final class LoadCompiledKotlinCustomTest extends TestCaseWithTmpdir {
|
|||||||
doTest(dir + "/simpleEnum.txt",
|
doTest(dir + "/simpleEnum.txt",
|
||||||
dir + "/simpleEnum.kt");
|
dir + "/simpleEnum.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testEnumVisibility() throws Exception {
|
||||||
|
String dir = PATH + "/enum";
|
||||||
|
doTest(dir + "/enumVisibility.txt",
|
||||||
|
dir + "/enumVisibility.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ package testData.libraries
|
|||||||
|
|
||||||
[public final enum class Color : jet.Enum<testData.libraries.Color> {
|
[public final enum class Color : jet.Enum<testData.libraries.Color> {
|
||||||
class object {
|
class object {
|
||||||
[public open val BLUE : testData.libraries.Color] /* compiled code */
|
[public final val BLUE : testData.libraries.Color] /* compiled code */
|
||||||
|
|
||||||
[public open val GREEN : testData.libraries.Color] /* compiled code */
|
[public final val GREEN : testData.libraries.Color] /* compiled code */
|
||||||
|
|
||||||
[public open val RED : testData.libraries.Color] /* compiled code */
|
[public final val RED : testData.libraries.Color] /* compiled code */
|
||||||
|
|
||||||
public final fun valueOf(value : jet.String) : testData.libraries.Color { /* compiled code */ }
|
public final fun valueOf(value : jet.String) : testData.libraries.Color { /* compiled code */ }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user