jdk/src/share/classes/java/time/chrono/IsoChronology.java
changeset 17474 8c100beabcc0
parent 16852 60207b2b4b42
child 19030 32f129cb6351
equal deleted inserted replaced
17473:35cd9b3a98ff 17474:8c100beabcc0
   119  * <li>day-of-year - There are 365 days in a standard ISO year and 366 in a leap year.
   119  * <li>day-of-year - There are 365 days in a standard ISO year and 366 in a leap year.
   120  *  The days are numbered from 1 to 365 or 1 to 366.
   120  *  The days are numbered from 1 to 365 or 1 to 366.
   121  * <li>leap-year - Leap years occur every 4 years, except where the year is divisble by 100 and not divisble by 400.
   121  * <li>leap-year - Leap years occur every 4 years, except where the year is divisble by 100 and not divisble by 400.
   122  * </ul><p>
   122  * </ul><p>
   123  *
   123  *
   124  * <h3>Specification for implementors</h3>
   124  * @implSpec
   125  * This class is immutable and thread-safe.
   125  * This class is immutable and thread-safe.
   126  *
   126  *
   127  * @since 1.8
   127  * @since 1.8
   128  */
   128  */
   129 public final class IsoChronology extends Chronology implements Serializable {
   129 public final class IsoChronology extends Chronology implements Serializable {
   586             return LocalDate.of(y, 1, 1).plusMonths(months).plusDays(days);
   586             return LocalDate.of(y, 1, 1).plusMonths(months).plusDays(days);
   587         }
   587         }
   588         int moy = MONTH_OF_YEAR.checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR));
   588         int moy = MONTH_OF_YEAR.checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR));
   589         int dom = DAY_OF_MONTH.checkValidIntValue(fieldValues.remove(DAY_OF_MONTH));
   589         int dom = DAY_OF_MONTH.checkValidIntValue(fieldValues.remove(DAY_OF_MONTH));
   590         if (resolverStyle == ResolverStyle.SMART) {  // previous valid
   590         if (resolverStyle == ResolverStyle.SMART) {  // previous valid
   591             dom = Math.min(dom, Month.of(moy).length(Year.isLeap(y)));
   591             if (moy == 4 || moy == 6 || moy == 9 || moy == 11) {
       
   592                 dom = Math.min(dom, 30);
       
   593             } else if (moy == 2) {
       
   594                 dom = Math.min(dom, Month.FEBRUARY.length(Year.isLeap(y)));
       
   595 
       
   596             }
   592         }
   597         }
   593         return LocalDate.of(y, moy, dom);
   598         return LocalDate.of(y, moy, dom);
   594     }
   599     }
   595 
   600 
   596     private LocalDate resolveYD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
   601     private LocalDate resolveYD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {