8321545: Override toString() for Format subclasses

Reviewed-by: naoto, rriggs
This commit is contained in:
Justin Lu 2024-01-23 22:22:16 +00:00
parent edfee7f348
commit 96607df7f0
12 changed files with 419 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -614,6 +614,17 @@ public class ChoiceFormat extends NumberFormat {
return result;
}
/**
* {@return a string identifying this {@code ChoiceFormat}, for debugging}
*/
@Override
public String toString() {
return
"""
ChoiceFormat [pattern: "%s"]
""".formatted(toPattern());
}
/**
* Compares the specified object with this {@code ChoiceFormat} for equality.
* Returns true if the object is also a {@code ChoiceFormat} and the