Skip to content

Commit 00be643

Browse files
author
Roger Riggs
committed
8367031: [backout] Change java.time month/day field types to 'byte'
Reviewed-by: lancea, shade, alanb Backport-of: 0756ecb214b8ab76cb69f354063d153b72f978c2
1 parent cefd945 commit 00be643

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/java.base/share/classes/java/time/LocalDate.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ public final class LocalDate
182182
/**
183183
* @serial The month-of-year.
184184
*/
185-
private final byte month;
185+
private final short month;
186186
/**
187187
* @serial The day-of-month.
188188
*/
189-
private final byte day;
189+
private final short day;
190190

191191
//-----------------------------------------------------------------------
192192
/**
@@ -490,8 +490,8 @@ private static LocalDate resolvePreviousValid(int year, int month, int day) {
490490
*/
491491
private LocalDate(int year, int month, int dayOfMonth) {
492492
this.year = year;
493-
this.month = (byte) month;
494-
this.day = (byte) dayOfMonth;
493+
this.month = (short) month;
494+
this.day = (short) dayOfMonth;
495495
}
496496

497497
//-----------------------------------------------------------------------

src/java.base/share/classes/java/time/MonthDay.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ public final class MonthDay
146146
/**
147147
* @serial The month-of-year, not null.
148148
*/
149-
private final byte month;
149+
private final int month;
150150
/**
151151
* @serial The day-of-month.
152152
*/
153-
private final byte day;
153+
private final int day;
154154

155155
//-----------------------------------------------------------------------
156156
/**
@@ -319,8 +319,8 @@ public static MonthDay parse(CharSequence text, DateTimeFormatter formatter) {
319319
* @param dayOfMonth the day-of-month to represent, validated from 1 to 29-31
320320
*/
321321
private MonthDay(int month, int dayOfMonth) {
322-
this.month = (byte) month;
323-
this.day = (byte) dayOfMonth;
322+
this.month = month;
323+
this.day = dayOfMonth;
324324
}
325325

326326
//-----------------------------------------------------------------------

src/java.base/share/classes/java/time/YearMonth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public final class YearMonth
153153
/**
154154
* @serial The month-of-year, not null.
155155
*/
156-
private final byte month;
156+
private final int month;
157157

158158
//-----------------------------------------------------------------------
159159
/**
@@ -306,7 +306,7 @@ public static YearMonth parse(CharSequence text, DateTimeFormatter formatter) {
306306
*/
307307
private YearMonth(int year, int month) {
308308
this.year = year;
309-
this.month = (byte) month;
309+
this.month = month;
310310
}
311311

312312
/**

src/java.base/share/classes/java/time/chrono/HijrahDate.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2019, 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
@@ -137,11 +137,11 @@ public final class HijrahDate
137137
/**
138138
* The month-of-year.
139139
*/
140-
private final transient byte monthOfYear;
140+
private final transient int monthOfYear;
141141
/**
142142
* The day-of-month.
143143
*/
144-
private final transient byte dayOfMonth;
144+
private final transient int dayOfMonth;
145145

146146
//-------------------------------------------------------------------------
147147
/**
@@ -273,8 +273,8 @@ private HijrahDate(HijrahChronology chrono, int prolepticYear, int monthOfYear,
273273

274274
this.chrono = chrono;
275275
this.prolepticYear = prolepticYear;
276-
this.monthOfYear = (byte) monthOfYear;
277-
this.dayOfMonth = (byte) dayOfMonth;
276+
this.monthOfYear = monthOfYear;
277+
this.dayOfMonth = dayOfMonth;
278278
}
279279

280280
/**
@@ -287,8 +287,8 @@ private HijrahDate(HijrahChronology chrono, long epochDay) {
287287

288288
this.chrono = chrono;
289289
this.prolepticYear = dateInfo[0];
290-
this.monthOfYear = (byte) dateInfo[1];
291-
this.dayOfMonth = (byte) dateInfo[2];
290+
this.monthOfYear = dateInfo[1];
291+
this.dayOfMonth = dateInfo[2];
292292
}
293293

294294
//-----------------------------------------------------------------------

0 commit comments

Comments
 (0)