Move utilities out of runtime modules

DescriptorUtils & DescriptorSubstitutor contained a lot of utilities that were
used only in compiler & IDE. Move them closer to their usages
This commit is contained in:
Alexander Udalov
2013-10-24 16:36:33 +04:00
parent e04f7c24fa
commit eb11a7dc88
22 changed files with 270 additions and 259 deletions
@@ -41,13 +41,15 @@ import org.jetbrains.jet.lang.psi.JetDeclaration;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.types.JetType;
import java.io.File;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
import static org.jetbrains.jet.lang.types.TypeUtils.getAllSupertypes;
@SuppressWarnings("JUnitTestCaseWithNoTests")
public class TestlibTest extends UsefulTestCase {
public static Test suite() {
@@ -123,8 +125,8 @@ public class TestlibTest extends UsefulTestCase {
BindingContext.DECLARATION_TO_DESCRIPTOR,
declaration);
for (ClassDescriptor superClass : DescriptorUtils.getAllSuperClasses(descriptor)) {
if (!"junit/framework/Test".equals(typeMapper.mapClass(superClass).getInternalName())) continue;
for (JetType superType : getAllSupertypes(descriptor.getDefaultType())) {
if (!"junit/framework/Test".equals(typeMapper.mapType(superType).getInternalName())) continue;
String name = typeMapper.mapClass(descriptor).getInternalName();
@@ -23,11 +23,11 @@ import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiFactory;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.lazy.KotlinTestWithEnvironment;
import org.jetbrains.jet.lang.resolve.lazy.LazyResolveTestUtil;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.BoundsSubstitutor;
import org.jetbrains.jet.renderer.DescriptorRenderer;
import java.util.Collection;
@@ -76,7 +76,7 @@ public class BoundsSubstitutorTest extends KotlinTestWithEnvironment {
assert functions.size() == 1 : "Many functions defined";
FunctionDescriptor function = ContainerUtil.getFirstItem(functions);
FunctionDescriptor substituted = DescriptorUtils.substituteBounds(function);
FunctionDescriptor substituted = BoundsSubstitutor.substituteBounds(function);
String actual = DescriptorRenderer.COMPACT.render(substituted);
assertEquals(expected, actual);
}