diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java index d3aa33794c5..c3295dbb0d6 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java @@ -387,4 +387,13 @@ public class DescriptorUtils { Collections.sort(resultList); return resultList; } + + @Nullable + public static ClassDescriptor getInnerClassByName(@NotNull ClassDescriptor classDescriptor, @NotNull String innerClassName) { + ClassifierDescriptor classifier = classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName)); + assert classifier instanceof ClassDescriptor : + "Inner class " + innerClassName + " in " + classDescriptor + " should be instance of ClassDescriptor, but was: " + + (classifier == null ? "null" : classifier.getClass()); + return (ClassDescriptor) classifier; + } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/JetStandardLibrary.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/JetStandardLibrary.java index b9c8babd32f..5c3bf472d71 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/JetStandardLibrary.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/JetStandardLibrary.java @@ -31,6 +31,7 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.resolve.AnalyzingUtils; import org.jetbrains.jet.lang.resolve.BindingTraceContext; +import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.TopDownAnalyzer; import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.scopes.JetScope; @@ -428,14 +429,14 @@ public class JetStandardLibrary { @NotNull public ClassDescriptor getMapEntry() { - ClassifierDescriptor entry = getMap().getDefaultType().getMemberScope().getClassifier(Name.identifier("Entry")); + ClassifierDescriptor entry = DescriptorUtils.getInnerClassByName(getMap(), "Entry"); assert entry instanceof ClassDescriptor; return (ClassDescriptor) entry; } @NotNull public ClassDescriptor getMutableMapEntry() { - ClassifierDescriptor entry = getMutableMap().getDefaultType().getMemberScope().getClassifier(Name.identifier("MutableEntry")); + ClassifierDescriptor entry = DescriptorUtils.getInnerClassByName(getMutableMap(), "MutableEntry"); assert entry instanceof ClassDescriptor; return (ClassDescriptor) entry; }