mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8263668: Update java.time to use instanceof pattern variable
Reviewed-by: lancea, ryadav, naoto, rriggs, dfuchs, scolebourne, chegar
This commit is contained in:
parent
a93d911954
commit
28af31db34
34 changed files with 129 additions and 176 deletions
|
@ -813,8 +813,8 @@ public final class ZonedDateTime
|
|||
*/
|
||||
@Override // override for Javadoc and performance
|
||||
public int get(TemporalField field) {
|
||||
if (field instanceof ChronoField) {
|
||||
switch ((ChronoField) field) {
|
||||
if (field instanceof ChronoField chronoField) {
|
||||
switch (chronoField) {
|
||||
case INSTANT_SECONDS:
|
||||
throw new UnsupportedTemporalTypeException("Invalid field 'InstantSeconds' for get() method, use getLong() instead");
|
||||
case OFFSET_SECONDS:
|
||||
|
@ -850,8 +850,8 @@ public final class ZonedDateTime
|
|||
*/
|
||||
@Override
|
||||
public long getLong(TemporalField field) {
|
||||
if (field instanceof ChronoField) {
|
||||
switch ((ChronoField) field) {
|
||||
if (field instanceof ChronoField chronoField) {
|
||||
switch (chronoField) {
|
||||
case INSTANT_SECONDS: return toEpochSecond();
|
||||
case OFFSET_SECONDS: return getOffset().getTotalSeconds();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue