@NotNull private static PsiClass findCorrespondingLightClass( @NotNull JetClassOrObject decompiledClassOrObject, @NotNull PsiClass rootLightClassForDecompiledFile) { FqName relativeFqName = getClassRelativeName(decompiledClassOrObject); Iterator<Name> iterator = relativeFqName.pathSegments().iterator(); Name base = iterator.next(); assert rootLightClassForDecompiledFile.getName().equals(base.asString()) : "Light class for file:\n" + decompiledClassOrObject.getContainingJetFile().getVirtualFile().getCanonicalPath() + "\nwas expected to have name: " + base.asString() + "\n Actual: " + rootLightClassForDecompiledFile.getName(); PsiClass current = rootLightClassForDecompiledFile; while (iterator.hasNext()) { Name name = iterator.next(); PsiClass innerClass = current.findInnerClassByName(name.asString(), false); assert innerClass != null : "Could not find corresponding inner/nested class " + relativeFqName + " in class " + decompiledClassOrObject.getFqName() + "\n" + "File: " + decompiledClassOrObject.getContainingJetFile().getVirtualFile().getName(); current = innerClass; } return current; }
private static void removeDuplicateTypes(Set<JetType> conflictingTypes) { for (Iterator<JetType> iterator = conflictingTypes.iterator(); iterator.hasNext(); ) { JetType type = iterator.next(); for (JetType otherType : conflictingTypes) { boolean subtypeOf = JetTypeChecker.DEFAULT.equalTypes(type, otherType); if (type != otherType && subtypeOf) { iterator.remove(); break; } } } }