chore: 优化 JSR305 注解的使用

This commit is contained in:
2025-03-22 15:30:29 +08:00
parent 90da2b8eaa
commit 2f1df1b188
22 changed files with 155 additions and 134 deletions

View File

@@ -27,7 +27,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.errorprone.annotations.Immutable;
@@ -52,7 +52,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
/** 季度结束日期 */
private final LocalDate lastDate;
private YearQuarter(int year, @Nonnull Quarter quarter) {
private YearQuarter(int year, Quarter quarter) {
this.year = year;
this.quarter = quarter;
this.firstDate = quarter.firstMonthDay().atYear(year);
@@ -249,7 +249,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj)
return true;
if (obj == null)
@@ -264,6 +264,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
// #region - compare
@SuppressWarnings("null")
@Override
public int compareTo(YearQuarter other) {
int cmp = (this.year - other.year);

View File

@@ -24,4 +24,7 @@
*
* @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/
@ParametersAreNonnullByDefault
package xyz.zhouxy.plusone.commons.time;
import javax.annotation.ParametersAreNonnullByDefault;