Prefer package with class files to class with the same name

See comments in JvmDependenciesIndexImpl and in the test

 #KT-15464 Fixed
This commit is contained in:
Alexander Udalov
2016-12-29 18:38:35 +03:00
parent 6cccad9647
commit 164c72e877
8 changed files with 80 additions and 5 deletions
@@ -20,6 +20,7 @@ import com.google.common.collect.Iterables;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
import kotlin.Pair;
import kotlin.collections.SetsKt;
import kotlin.io.FilesKt;
@@ -565,4 +566,27 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
Pair<String, ExitCode> output = compileKotlin("source.kt", tmpdir, jarPath);
KotlinTestUtils.assertEqualsToFile(new File(getTestDataDirectory(), "output.txt"), normalizeOutput(output));
}
public void testInnerClassPackageConflict2() throws Exception {
final File library1 = compileJava("library1");
final File library2 = compileJava("library2");
// Copy everything from library2 to library1
FileUtil.visitFiles(library2, new Processor<File>() {
@Override
public boolean process(File file) {
if (!file.isDirectory()) {
File newFile = new File(library1, FilesKt.relativeTo(file, library2).getPath());
if (!newFile.getParentFile().exists()) {
assert newFile.getParentFile().mkdirs();
}
assert file.renameTo(newFile);
}
return true;
}
});
Pair<String, ExitCode> output = compileKotlin("source.kt", tmpdir, library1);
KotlinTestUtils.assertEqualsToFile(new File(getTestDataDirectory(), "output.txt"), normalizeOutput(output));
}
}