Skip to content

Scout/java 5 features - #2106

Closed
winfriedgerlach wants to merge 5 commits into
bcgit:mainfrom
winfriedgerlach:scout/Java-5-features
Closed

Scout/java 5 features#2106
winfriedgerlach wants to merge 5 commits into
bcgit:mainfrom
winfriedgerlach:scout/Java-5-features

Conversation

@winfriedgerlach

Copy link
Copy Markdown
Collaborator

If we cannot go for Java 8 features yet, we can at least leverage Java 5 features.
Here is the first of some modernization PRs

@winfriedgerlach
winfriedgerlach requested a review from dghgit August 7, 2025 09:24
@dghgit dghgit self-assigned this Aug 12, 2025
@silviuburceadev

Copy link
Copy Markdown

I'm just wondering if one needs to worry about thread safety on the switch from StringBuffer to StringBuilder in all these classes.

@winfriedgerlach

winfriedgerlach commented Aug 13, 2025

Copy link
Copy Markdown
Collaborator Author

@silviuburceadev I was careful and only changed from StringBuffer to StringBuilder when the StringBuilder was created in the same method and the result of the StringBuilder was also "consumed" in the same method - i.e. sb.toString() was called.

In cases where something else was done with StringBuffer (e.g., stored in a field, returned from method etc.) I didn't touch it exactly for the reason that you have in mind.

@dghgit

dghgit commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

This batch is now done. One thing I'd ignore contains/indexOf - it's not worth the change as it won't compile on Java 4, we've got an ant filter which replaces StringBuilder with StringBuffer for Java 4 now, contains is a bit trickier (although I should eventually getting around to writing a regex for it as well...).

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.

3 participants