Skip to content

Only invoke Resource's super.close() if the resource is open.#602

Merged
lukehutch merged 1 commit into
classgraph:latestfrom
chrisr3:chrisr3-simplify
Nov 22, 2021
Merged

Only invoke Resource's super.close() if the resource is open.#602
lukehutch merged 1 commit into
classgraph:latestfrom
chrisr3:chrisr3-simplify

Conversation

@chrisr3

@chrisr3 chrisr3 commented Nov 22, 2021

Copy link
Copy Markdown
Contributor

Protect Resource's super.close() invocation using Resource.isOpen. This allows us to simplify the onClose handlers only to invoke Resource.close().

Maybe one day the onClose handler can then be replaced by just Resource::close.

@lukehutch lukehutch merged commit c7dc311 into classgraph:latest Nov 22, 2021
@lukehutch

Copy link
Copy Markdown
Member

LGTM, thanks, good thinking.

Right, I plan to drop JDK 7 support in ClassGraph version 5 (which I will probably work on after there have been no new bug reports for a few months, which the project is approaching). At that point I'll switch the code internally to use lambdas, method references, etc.

For now though, with your change in place, I'll probably just pass a reference in to the Resource to close, rather than a Runnable that just calls Resource#close().

@chrisr3

chrisr3 commented Nov 22, 2021

Copy link
Copy Markdown
Contributor Author

OK, thanks. BTW ClassGraph 4.8.135 hasn't appeared in Maven Central yet. Was there a problem during publication?

Out of curiosity, will ClassGraph 5 still support JDK8 please?

@chrisr3 chrisr3 deleted the chrisr3-simplify branch November 22, 2021 10:16
lukehutch added a commit that referenced this pull request Nov 22, 2021
lukehutch added a commit that referenced this pull request Nov 22, 2021
@lukehutch

Copy link
Copy Markdown
Member

Yes, the plan is to bump the minimum supported JDK version from 7 to 8 for ClassGraph version 5. JDK 7 support has required quite a lot of workarounds over the years. But JDK 8 will still be important for probably another 5-10 years or something, so I don't want to increase the minimum supported version beyond JDK 8 for a long time.

I made the changes, you can look at my commit 220be7b if you are curious. However this does not change functionality in any way, so I won't push out a new release just for this.

Thanks again for your code contributions and your ideas!

lukehutch added a commit that referenced this pull request Nov 22, 2021
@lukehutch

lukehutch commented Nov 22, 2021

Copy link
Copy Markdown
Member

OK, thanks. BTW ClassGraph 4.8.135 hasn't appeared in Maven Central yet. Was there a problem during publication?

I'm not sure what the problem is -- the Sonatype Nexus UI is just hanging, so I suspect Sonatype is broken, and I use Sonatype to publish artifacts to Maven Central. (This sort of thing happens a lot with Sonatype...)

https://oss.sonatype.org/#nexus-search;quick~io.github.classgraph

lukehutch added a commit that referenced this pull request Nov 22, 2021
@lukehutch

lukehutch commented Nov 22, 2021

Copy link
Copy Markdown
Member

@chrisr3

(The Sonatype UI is now responding, a few minutes later. I see that 4.8.135 is not there. I have no idea what happened! I re-tagged this release, including with the latest refactoring changes, and published this release again.)

Now 4.8.135 is showing up in Sonatype, so it should be visible in Maven Central within a few hours.

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