mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-09 08:09:39 +07:00
[java-inspections] UseHashCodeMethodInspection: support reporting and replacing with Double.hashCode() when temp var is reused
GitOrigin-RevId: 8b6169bd90214b30d3d83acf7ebe49bc20b4f29d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a9e8828ed9
commit
45d3f80e5e
@@ -0,0 +1,18 @@
|
||||
// "Replace with 'Double.hashCode()'" "true-preview"
|
||||
|
||||
class X {
|
||||
private String s;
|
||||
private double d1;
|
||||
private double d2;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = s != null ? s.hashCode() : 0;
|
||||
result = 31 * result + Double.hashCode(d1);
|
||||
temp = Double.doubleToLongBits(d2);
|
||||
result = 31 * result + (int)(temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// "Replace with 'Double.hashCode()'" "true-preview"
|
||||
|
||||
class X {
|
||||
private String s;
|
||||
private double d1;
|
||||
private double d2;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = s != null ? s.hashCode() : 0;
|
||||
temp = Double.doubleToLongBits(d1);
|
||||
result = 31 * result + (int)(temp ^ (temp >>> 32));
|
||||
result = 31 * result + Double.hashCode(d2);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Replace with 'Double.hashCode()'" "true-preview"
|
||||
|
||||
class X {
|
||||
private String s;
|
||||
private double d;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
result = s != null ? s.hashCode() : 0;
|
||||
result = 31 * result + Double.hashCode(d);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// "Replace with 'Double.hashCode()'" "true-preview"
|
||||
|
||||
class X {
|
||||
private String s;
|
||||
private double d1;
|
||||
private double d2;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = s != null ? s.hashCode() : 0;
|
||||
temp = Double.doubleToLongBits(d1);
|
||||
result = 31 * result + (int)(temp ^<caret> (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(d2);
|
||||
result = 31 * result + (int)(temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// "Replace with 'Double.hashCode()'" "true-preview"
|
||||
|
||||
class X {
|
||||
private String s;
|
||||
private double d1;
|
||||
private double d2;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = s != null ? s.hashCode() : 0;
|
||||
temp = Double.doubleToLongBits(d1);
|
||||
result = 31 * result + (int)(temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(d2);
|
||||
result = 31 * result + (int)(temp ^ (temp >>> 32)<caret>);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Replace with 'Double.hashCode()'" "true-preview"
|
||||
|
||||
class X {
|
||||
private String s;
|
||||
private double d;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = s != null ? s.hashCode() : 0;
|
||||
temp = Double.doubleToLongBits(d);
|
||||
result = 31 * result + (int)<caret>(temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user