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())); String fileName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(file.getName()));
// path hashCode to prevent same name / different path collision // path hashCode to prevent same name / different path collision
String srcName = facadeFqName.shortName().asString() + "$" + replaceSpecialSymbols(fileName) + "$" + Integer.toHexString( String srcName = String.format(
getPathHashCode(file)); "%s$%s$%08x",
facadeFqName.shortName().asString(),
replaceSpecialSymbols(fileName),
getPathHashCode(file)
);
return facadeFqName.parent().child(Name.identifier(srcName)); return facadeFqName.parent().child(Name.identifier(srcName));
} }
@@ -252,8 +252,8 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
} }
class object { class object {
// We suspect sequences of several consecutive hexadecimal digits to be a package part hash code // 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]{5,8})") val STRIP_PACKAGE_PART_HASH_PATTERN = Pattern.compile("\\$([0-9a-f]{8})")
} }
} }