Skip to content

Enforce, document thread-safety of CsvSchema #554

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

Closed
cowwoc opened this issue Mar 28, 2025 · 2 comments
Closed

Enforce, document thread-safety of CsvSchema #554

cowwoc opened this issue Mar 28, 2025 · 2 comments

Comments

@cowwoc
Copy link

cowwoc commented Mar 28, 2025

Unless I'm mistaken,

protected int _features = DEFAULT_ENCODING_FEATURES;
seems to be the only mutable field in CsvSchema and it could be made final as well.

If CsvSchema is immutable and/or thread-safe, it would be helpful for the documentation to state as much. You could also convert _features to a final field which would make this more clear on an implementation-level. Instead of setting _features multiple times, you could move this logic into the constructors and only assign it once.

@cowtowncoder
Copy link
Member

Yes, making CsvSchema immutable would be useful -- I thought it already was TBH -- and documenting it as such as well.

@cowtowncoder
Copy link
Member

Yes, so actually CsvSchema is immutable for all practical purposes... unless someone decided to sub-class it. Not sure why _features was declared that way.

I will change it to be final and add some verbiage in Javadoc.

@cowtowncoder cowtowncoder changed the title Is CsvSchema thread-safe? Enforce, document thread-safety of CsvSchema Mar 31, 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

No branches or pull requests

2 participants