Minor, use module.resolveTopLevelClass() utility

This commit is contained in:
Alexander Udalov
2015-02-09 18:13:28 +03:00
parent 192e69e90b
commit 339a38b69b
4 changed files with 9 additions and 28 deletions
@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.cli.jvm.compiler;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass;
@@ -140,8 +139,7 @@ public class CliLightClassGenerationSupport extends LightClassGenerationSupport
);
}
Collection<ClassDescriptor> classDescriptors =
ResolveSessionUtils.getClassOrObjectDescriptorsByFqName(getModule(), fqName, Predicates.<ClassDescriptor>alwaysTrue());
Collection<ClassDescriptor> classDescriptors = ResolveSessionUtils.getClassDescriptorsByFqName(getModule(), fqName);
return ContainerUtil.mapNotNull(classDescriptors, new Function<ClassDescriptor, JetClassOrObject>() {
@Override
@@ -38,28 +38,12 @@ import java.util.Collections;
public class ResolveSessionUtils {
public static final Predicate<ClassDescriptor> NON_SINGLETON_FILTER = new Predicate<ClassDescriptor>() {
@Override
public boolean apply(@Nullable ClassDescriptor descriptor) {
assert descriptor != null;
return !descriptor.getKind().isSingleton();
}
};
public static final Predicate<ClassDescriptor> SINGLETON_FILTER = new Predicate<ClassDescriptor>() {
@Override
public boolean apply(@Nullable ClassDescriptor descriptor) {
assert descriptor != null;
return descriptor.getKind().isSingleton();
}
};
private ResolveSessionUtils() {
}
@NotNull
public static Collection<ClassDescriptor> getClassDescriptorsByFqName(@NotNull ModuleDescriptor moduleDescriptor, @NotNull FqName fqName) {
return getClassOrObjectDescriptorsByFqName(moduleDescriptor, fqName, NON_SINGLETON_FILTER);
return getClassOrObjectDescriptorsByFqName(moduleDescriptor, fqName, Predicates.<ClassDescriptor>alwaysTrue());
}
@NotNull