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

Explicitly check for CharSequence in -re-schema #1104

Merged
merged 1 commit into from
Sep 7, 2024

Conversation

alexander-yakushev
Copy link
Contributor

The current behavior attempts to run re-find against any object in a try/catch block, fails with a ClassCastException on non-charsequence objects, the exception is caught and false is returned. The drawback is that the exception object is generated and its stacktrace is filled. Besides, throwing and catching an exception in Java is not free, it follows a quite slow path compared to the tight situations the validation might be used.

The profile looks like this:
image

@alexander-yakushev
Copy link
Contributor Author

alexander-yakushev commented Sep 6, 2024

If preferred, I can preserve the current behavior in -explainer as it is less performance-sensitive.

@ikitommi ikitommi merged commit bc80f3f into metosin:master Sep 7, 2024
9 checks passed
@ikitommi
Copy link
Member

ikitommi commented Sep 7, 2024

thanks!

@alexander-yakushev alexander-yakushev deleted the re-find-classcast branch September 7, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants