Temporary workaround for KT-2619 Exception on using java enum in when.
This commit is contained in:
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.types.TypeProjection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author svtk
|
||||
@@ -45,7 +44,12 @@ public class WhenChecker {
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor;
|
||||
if (classDescriptor.getKind() != ClassKind.ENUM_CLASS || classDescriptor.getModality().isOverridable()) return false;
|
||||
ClassDescriptor classObjectDescriptor = classDescriptor.getClassObjectDescriptor();
|
||||
assert classObjectDescriptor != null;
|
||||
//TODO: workaround for KT-2619 Exception on using java enum in when.
|
||||
// should provide correct checks for java enums
|
||||
// may be obsolete once java and kotlin enum work the same way
|
||||
if (classObjectDescriptor == null) {
|
||||
return false;
|
||||
}
|
||||
JetScope memberScope = classObjectDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
Collection<ClassDescriptor> objectDescriptors = memberScope.getObjectDescriptors();
|
||||
boolean isExhaust = true;
|
||||
|
||||
Reference in New Issue
Block a user