Prepend zeros to package part hash code

This commit is contained in:
Alexander Udalov
2014-09-25 17:42:17 +04:00
parent e2273a3d85
commit 80a7c64369
2 changed files with 8 additions and 4 deletions
@@ -56,8 +56,12 @@ public class PackagePartClassUtils {
String fileName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(file.getName()));
// path hashCode to prevent same name / different path collision
String srcName = facadeFqName.shortName().asString() + "$" + replaceSpecialSymbols(fileName) + "$" + Integer.toHexString(
getPathHashCode(file));
String srcName = String.format(
"%s$%s$%08x",
facadeFqName.shortName().asString(),
replaceSpecialSymbols(fileName),
getPathHashCode(file)
);
return facadeFqName.parent().child(Name.identifier(srcName));
}
@@ -252,8 +252,8 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
}
class object {
// We suspect sequences of several consecutive hexadecimal digits to be a package part hash code
val STRIP_PACKAGE_PART_HASH_PATTERN = Pattern.compile("\\$([0-9a-f]{5,8})")
// We suspect sequences of eight consecutive hexadecimal digits to be a package part hash code
val STRIP_PACKAGE_PART_HASH_PATTERN = Pattern.compile("\\$([0-9a-f]{8})")
}
}