Path hash code is case-agnostic. This is to avoid changing it if e.g. path to project is reconfigured from C:\Work to c:\work

This commit is contained in:
Evgeny Gerashchenko
2015-06-08 19:37:34 +03:00
parent 959364aa77
commit c48378260e
7 changed files with 21 additions and 6 deletions
@@ -41,10 +41,7 @@ import static org.jetbrains.kotlin.load.kotlin.PackageClassUtils.getPackageClass
public class PackagePartClassUtils {
public static int getPathHashCode(@NotNull VirtualFile file) {
// Conversion to system-dependent name seems to be unnecessary, but it's hard to check now:
// it was introduced when fixing KT-2839, which appeared again (KT-3639).
// If you try to remove it, run tests on Windows.
return FileUtil.toSystemDependentName(file.getPath()).hashCode();
return file.getPath().toLowerCase().hashCode();
}
@NotNull
@@ -24,6 +24,10 @@ public class IncrementalProjectPathCaseChangedTest : AbstractIncrementalJpsTest(
doTest("jps-plugin/testData/incremental/custom/projectPathCaseChanged/")
}
fun testProjectPathCaseChangedMultiFile() {
doTest("jps-plugin/testData/incremental/custom/projectPathCaseChangedMultiFile/")
}
override fun doTest(testDataPath: String) {
if (SystemInfoRt.isFileSystemCaseSensitive) {
return
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.jps.build;
import com.google.common.collect.Lists;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.testFramework.LightVirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
@@ -614,8 +615,8 @@ public class KotlinJpsBuildTest extends AbstractKotlinJpsBuildTestCase {
}
private String packagePartClass(String moduleName, String fileName, String packageClassFqName) {
File file = new File(workDir, fileName);
LightVirtualFile fakeVirtualFile = new LightVirtualFile(file.getPath()) {
String path = FileUtilRt.toSystemIndependentName(new File(workDir, fileName).getAbsolutePath());
LightVirtualFile fakeVirtualFile = new LightVirtualFile(path) {
@NotNull
@Override
public String getPath() {
@@ -0,0 +1,2 @@
fun bar() {
}
@@ -0,0 +1,7 @@
Cleaning output files:
out/production/module/_DefaultPackage$foo$*.class
out/production/module/_DefaultPackage.class
End of files
Compiling files:
src/foo.kt
End of files
@@ -0,0 +1,2 @@
fun foo() {
}
@@ -0,0 +1,2 @@
fun foo() {
}