提交 0d6a96d7 编写于 作者: R rriggs

8028092: Lint cleanup of java.time.format

Summary: correct declarations and add @SuppressWarnings
Reviewed-by: darcy, lancea
上级 c8dc869e
...@@ -369,7 +369,8 @@ final class DateTimeParseContext { ...@@ -369,7 +369,8 @@ final class DateTimeParseContext {
Objects.requireNonNull(chrono, "chrono"); Objects.requireNonNull(chrono, "chrono");
currentParsed().chrono = chrono; currentParsed().chrono = chrono;
if (chronoListeners != null && !chronoListeners.isEmpty()) { if (chronoListeners != null && !chronoListeners.isEmpty()) {
Consumer[] tmp = new Consumer[1]; @SuppressWarnings({"rawtypes", "unchecked"})
Consumer<Chronology>[] tmp = new Consumer[1];
Consumer<Chronology>[] listeners = chronoListeners.toArray(tmp); Consumer<Chronology>[] listeners = chronoListeners.toArray(tmp);
chronoListeners.clear(); chronoListeners.clear();
for (Consumer<Chronology> l : listeners) { for (Consumer<Chronology> l : listeners) {
......
...@@ -266,14 +266,14 @@ final class Parsed implements TemporalAccessor { ...@@ -266,14 +266,14 @@ final class Parsed implements TemporalAccessor {
TemporalAccessor resolvedObject = targetField.resolve(fieldValues, this, resolverStyle); TemporalAccessor resolvedObject = targetField.resolve(fieldValues, this, resolverStyle);
if (resolvedObject != null) { if (resolvedObject != null) {
if (resolvedObject instanceof ChronoZonedDateTime) { if (resolvedObject instanceof ChronoZonedDateTime) {
ChronoZonedDateTime czdt = (ChronoZonedDateTime) resolvedObject; ChronoZonedDateTime<?> czdt = (ChronoZonedDateTime) resolvedObject;
if (zone.equals(czdt.getZone()) == false) { if (zone.equals(czdt.getZone()) == false) {
throw new DateTimeException("ChronoZonedDateTime must use the effective parsed zone: " + zone); throw new DateTimeException("ChronoZonedDateTime must use the effective parsed zone: " + zone);
} }
resolvedObject = czdt.toLocalDateTime(); resolvedObject = czdt.toLocalDateTime();
} }
if (resolvedObject instanceof ChronoLocalDateTime) { if (resolvedObject instanceof ChronoLocalDateTime) {
ChronoLocalDateTime cldt = (ChronoLocalDateTime) resolvedObject; ChronoLocalDateTime<?> cldt = (ChronoLocalDateTime) resolvedObject;
updateCheckConflict(cldt.toLocalTime(), Period.ZERO); updateCheckConflict(cldt.toLocalTime(), Period.ZERO);
updateCheckConflict(cldt.toLocalDate()); updateCheckConflict(cldt.toLocalDate());
changedCount++; changedCount++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册