Skip to content

Commit b8da3dd

Browse files
committed
Use identity hash code due to overridden hashCode in Recipe
1 parent 56da100 commit b8da3dd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

rewrite-core/src/main/java/org/openrewrite/Singleton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class Singleton extends Recipe {
8282
"generates correct `equals()` and `hashCode()` implementations based on all fields.";
8383

8484
public boolean isSingleton(ExecutionContext ctx) {
85-
Integer recipeIndex = ctx.computeMessageIfAbsent(getClass().getName() + "@" + Integer.toHexString(hashCode()), key -> ctx.getCycleDetails().getRecipePosition());
85+
Integer recipeIndex = ctx.computeMessageIfAbsent(getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(this)), key -> ctx.getCycleDetails().getRecipePosition());
8686
return recipeIndex == ctx.getCycleDetails().getRecipePosition();
8787
}
8888

0 commit comments

Comments
 (0)