Prepend zeros to SAM wrapper hash code

To make its length always 8 characters as is already done for package parts.
This fixes some test on incremental compilation because it relies that hashes
are eight characters long
This commit is contained in:
Alexander Udalov
2014-11-11 19:57:33 +03:00
parent 83a2111057
commit b39d34ca8d
@@ -171,11 +171,14 @@ public class SamWrapperCodegen {
private FqName getWrapperName(@NotNull JetFile containingFile) {
FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(containingFile.getPackageFqName());
JavaClassDescriptor descriptor = samType.getJavaClassDescriptor();
String shortName = packageClassFqName.shortName().asString() + "$sam$" + descriptor.getName().asString() + "$" +
Integer.toHexString(
PackagePartClassUtils.getPathHashCode(containingFile.getVirtualFile()) * 31 +
DescriptorUtils.getFqNameSafe(descriptor).hashCode()
);
int hash = PackagePartClassUtils.getPathHashCode(containingFile.getVirtualFile()) * 31 +
DescriptorUtils.getFqNameSafe(descriptor).hashCode();
String shortName = String.format(
"%s$sam$%s$%08x",
packageClassFqName.shortName().asString(),
descriptor.getName().asString(),
hash
);
return packageClassFqName.parent().child(Name.identifier(shortName));
}
}