mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8280470: Confusing instanceof check in HijrahChronology.range
Reviewed-by: rriggs, naoto, dfuchs, iris
This commit is contained in:
parent
a59d717fd6
commit
53804720a0
1 changed files with 9 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, 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
|
||||
|
@ -533,9 +533,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
|||
@Override
|
||||
public ValueRange range(ChronoField field) {
|
||||
checkCalendarInit();
|
||||
if (field instanceof ChronoField) {
|
||||
ChronoField f = field;
|
||||
return switch (f) {
|
||||
return switch (field) {
|
||||
case DAY_OF_MONTH -> ValueRange.of(1, 1, getMinimumMonthLength(), getMaximumMonthLength());
|
||||
case DAY_OF_YEAR -> ValueRange.of(1, getMaximumDayOfYear());
|
||||
case ALIGNED_WEEK_OF_MONTH -> ValueRange.of(1, 5);
|
||||
|
@ -544,8 +542,6 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
|||
default -> field.range();
|
||||
};
|
||||
}
|
||||
return field.range();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@Override // override for return type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue