Skip to content

Commit d4c9a88

Browse files
justin-curtis-lunaotoj
authored andcommitted
6560981: (cal) unused local variables in GregorianCalendar, etc.
Reviewed-by: naoto, bchristi, iris
1 parent 5dd851d commit d4c9a88

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/java.base/share/classes/java/util/GregorianCalendar.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,6 @@ private int computeFields(int fieldMask, int tzMask) {
24312431
long fixedDateJan1 = calsys.getFixedDate(normalizedYear, 1, 1, cdate);
24322432
int dayOfYear = (int)(fixedDate - fixedDateJan1) + 1;
24332433
long fixedDateMonth1 = fixedDate - dayOfMonth + 1;
2434-
int cutoverGap = 0;
24352434
int cutoverYear = (calsys == gcal) ? gregorianCutoverYear : gregorianCutoverYearJulian;
24362435
int relativeDayOfMonth = dayOfMonth - 1;
24372436

@@ -2447,9 +2446,7 @@ private int computeFields(int fieldMask, int tzMask) {
24472446
fixedDateMonth1 = getFixedDateMonth1(cdate, fixedDate);
24482447
}
24492448
}
2450-
int realDayOfYear = (int)(fixedDate - fixedDateJan1) + 1;
2451-
cutoverGap = dayOfYear - realDayOfYear;
2452-
dayOfYear = realDayOfYear;
2449+
dayOfYear = (int)(fixedDate - fixedDateJan1) + 1;
24532450
relativeDayOfMonth = (int)(fixedDate - fixedDateMonth1);
24542451
}
24552452
internalSet(DAY_OF_YEAR, dayOfYear);

src/java.base/share/classes/java/util/JapaneseImperialCalendar.java

-1
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,6 @@ private long getFixedDate(int era, int year, int fieldMask) {
21182118
* @param fixedDate the fixed date representation of the date
21192119
*/
21202120
private long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
2121-
Era era = date.getEra();
21222121
if (date.getEra() != null && date.getYear() == 1) {
21232122
for (int eraIndex = getEraIndex(date); eraIndex > 0; eraIndex--) {
21242123
CalendarDate d = eras[eraIndex].getSinceDate();

src/java.base/share/classes/sun/util/calendar/BaseCalendar.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -494,7 +494,7 @@ public int getYearFromFixedDate(long fixedDate) {
494494
*/
495495
final int getGregorianYearFromFixedDate(long fixedDate) {
496496
long d0;
497-
int d1, d2, d3, d4;
497+
int d1, d2, d3;
498498
int n400, n100, n4, n1;
499499
int year;
500500

@@ -507,7 +507,6 @@ final int getGregorianYearFromFixedDate(long fixedDate) {
507507
n4 = d2 / 1461;
508508
d3 = d2 % 1461;
509509
n1 = d3 / 365;
510-
d4 = (d3 % 365) + 1;
511510
} else {
512511
d0 = fixedDate - 1;
513512
n400 = (int)CalendarUtils.floorDivide(d0, 146097L);
@@ -517,7 +516,6 @@ final int getGregorianYearFromFixedDate(long fixedDate) {
517516
n4 = CalendarUtils.floorDivide(d2, 1461);
518517
d3 = CalendarUtils.mod(d2, 1461);
519518
n1 = CalendarUtils.floorDivide(d3, 365);
520-
d4 = CalendarUtils.mod(d3, 365) + 1;
521519
}
522520
year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
523521
if (!(n100 == 4 || n1 == 4)) {

0 commit comments

Comments
 (0)