We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
hashCode
1 parent 9bc5e2e commit f2f4bd9Copy full SHA for f2f4bd9
1 file changed
rewrite-core/src/main/java/org/openrewrite/Singleton.java
@@ -82,7 +82,7 @@ public class Singleton extends Recipe {
82
"generates correct `equals()` and `hashCode()` implementations based on all fields.";
83
84
public boolean isSingleton(ExecutionContext ctx) {
85
- Integer recipeIndex = ctx.computeMessageIfAbsent(getClass().getName() + "@" + Integer.toHexString(hashCode()), key -> ctx.getCycleDetails().getRecipePosition());
+ Integer recipeIndex = ctx.computeMessageIfAbsent(getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(this)), key -> ctx.getCycleDetails().getRecipePosition());
86
return recipeIndex == ctx.getCycleDetails().getRecipePosition();
87
}
88
0 commit comments