Got rid of "namespace" word in compiler code.
This commit is contained in:
@@ -220,8 +220,8 @@ public class JetTestUtils {
|
||||
private JetTestUtils() {
|
||||
}
|
||||
|
||||
public static AnalyzeExhaust analyzeFile(@NotNull JetFile namespace) {
|
||||
return AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(namespace, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
public static AnalyzeExhaust analyzeFile(@NotNull JetFile file) {
|
||||
return AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -47,8 +47,8 @@ public class JUnitUsageGenTest extends CodegenTestCase {
|
||||
|
||||
public void testKt1592() throws Exception {
|
||||
loadFile("junit/kt1592.kt");
|
||||
Class<?> namespaceClass = generatePackageClass();
|
||||
Method method = namespaceClass.getMethod("foo", Method.class);
|
||||
Class<?> packageClass = generatePackageClass();
|
||||
Method method = packageClass.getMethod("foo", Method.class);
|
||||
method.setAccessible(true);
|
||||
Annotation annotation = method.getAnnotation(getCorrespondingAnnotationClass(Test.class));
|
||||
assertEquals(ClassLoaderIsolationUtil.getAnnotationAttribute(annotation, "timeout"), 0l);
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.Set;
|
||||
import static org.jetbrains.jet.codegen.KotlinPackageAnnotationTest.collectCallableNames;
|
||||
|
||||
public class KotlinClassAnnotationTest extends CodegenTestCase {
|
||||
public static final FqName NAMESPACE_NAME = new FqName("test");
|
||||
public static final FqName PACKAGE_NAME = new FqName("test");
|
||||
public static final FqNameUnsafe CLASS_NAME = new FqNameUnsafe("A");
|
||||
|
||||
@Override
|
||||
@@ -40,13 +40,13 @@ public class KotlinClassAnnotationTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testClassKotlinInfo() throws Exception {
|
||||
loadText("package " + NAMESPACE_NAME + "\n" +
|
||||
loadText("package " + PACKAGE_NAME + "\n" +
|
||||
"\n" +
|
||||
"class " + CLASS_NAME + " {\n" +
|
||||
" fun foo() {}\n" +
|
||||
" fun bar() = 42\n" +
|
||||
"}\n");
|
||||
Class aClass = generateClass(NAMESPACE_NAME + "." + CLASS_NAME);
|
||||
Class aClass = generateClass(PACKAGE_NAME + "." + CLASS_NAME);
|
||||
|
||||
Class<? extends Annotation> annotationClass = getCorrespondingAnnotationClass(KotlinClass.class);
|
||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
||||
public static final FqName NAMESPACE_NAME = new FqName("test");
|
||||
public static final FqName PACKAGE_NAME = new FqName("test");
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -42,7 +42,7 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testPackageKotlinInfo() throws Exception {
|
||||
loadText("package " + NAMESPACE_NAME + "\n" +
|
||||
loadText("package " + PACKAGE_NAME + "\n" +
|
||||
"\n" +
|
||||
"fun foo() = 42\n" +
|
||||
"val bar = 239\n" +
|
||||
@@ -50,7 +50,7 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
||||
"class A\n" +
|
||||
"class B\n" +
|
||||
"object C\n");
|
||||
Class aClass = generateClass(PackageClassUtils.getPackageClassFqName(NAMESPACE_NAME).asString());
|
||||
Class aClass = generateClass(PackageClassUtils.getPackageClassFqName(PACKAGE_NAME).asString());
|
||||
|
||||
Class<? extends Annotation> annotationClass = getCorrespondingAnnotationClass(KotlinPackage.class);
|
||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public class KotlinPackageFragmentAnnotationTest extends CodegenTestCase {
|
||||
public static final FqName NAMESPACE_NAME = new FqName("test");
|
||||
public static final FqName PACKAGE_NAME = new FqName("test");
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -37,8 +37,8 @@ public class KotlinPackageFragmentAnnotationTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKotlinPackageFragmentIsWritten() throws Exception {
|
||||
loadText("package " + NAMESPACE_NAME + "\n\nfun foo() = 42\n");
|
||||
String facadeFileName = JvmClassName.byFqNameWithoutInnerClasses(PackageClassUtils.getPackageClassFqName(NAMESPACE_NAME)).getInternalName() + ".class";
|
||||
loadText("package " + PACKAGE_NAME + "\n\nfun foo() = 42\n");
|
||||
String facadeFileName = JvmClassName.byFqNameWithoutInnerClasses(PackageClassUtils.getPackageClassFqName(PACKAGE_NAME)).getInternalName() + ".class";
|
||||
|
||||
OutputFileCollection outputFiles = generateClassesInFile();
|
||||
for (OutputFile outputFile : outputFiles.asList()) {
|
||||
|
||||
@@ -333,7 +333,7 @@ public class LineNumberTest extends TestCaseWithTmpdir {
|
||||
assertNotNull(file);
|
||||
ClassReader reader = new ClassReader(file.asByteArray());
|
||||
|
||||
// There must be exactly one line number attribute for each static delegate in namespace.class, and it should point to the first
|
||||
// There must be exactly one line number attribute for each static delegate in package facade class, and it should point to the first
|
||||
// line. There are two static delegates in this test, hence the [1, 1]
|
||||
List<Integer> expectedLineNumbers = Arrays.asList(1, 1);
|
||||
List<Integer> actualLineNumbers = readAllLineNumbers(reader);
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import jet.IntRange;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -27,7 +26,7 @@ import java.util.Arrays;
|
||||
|
||||
import static org.jetbrains.jet.codegen.CodegenTestUtil.assertIsCurrentTime;
|
||||
|
||||
public class NamespaceGenTest extends CodegenTestCase {
|
||||
public class PackageGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -74,7 +74,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
assertNotNull(findDeclaredMethodByName(aClass, "setFoo"));
|
||||
}
|
||||
|
||||
public void testPrivatePropertyInNamespace() throws Exception {
|
||||
public void testPrivatePropertyInPackage() throws Exception {
|
||||
loadText("private val x = 239");
|
||||
Class nsClass = generatePackagePartClass();
|
||||
Field[] fields = nsClass.getDeclaredFields();
|
||||
@@ -135,7 +135,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
assertEquals(610, getFoo.invoke(instance));
|
||||
}
|
||||
|
||||
public void testInitializersForNamespaceProperties() throws Exception {
|
||||
public void testInitializersForTopLevelProperties() throws Exception {
|
||||
loadText("val x = System.currentTimeMillis()");
|
||||
Method method = generateFunction("getX");
|
||||
method.setAccessible(true);
|
||||
|
||||
@@ -28,13 +28,13 @@ public class SourceInfoGenTest extends CodegenTestCase {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
}
|
||||
|
||||
public void testSingleFileNamespace() {
|
||||
public void testSingleFilePackage() {
|
||||
String producer = "sourceInfo/foo1.kt";
|
||||
loadFiles(producer);
|
||||
assertEquals(producer, getProducerInfo("foo/FooPackage.class"));
|
||||
}
|
||||
|
||||
public void testMultiFileNamespace() {
|
||||
public void testMultiFilePackage() {
|
||||
loadFiles("sourceInfo/foo1.kt", "sourceInfo/foo2.kt");
|
||||
assertEquals(null, getProducerInfo("foo/FooPackage.class"));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import static org.jetbrains.jet.test.util.DescriptorValidator.ValidationVisitor.
|
||||
import static org.jetbrains.jet.test.util.RecursiveDescriptorComparator.*;
|
||||
|
||||
/*
|
||||
The generated test compares namespace descriptors loaded from kotlin sources and read from compiled java.
|
||||
The generated test compares package descriptors loaded from kotlin sources and read from compiled java.
|
||||
*/
|
||||
public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
protected void doTestCompiledJava(@NotNull String javaFileName) throws Exception {
|
||||
@@ -153,7 +153,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
injectorForAnalyzer.getTopDownAnalyzer().analyzeFiles(environment.getSourceFiles(), Collections.<AnalyzerScriptParameter>emptyList());
|
||||
|
||||
PackageViewDescriptor packageView = module.getPackage(TEST_PACKAGE_FQNAME);
|
||||
assert packageView != null : "Test namespace not found";
|
||||
assert packageView != null : "Test package not found";
|
||||
|
||||
checkJavaPackage(expectedFile, packageView, trace.getBindingContext(), DONT_INCLUDE_METHODS_OF_OBJECT);
|
||||
}
|
||||
@@ -166,10 +166,10 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
assertTrue(testPackageDir.mkdir());
|
||||
FileUtil.copy(originalJavaFile, new File(testPackageDir, originalJavaFile.getName()));
|
||||
|
||||
Pair<PackageViewDescriptor, BindingContext> javaNamespaceAndContext = loadTestPackageAndBindingContextFromJavaRoot(
|
||||
Pair<PackageViewDescriptor, BindingContext> javaPackageAndContext = loadTestPackageAndBindingContextFromJavaRoot(
|
||||
tmpdir, getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
|
||||
|
||||
checkJavaPackage(expectedFile, javaNamespaceAndContext.first, javaNamespaceAndContext.second,
|
||||
checkJavaPackage(expectedFile, javaPackageAndContext.first, javaPackageAndContext.second,
|
||||
DONT_INCLUDE_METHODS_OF_OBJECT.withValidationStrategy(ALLOW_ERROR_TYPES));
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
private static void checkForLoadErrorsAndCompare(
|
||||
@NotNull PackageViewDescriptor javaPackage,
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull Runnable compareNamespacesRunnable
|
||||
@NotNull Runnable comparePackagesRunnable
|
||||
) {
|
||||
boolean fail = false;
|
||||
try {
|
||||
@@ -225,7 +225,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
fail = true;
|
||||
}
|
||||
|
||||
compareNamespacesRunnable.run();
|
||||
comparePackagesRunnable.run();
|
||||
if (fail) {
|
||||
fail("See error above");
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
);
|
||||
|
||||
PackageViewDescriptor packageView = exhaust.getModuleDescriptor().getPackage(LoadDescriptorUtil.TEST_PACKAGE_FQNAME);
|
||||
assertNotNull("Failed to find namespace: " + LoadDescriptorUtil.TEST_PACKAGE_FQNAME, packageView);
|
||||
assertNotNull("Failed to find package: " + LoadDescriptorUtil.TEST_PACKAGE_FQNAME, packageView);
|
||||
return packageView;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public abstract class AbstractLazyResolveDiagnosticsTest extends BaseDiagnostics
|
||||
String txtFileRelativePath = path.replaceAll("\\.kt$|\\.ktscript", ".txt");
|
||||
File txtFile = new File("compiler/testData/lazyResolve/diagnostics/" + txtFileRelativePath);
|
||||
|
||||
// Only recurse into those namespaces mentioned in the files
|
||||
// Only recurse into those packages mentioned in the files
|
||||
// Otherwise we'll be examining the whole JDK
|
||||
final Set<Name> names = LazyResolveTestUtil.getTopLevelPackagesFromFileList(jetFiles);
|
||||
validateAndCompareDescriptors(
|
||||
|
||||
+2
-2
@@ -46,12 +46,12 @@ public class LazyResolveStdlibLoadingTest extends KotlinTestWithEnvironmentManag
|
||||
protected void doTestForGivenFiles(
|
||||
List<JetFile> files
|
||||
) {
|
||||
Set<Name> namespaceShortNames = LazyResolveTestUtil.getTopLevelPackagesFromFileList(files);
|
||||
Set<Name> packageShortNames = LazyResolveTestUtil.getTopLevelPackagesFromFileList(files);
|
||||
|
||||
ModuleDescriptor module = LazyResolveTestUtil.resolveEagerly(files, stdlibEnvironment);
|
||||
ModuleDescriptor lazyModule = LazyResolveTestUtil.resolveLazily(files, stdlibEnvironment);
|
||||
|
||||
for (Name name : namespaceShortNames) {
|
||||
for (Name name : packageShortNames) {
|
||||
PackageViewDescriptor eager = module.getPackage(FqName.topLevel(name));
|
||||
PackageViewDescriptor lazy = lazyModule.getPackage(FqName.topLevel(name));
|
||||
RecursiveDescriptorComparator.validateAndCompareDescriptors(eager, lazy, RecursiveDescriptorComparator.RECURSIVE, null);
|
||||
|
||||
+1
-1
@@ -269,7 +269,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix
|
||||
context = analyzeExhaust.getBindingContext();
|
||||
|
||||
PackageViewDescriptor packageView = analyzeExhaust.getModuleDescriptor().getPackage(PACKAGE);
|
||||
assertNotNull("Failed to find namespace: " + PACKAGE, packageView);
|
||||
assertNotNull("Failed to find package: " + PACKAGE, packageView);
|
||||
return packageView;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user