Support updated enum entry hierarchy in JVM codegen
This commit is contained in:
@@ -244,13 +244,13 @@ public class AsmUtil {
|
|||||||
if (memberVisibility == Visibilities.LOCAL && memberDescriptor instanceof CallableMemberDescriptor) {
|
if (memberVisibility == Visibilities.LOCAL && memberDescriptor instanceof CallableMemberDescriptor) {
|
||||||
return ACC_PUBLIC;
|
return ACC_PUBLIC;
|
||||||
}
|
}
|
||||||
|
if (isEnumEntry(memberDescriptor)) {
|
||||||
|
return NO_FLAG_PACKAGE_PRIVATE;
|
||||||
|
}
|
||||||
if (memberVisibility != Visibilities.PRIVATE) {
|
if (memberVisibility != Visibilities.PRIVATE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// the following code is only for PRIVATE visibility of member
|
// the following code is only for PRIVATE visibility of member
|
||||||
if (isEnumEntry(memberDescriptor)) {
|
|
||||||
return NO_FLAG_PACKAGE_PRIVATE;
|
|
||||||
}
|
|
||||||
if (memberDescriptor instanceof ConstructorDescriptor) {
|
if (memberDescriptor instanceof ConstructorDescriptor) {
|
||||||
if (isAnonymousObject(containingDeclaration)) {
|
if (isAnonymousObject(containingDeclaration)) {
|
||||||
return NO_FLAG_PACKAGE_PRIVATE;
|
return NO_FLAG_PACKAGE_PRIVATE;
|
||||||
|
|||||||
@@ -1676,6 +1676,13 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
if (classDescriptor.getKind() == ClassKind.OBJECT) {
|
if (classDescriptor.getKind() == ClassKind.OBJECT) {
|
||||||
return StackValue.singleton(classDescriptor, typeMapper);
|
return StackValue.singleton(classDescriptor, typeMapper);
|
||||||
}
|
}
|
||||||
|
if (classDescriptor.getKind() == ClassKind.ENUM_ENTRY) {
|
||||||
|
DeclarationDescriptor enumClass = classDescriptor.getContainingDeclaration().getContainingDeclaration();
|
||||||
|
assert enumClass != null && DescriptorUtils.isEnumClass(enumClass)
|
||||||
|
: "Enum entry should be declared in enum class object: " + descriptor;
|
||||||
|
Type type = typeMapper.mapType((ClassDescriptor) enumClass);
|
||||||
|
return StackValue.field(type, type, descriptor.getName().asString(), true);
|
||||||
|
}
|
||||||
ClassDescriptor classObjectDescriptor = classDescriptor.getClassObjectDescriptor();
|
ClassDescriptor classObjectDescriptor = classDescriptor.getClassObjectDescriptor();
|
||||||
assert classObjectDescriptor != null : "Class object is not found for " + descriptor;
|
assert classObjectDescriptor != null : "Class object is not found for " + descriptor;
|
||||||
return StackValue.singleton(classObjectDescriptor, typeMapper);
|
return StackValue.singleton(classObjectDescriptor, typeMapper);
|
||||||
|
|||||||
@@ -1036,7 +1036,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void generateFieldForSingleton() {
|
private void generateFieldForSingleton() {
|
||||||
if (isEnumClass(descriptor)) return;
|
if (isEnumClass(descriptor) || isEnumEntry(descriptor)) return;
|
||||||
|
|
||||||
ClassDescriptor classObjectDescriptor = descriptor.getClassObjectDescriptor();
|
ClassDescriptor classObjectDescriptor = descriptor.getClassObjectDescriptor();
|
||||||
ClassDescriptor fieldTypeDescriptor;
|
ClassDescriptor fieldTypeDescriptor;
|
||||||
|
|||||||
Reference in New Issue
Block a user