[java-code.generation] IDEA-319808 Generated hashCode method has faulty != +0.0f check

GitOrigin-RevId: 5dc591c2b342c2201cf1d5430a6e8209178eaf7f
This commit is contained in:
Mikhail Pyltsin
2023-05-10 11:56:30 +02:00
committed by intellij-monorepo-bot
parent f69ac74f13
commit 97dffbd482
8 changed files with 8 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ public int hashCode() {
#elseif ($field.boolean)
($fName ? 1 : 0)##
#elseif ($field.float)
($fName != +0.0f ? java.lang.Float.floatToIntBits($fName) : 0)##
($fName != 0.0f ? java.lang.Float.floatToIntBits($fName) : 0)##
#elseif ($field.double)
#set($tempName = "#getTempVarName()")
(int) ($tempName ^ ($tempName >>> 32))##

View File

@@ -60,7 +60,7 @@ class A {
result = 31 * result + (int) a8;
result = 31 * result + a9;
result = 31 * result + (int) (a10 ^ (a10 >>> 32));
result = 31 * result + (a11 != +0.0f ? Float.floatToIntBits(a11) : 0);
result = 31 * result + (a11 != 0.0f ? Float.floatToIntBits(a11) : 0);
temp = Double.doubleToLongBits(a12);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + (a13 != null ? a13.hashCode() : 0);

View File

@@ -60,7 +60,7 @@ class A {
result = 31 * result + (int) a8;
result = 31 * result + a9;
result = 31 * result + (int) (a10 ^ (a10 >>> 32));
result = 31 * result + (a11 != +0.0f ? Float.floatToIntBits(a11) : 0);
result = 31 * result + (a11 != 0.0f ? Float.floatToIntBits(a11) : 0);
temp = Double.doubleToLongBits(a12);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + a13.hashCode();

View File

@@ -108,7 +108,7 @@ class A {
result = 31 * result + (int) getA8();
result = 31 * result + getA9();
result = 31 * result + (int) (getA10() ^ (getA10() >>> 32));
result = 31 * result + (getA11() != +0.0f ? Float.floatToIntBits(getA11()) : 0);
result = 31 * result + (getA11() != 0.0f ? Float.floatToIntBits(getA11()) : 0);
temp = Double.doubleToLongBits(getA12());
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + (a13 != null ? a13.hashCode() : 0);

View File

@@ -56,7 +56,7 @@ class A {
result = 31 * result + (int) a8;
result = 31 * result + a9;
result = 31 * result + (int) (a10 ^ (a10 >>> 32));
result = 31 * result + (a11 != +0.0f ? Float.floatToIntBits(a11) : 0);
result = 31 * result + (a11 != 0.0f ? Float.floatToIntBits(a11) : 0);
result = 31 * result + a13.hashCode();
result = 31 * result + a14.hashCode();
return result;

View File

@@ -72,7 +72,7 @@ class A extends B {
result = 31 * result + (int) a8;
result = 31 * result + a9;
result = 31 * result + (int) (a10 ^ (a10 >>> 32));
result = 31 * result + (a11 != +0.0f ? Float.floatToIntBits(a11) : 0);
result = 31 * result + (a11 != 0.0f ? Float.floatToIntBits(a11) : 0);
temp = Double.doubleToLongBits(a12);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + a13.hashCode();

View File

@@ -60,7 +60,7 @@ class A {
result1 = 31 * result1 + (int) a8;
result1 = 31 * result1 + a9;
result1 = 31 * result1 + (int) (a10 ^ (a10 >>> 32));
result1 = 31 * result1 + (a11 != +0.0f ? Float.floatToIntBits(a11) : 0);
result1 = 31 * result1 + (a11 != 0.0f ? Float.floatToIntBits(a11) : 0);
temp1 = Double.doubleToLongBits(temp);
result1 = 31 * result1 + (int) (temp1 ^ (temp1 >>> 32));
result1 = 31 * result1 + result.hashCode();

View File

@@ -13,6 +13,6 @@ class Test {
}
public int hashCode() {
return (d != +0.0f ? Float.floatToIntBits(d) : 0);
return (d != 0.0f ? Float.floatToIntBits(d) : 0);
}
}