8283782: Redundant verification of year in LocalDate::ofEpochDay

Reviewed-by: rriggs, naoto
This commit is contained in:
Claes Redestad 2022-03-29 19:48:43 +00:00
parent 2fef5d4a33
commit 072f2c461e
2 changed files with 37 additions and 5 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, 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
@ -367,9 +367,7 @@ public final class LocalDate
int dom = marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
yearEst += marchMonth0 / 10;
// check year now we are certain it is correct
int year = YEAR.checkValidIntValue(yearEst);
return new LocalDate(year, month, dom);
return new LocalDate((int)yearEst, month, dom);
}
//-----------------------------------------------------------------------