mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8334742: Change java.time month/day field types to 'byte'
Reviewed-by: rriggs
This commit is contained in:
parent
e3f85c961b
commit
4ced4e73fc
@ -182,11 +182,11 @@ public final class LocalDate
|
||||
/**
|
||||
* @serial The month-of-year.
|
||||
*/
|
||||
private final short month;
|
||||
private final byte month;
|
||||
/**
|
||||
* @serial The day-of-month.
|
||||
*/
|
||||
private final short day;
|
||||
private final byte day;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
@ -490,8 +490,8 @@ public final class LocalDate
|
||||
*/
|
||||
private LocalDate(int year, int month, int dayOfMonth) {
|
||||
this.year = year;
|
||||
this.month = (short) month;
|
||||
this.day = (short) dayOfMonth;
|
||||
this.month = (byte) month;
|
||||
this.day = (byte) dayOfMonth;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@ -146,11 +146,11 @@ public final class MonthDay
|
||||
/**
|
||||
* @serial The month-of-year, not null.
|
||||
*/
|
||||
private final int month;
|
||||
private final byte month;
|
||||
/**
|
||||
* @serial The day-of-month.
|
||||
*/
|
||||
private final int day;
|
||||
private final byte day;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
@ -319,8 +319,8 @@ public final class MonthDay
|
||||
* @param dayOfMonth the day-of-month to represent, validated from 1 to 29-31
|
||||
*/
|
||||
private MonthDay(int month, int dayOfMonth) {
|
||||
this.month = month;
|
||||
this.day = dayOfMonth;
|
||||
this.month = (byte) month;
|
||||
this.day = (byte) dayOfMonth;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@ -153,7 +153,7 @@ public final class YearMonth
|
||||
/**
|
||||
* @serial The month-of-year, not null.
|
||||
*/
|
||||
private final int month;
|
||||
private final byte month;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
@ -306,7 +306,7 @@ public final class YearMonth
|
||||
*/
|
||||
private YearMonth(int year, int month) {
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.month = (byte) month;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2025, 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
|
||||
@ -137,11 +137,11 @@ public final class HijrahDate
|
||||
/**
|
||||
* The month-of-year.
|
||||
*/
|
||||
private final transient int monthOfYear;
|
||||
private final transient byte monthOfYear;
|
||||
/**
|
||||
* The day-of-month.
|
||||
*/
|
||||
private final transient int dayOfMonth;
|
||||
private final transient byte dayOfMonth;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
@ -273,8 +273,8 @@ public final class HijrahDate
|
||||
|
||||
this.chrono = chrono;
|
||||
this.prolepticYear = prolepticYear;
|
||||
this.monthOfYear = monthOfYear;
|
||||
this.dayOfMonth = dayOfMonth;
|
||||
this.monthOfYear = (byte) monthOfYear;
|
||||
this.dayOfMonth = (byte) dayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -287,8 +287,8 @@ public final class HijrahDate
|
||||
|
||||
this.chrono = chrono;
|
||||
this.prolepticYear = dateInfo[0];
|
||||
this.monthOfYear = dateInfo[1];
|
||||
this.dayOfMonth = dateInfo[2];
|
||||
this.monthOfYear = (byte) dateInfo[1];
|
||||
this.dayOfMonth = (byte) dateInfo[2];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user