Skip to content

refactor: use String.formatted() instead of String.format()#3144

Merged
He-Pin merged 1 commit into
mainfrom
refactor/string-formatted
Jun 23, 2026
Merged

refactor: use String.formatted() instead of String.format()#3144
He-Pin merged 1 commit into
mainfrom
refactor/string-formatted

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 23, 2026

Copy link
Copy Markdown
Member

Motivation

String.format(fmt, args) is a static method call. JDK 15 added String.formatted(args) as a fluent instance method on the format string itself.

Modification

Replace 2 occurrences of String.format(fmt, args) with fmt.formatted(args):

  • UnsynchronizedByteArrayInputStream.java: range check error message
  • AeronErrorLog.java: Aeron error logging

Result

More readable fluent API style, functionally identical.

Tests

  • sbt "actor/compile" "remote/compile" — passed

References

Refs #3136

Motivation:
String.format(fmt, args) is a static method call. JDK 15 added
String.formatted(args) as a fluent instance method on the format string.

Modification:
Replace 2 occurrences of String.format(fmt, args) with fmt.formatted(args):
- UnsynchronizedByteArrayInputStream.java: range check error message
- AeronErrorLog.java: Aeron error logging

Result:
More readable fluent API style, functionally identical.

Tests:
sbt "actor/compile" "remote/compile" — passed

References:
Refs #3136

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@He-Pin He-Pin merged commit fe57710 into main Jun 23, 2026
9 checks passed
@He-Pin He-Pin deleted the refactor/string-formatted branch June 23, 2026 09:17
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