mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8274835: Remove unnecessary castings in java.base
Reviewed-by: mullan, naoto, lancea, bpb
This commit is contained in:
parent
3b2585c02b
commit
5a2452c80e
15 changed files with 32 additions and 35 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2021, 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
|
||||
|
@ -624,7 +624,7 @@ public class GregorianCalendar extends Calendar {
|
|||
*/
|
||||
public GregorianCalendar(TimeZone zone, Locale aLocale) {
|
||||
super(zone, aLocale);
|
||||
gdate = (BaseCalendar.Date) gcal.newCalendarDate(zone);
|
||||
gdate = gcal.newCalendarDate(zone);
|
||||
setTimeInMillis(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ public class GregorianCalendar extends Calendar {
|
|||
GregorianCalendar(int year, int month, int dayOfMonth,
|
||||
int hourOfDay, int minute, int second, int millis) {
|
||||
super();
|
||||
gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
|
||||
gdate = gcal.newCalendarDate(getZone());
|
||||
this.set(YEAR, year);
|
||||
this.set(MONTH, month);
|
||||
this.set(DAY_OF_MONTH, dayOfMonth);
|
||||
|
@ -736,7 +736,7 @@ public class GregorianCalendar extends Calendar {
|
|||
*/
|
||||
GregorianCalendar(TimeZone zone, Locale locale, boolean flag) {
|
||||
super(zone, locale);
|
||||
gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
|
||||
gdate = gcal.newCalendarDate(getZone());
|
||||
}
|
||||
|
||||
/////////////////
|
||||
|
@ -2370,7 +2370,7 @@ public class GregorianCalendar extends Calendar {
|
|||
} else {
|
||||
// Handle Julian calendar dates.
|
||||
calsys = getJulianCalendarSystem();
|
||||
cdate = (BaseCalendar.Date) jcal.newCalendarDate(getZone());
|
||||
cdate = jcal.newCalendarDate(getZone());
|
||||
jcal.getCalendarDateFromFixedDate(cdate, fixedDate);
|
||||
Era e = cdate.getEra();
|
||||
if (e == jeras[0]) {
|
||||
|
@ -3109,7 +3109,7 @@ public class GregorianCalendar extends Calendar {
|
|||
return (int)(next1 - month1);
|
||||
}
|
||||
if (cdate != gdate) {
|
||||
date = (BaseCalendar.Date) gcal.newCalendarDate(TimeZone.NO_TIMEZONE);
|
||||
date = gcal.newCalendarDate(TimeZone.NO_TIMEZONE);
|
||||
}
|
||||
gcal.getCalendarDateFromFixedDate(date, next1);
|
||||
next1 = getFixedDateMonth1(date, next1);
|
||||
|
@ -3198,7 +3198,7 @@ public class GregorianCalendar extends Calendar {
|
|||
throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
if (gdate == null) {
|
||||
gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
|
||||
gdate = gcal.newCalendarDate(getZone());
|
||||
cachedFixedDate = Long.MIN_VALUE;
|
||||
}
|
||||
setGregorianChange(gregorianCutover);
|
||||
|
|
|
@ -335,7 +335,7 @@ public class HashSet<E>
|
|||
.checkArray(s, Map.Entry[].class, HashMap.tableSizeFor(capacity));
|
||||
|
||||
// Create backing HashMap
|
||||
map = (((HashSet<?>)this) instanceof LinkedHashSet ?
|
||||
map = (this instanceof LinkedHashSet ?
|
||||
new LinkedHashMap<>(capacity, loadFactor) :
|
||||
new HashMap<>(capacity, loadFactor));
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, 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
|
||||
|
@ -612,7 +612,7 @@ abstract class ReferencePipeline<P_IN, P_OUT>
|
|||
// Runtime checking will be performed when an element is stored in A[], thus if A is not a
|
||||
// super type of U an ArrayStoreException will be thrown.
|
||||
@SuppressWarnings("rawtypes")
|
||||
IntFunction rawGenerator = (IntFunction) generator;
|
||||
IntFunction rawGenerator = generator;
|
||||
return (A[]) Nodes.flatten(evaluateToArrayNode(rawGenerator), rawGenerator)
|
||||
.asArray(rawGenerator);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue