Skip to content

refactor: migrate String.format to String.formatted (Java 15+)#1719

Merged
He-Pin merged 2 commits into
apache:mainfrom
He-Pin:feature/java17-string-format
Jun 27, 2026
Merged

refactor: migrate String.format to String.formatted (Java 15+)#1719
He-Pin merged 2 commits into
apache:mainfrom
He-Pin:feature/java17-string-format

Conversation

@He-Pin

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

Copy link
Copy Markdown
Member

Summary

  • Migrate String.format("literal", args) to "literal".formatted(args) (Java 15+ API)
  • 14 files updated across elasticsearch, geode, google-cloud-bigquery, hbase, kudu, mongodb, pravega, solr, spring-web, sqs, and sse modules
  • Behavior-preserving refactoring, no functional changes

Test plan

  • Existing tests pass (behavior-preserving refactoring)
  • sbt javafmtAll passes with JDK 17

@He-Pin He-Pin force-pushed the feature/java17-string-format branch 2 times, most recently from 156d59d to 983f1ff Compare June 27, 2026 05:16

@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 added 2 commits June 27, 2026 18:19
Motivation:
Java 15 introduced String.formatted() as an instance method counterpart
to String.format(), providing cleaner and more readable string formatting.

Modification:
Replace String.format("literal", args) with "literal".formatted(args)
across 14 files including elasticsearch, geode, google-cloud-bigquery,
hbase, kudu, mongodb, pravega, solr, spring-web, sqs, and sse modules.

Result:
More concise and idiomatic Java code leveraging Java 15+ API.
Apply javafmt to Java source files in elasticsearch and mongodb modules.
@He-Pin He-Pin force-pushed the feature/java17-string-format branch from 983f1ff to 7fbd3a7 Compare June 27, 2026 10:21
@He-Pin He-Pin merged commit 572df71 into apache:main Jun 27, 2026
52 of 53 checks passed
@He-Pin He-Pin deleted the feature/java17-string-format branch June 27, 2026 10:24
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