Describe the feature
First, Kudos for this great project. I have discovered a weird and painful issue in the one of our equality class. When doing this in Kotlin ( would work the same on Java with auto-generated equals):
data class Image(val url: URL, val position: Int)
Everything seems good even with the tests:
funfulfills equal contract() { EqualsVerifier.forClass(Image::class.java).verify() }
Debugging an issue with Claude it discovered why other behaviors were flaky: it was using the DNS to check the IPs. This meant that if the network glitched equality could do weird things.
@Test
fun `images with different URL strings are not equal`() {
// URL.equals() resolves hostnames via DNS before comparing.
// "localhost" and "127.0.0.1" resolve to the same IP, so URL.equals()
// treats them as equal even though their string representations differ.
// This proves that Image equality is DNS-driven, not URL-string-driven.
val imageWithHostname = Image(URI("http://localhost/image.jpg").toURL(), 1)
val imageWithIp = Image(URI("http://127.0.0.1/image.jpg").toURL(), 1)
assertThat(imageWithHostname.url.toString()).isNotEqualTo(imageWithIp.url.toString())
assertThat(imageWithHostname).isNotEqualTo(imageWithIp) // fails: URL.equals() uses DNS
}
EqualsVerifier was working as expected in general. But the network call for to URL inside can fail and have random, non-deterministic behavior.
Describe the solution you'd like
When generating cases to validate equals, it could fail saying that it is not deterministic.
And, probably, this mean sallowing the removal of this with_
EqualsVerifier.forClass(Image.class)
.suppress(Warning.URL_SHOULD_NOT_BE_USED_IN_EQUALS)
.verify();
Describe alternatives
A WARN log could be enough in some cases
Additional context
No response
Describe the feature
First, Kudos for this great project. I have discovered a weird and painful issue in the one of our equality class. When doing this in Kotlin ( would work the same on Java with auto-generated equals):
data class Image(val url: URL, val position: Int)Everything seems good even with the tests:
funfulfills equal contract() { EqualsVerifier.forClass(Image::class.java).verify() }Debugging an issue with Claude it discovered why other behaviors were flaky: it was using the DNS to check the IPs. This meant that if the network glitched equality could do weird things.
EqualsVerifier was working as expected in general. But the network call for to URL inside can fail and have random, non-deterministic behavior.
Describe the solution you'd like
When generating cases to validate equals, it could fail saying that it is not deterministic.
And, probably, this mean sallowing the removal of this with_
Describe alternatives
A WARN log could be enough in some cases
Additional context
No response