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

Add violation for StringReader #291

Merged
merged 1 commit into from
Dec 1, 2024
Merged

Add violation for StringReader #291

merged 1 commit into from
Dec 1, 2024

Conversation

mkarg
Copy link
Contributor

@mkarg mkarg commented Nov 30, 2024

Java 24 provides Reader.of(CharSequence).

It is preferrable over StringReader, as the API notes says:

Reader.of(CharSequence) provides a method to read from any CharSequence that may be more efficient than StringReader.

Disclaimer: I am the original author of Reader.of(CharSequence). My intention of the current PR is to evangelize its use, so applications will run more efficient.

@gaul
Copy link
Owner

gaul commented Dec 1, 2024

Can you add a test case? This might be tricky until JDK 24 is released.

@mkarg
Copy link
Contributor Author

mkarg commented Dec 1, 2024

I have added a test in this PR.

@gaul gaul merged commit 6f5a64f into gaul:master Dec 1, 2024
3 checks passed
@gaul
Copy link
Owner

gaul commented Dec 1, 2024

Thanks for your contribution @mkarg! I like these little optimizations.

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