8338409: Use record to simplify code

Reviewed-by: redestad, liach
This commit is contained in:
Shaojin Wen 2024-08-15 22:57:33 +00:00 committed by Claes Redestad
parent d86e99c3ca
commit 74066bcca8

View File

@ -3021,15 +3021,7 @@ public final class Formatter implements Closeable, Flushable {
String toString();
}
private static class FixedString implements FormatString {
private final String s;
private final int start;
private final int end;
FixedString(String s, int start, int end) {
this.s = s;
this.start = start;
this.end = end;
}
private record FixedString(String s, int start, int end) implements FormatString {
public int index() { return -2; }
public void print(Formatter fmt, Object arg, Locale l)
throws IOException { fmt.a.append(s, start, end); }