[java-inspections] IDEA-338114 Suggest to replace (int)(v ^ (v >>> 32)) with a Long.hashCode(v)

GitOrigin-RevId: 2d9591f9d9a558c4a61ac226556ef9f551d6e0c2
This commit is contained in:
Tagir Valeev
2023-11-14 16:45:50 +01:00
committed by intellij-monorepo-bot
parent 6da9127fbb
commit 2770254f2f
9 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
// "Replace with 'Long.hashCode()'" "true-preview"
public class Test {
long var = 1234567890123456789L;
public void testMethod() {
int result = Long.hashCode(var);
}
}

View File

@@ -0,0 +1,8 @@
// "Replace with 'Long.hashCode()'" "true-preview"
public class Test {
long var = 1234567890123456789L;
public void testMethod() {
int result = Long.hashCode(var);
}
}

View File

@@ -0,0 +1,8 @@
// "Replace with 'Long.hashCode()'" "true-preview"
public class Test {
long var = 1234567890123456789L;
public void testMethod() {
int result = (int<caret>)(var ^ (var >>> /*shift amount*/ 32));
}
}

View File

@@ -0,0 +1,8 @@
// "Replace with 'Long.hashCode()'" "true-preview"
public class Test {
long var = 1234567890123456789L;
public void testMethod() {
int result = (int<caret>)((var >>> (16+16)) ^ var);
}
}