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

8275509: ModuleDescriptor.hashCode isn't reproducible across builds #6078

Closed
wants to merge 17 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -2550,7 +2550,7 @@ private static <M> String toString(Set<M> mods, String what) {
* Generates and returns a hashcode for the enum instances. The returned hashcode
* is a sum of each of the enum instances' {@link Enum#ordinal() ordinal} value.
*/
private static int ordinalHashCode(final Iterable<? extends Enum<?>> enums) {
private static int ordinalHashCode(Iterable<? extends Enum<?>> enums) {
int h = 0;
for (Enum<?> e : enums) {
h += e.ordinal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This e == null check suggests there is an issue elsewhere, can you explain the scenario where you see this? Also can you drop the spurious use of "final" here, it's inconsistent with the existing code.

Do you want us to look at the test? It looks like it needs clean-up and I'm not sure if you want to wait for the CDS issue or not.

Copy link
Member Author

@jaikiran jaikiran Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Alan,

This e == null check suggests there is an issue elsewhere, can you explain the scenario where you see this?

That was just a pre-emptive defensive check I had added. There isn't a scenario in that flow where any of the elements are currently null. I have updated this PR to remove that check. Test continues to pass with this change. Also removed the "final".

Do you want us to look at the test? It looks like it needs clean-up and I'm not sure if you want to wait for the CDS issue or not.

Yes please. The test is ready for review. The only place where there's a TODO is where that part of commented code is affected by the bug mentioned in that comment. I would like to use that check (the commented out one) but I don't want to wait for that other bug to be fixed for this PR, since I am unsure how big or how long it might take for the other bug to be fixed. I plan to uncomment that part in a separate PR once that other bug is fixed, if that's OK.

Copy link
Member Author

@jaikiran jaikiran Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Alan,

Looking at the CDS issue that's being tracked at https://bugs.openjdk.java.net/browse/JDK-8275731, it's looking like a much bigger change and might take a while. In the meantime do you think this test case (and the fix to the hashCode() part) looks OK? I am open to deleting the commented out equality check in this test case since although that equality testing should be done, it doesn't have to be done as part of this hashCode() fix/test PR. Let me know what you and others prefer.