Skip to content

Add support for Java 18 to 21 (fixes #52) #72

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

olim7t
Copy link

@olim7t olim7t commented Feb 28, 2025

Tested on MacOS with Oracle versions 18.0.2.1, 19.0.2, 20.0.2 and 21.0.5 (arm64).

This only fixes issues that were detected by existing tests.

assertEquals(queueShallowSize + lockSize, meterIgnoring.measureDeep(queue));
// The queue contains one reference that isn't strong (so ignored), so it should measure the
// same as an empty queue.
assertEquals(meterIgnoring.measureDeep(new ReferenceQueue<>()), meterIgnoring.measureDeep(queue));
Copy link
Author

Choose a reason for hiding this comment

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

In earlier versions, ReferenceQueue uses a custom lock object internally. In newer versions, it uses a ReentrantLock and a Condition.
I think this achieves the same goal without the need to introduce complex conditional branches.

@olim7t
Copy link
Author

olim7t commented Mar 6, 2025

This overlaps with some of the work done in #71.

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.

1 participant