Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove needless TypeBinding hashCode() implementations #3412 #3477

Closed
wants to merge 3 commits into from

Conversation

jukzi
Copy link
Contributor

@jukzi jukzi commented Dec 18, 2024

Without overriding equals() any custom hashCode() implementation is likely to introduce hash collisions.

#3412

@jukzi jukzi force-pushed the TypeBindingWrapper_hashCodes branch from 4ada025 to d73c10b Compare December 18, 2024 12:20
Since ArrayBinding does not override equals() any custom hashCode()
implementation is likely to introduce hash collisions. Especially for
same "leafComponentType" but different "dimensions"

eclipse-jdt#3412
Since LocalTypeBinding does not override equals() any custom hashCode()
implementation is likely to introduce hash collisions. Especially for
same "enclosingType" but different "enclosingCase"

eclipse-jdt#3412
Since WildcardBinding does not override equals() any custom hashCode()
implementation is likely to introduce hash collisions. Especially for
same "genericType" but different "bound"

eclipse-jdt#3412
@jukzi jukzi force-pushed the TypeBindingWrapper_hashCodes branch from d73c10b to 79091ce Compare December 18, 2024 13:23
@jukzi jukzi marked this pull request as ready for review December 18, 2024 13:23
@jukzi
Copy link
Contributor Author

jukzi commented Jan 20, 2025

@srikanth-sankaran can you review, please?

@srikanth-sankaran
Copy link
Contributor

Right now I am unable to access https://bugs.eclipse.org/bugs/show_bug.cgi?id=430425 which is referenced from org.eclipse.jdt.internal.compiler.lookup.ArrayBinding.swapUnresolved(UnresolvedReferenceBinding, ReferenceBinding, LookupEnvironment)

I will state that I am nervous about this change - Do we have data to show hash code collisions are a real BURNING issue ?

I wrote much of TypeSystem and AnnotatableTypeSystem but that was ages ago and my recall is quite rusty. It would take a lot more time to study it detail to conclude whether this patch is safe to move forward with and I am afraid scheduling that time is going to be challenging against other commitments :-(

I am inclined to say let us leave this as is - unless it is a burning issue somewhere. Sorry that cannot be the answer you are looking for having invested your time.

@jukzi
Copy link
Contributor Author

jukzi commented Jan 21, 2025

I can't access bugzilla either, but you submitted a test org.eclipse.jdt.core.tests.builder.IncrementalTests18.test430425() with it which still holds.
It's pretty clear that none of the callers of the constructor org.eclipse.jdt.internal.compiler.lookup.ArrayBinding.ArrayBinding(TypeBinding, int, LookupEnvironment) does use any hashing. Both AnnotatableTypeSystem.getArrayType() linearly iterate through the list of existing derivedTypes.

@jukzi
Copy link
Contributor Author

jukzi commented Jan 21, 2025

@jukzi
Copy link
Contributor Author

jukzi commented Jan 29, 2025

I am inclined to say let us leave this as is - unless it is a burning issue somewhere.

OK, i close this PR and issue and would reopen if i stumble across a non-synthetic reproducer.

@jukzi jukzi closed this Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants