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

Overhaul TokenStream ICloseable/IDisposable Patterns, #271 #1058

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

paulirwin
Copy link
Contributor

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a change, please open an issue to discuss the change or find an existing issue.

Overhaul TokenStream ICloseable/IDisposable Patterns

Fixes #271

Description

This pull request focuses on refactoring the codebase by replacing the Dispose method with the new ICloseable interface's Close method in all provided TokenStream implementations to make them reusable. None of the implementations in our codebase need a non-reusable cleanup method, however, in discussion in #271, it was determined that there are possible use cases in which a custom TokenStream implementation might need to have their instance Disposed when the owning Analyzer (with stored values set by a ReuseStrategy) is disposed, so we have retained the IDisposable pattern as well. This PR also ensures that those values are disposed by way of DisposableThreadLocal and TokenStreamComponents disposing of their values.

Remaining draft PR TODOs:

@paulirwin paulirwin added the notes:breaking-change Has changes that will break backward compatibility label Dec 5, 2024
@paulirwin paulirwin requested a review from NightOwl888 December 5, 2024 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes:breaking-change Has changes that will break backward compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TokenStream.IncrementToken() is called after Dispose() is called
1 participant