Skip to content

Commit 8a5542e

Browse files
committed
build(pom.xml): update ErrorProne to 2.3.3
- enable back ParameterName check - disable MixedMutabilityReturnType check - fix errors about using system timezone (see http://errorprone.info/bugpattern/JavaTimeDefaultTimeZone and #76) Changelog: https://github.com/google/error-prone/releases/tag/v2.3.3 No functional changes.
1 parent b562070 commit 8a5542e

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@
494494
<dockerfile.plugin.version>1.4.6</dockerfile.plugin.version>
495495
<enforcer.plugin.version>1.4.1</enforcer.plugin.version>
496496
<error-prone-javac.version>9+181-r4173-1</error-prone-javac.version>
497-
<error-prone.version>2.3.2</error-prone.version>
497+
<error-prone.version>2.3.3</error-prone.version>
498498
<failsafe.plugin.version>2.22.0</failsafe.plugin.version>
499499
<fest.assert.version>2.0M8</fest.assert.version>
500500
<gmavenplus.plugin.version>1.5</gmavenplus.plugin.version>
@@ -804,9 +804,9 @@
804804
<!--
805805
The following checks have been disabled:
806806
- MissingOverride: produce false positives with @Getter from Lombok
807-
- ParameterName: workaround for https://github.com/google/error-prone/issues/780
807+
- MixedMutabilityReturnType: because I like to use Collections.empty*() methods
808808
-->
809-
<compilerArg>-Xplugin:ErrorProne -Xep:MissingOverride:OFF -Xep:ParameterName:OFF</compilerArg>
809+
<compilerArg>-Xplugin:ErrorProne -Xep:MissingOverride:OFF -Xep:MixedMutabilityReturnType:OFF</compilerArg>
810810
</compilerArgs>
811811
<annotationProcessorPaths>
812812
<path>

src/main/java/ru/mystamps/web/controller/editor/ReplaceRepeatingSpacesEditor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public class ReplaceRepeatingSpacesEditor extends PropertyEditorSupport {
3333

3434
@Override
3535
public void setAsText(String name) throws IllegalArgumentException {
36-
String text = name;
37-
38-
text = name.trim();
36+
String text = name.trim();
3937

4038
if (text.contains(" ")) {
4139
text = REPEATING_SPACES.matcher(text).replaceAll(" ");

src/main/java/ru/mystamps/web/feature/series/ReleaseDateIsNotInFutureValidator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.time.LocalDate;
2525
import java.time.Year;
2626
import java.time.YearMonth;
27+
import java.time.ZoneOffset;
2728

2829
/**
2930
* @author Sergey Chechenev
@@ -73,7 +74,7 @@ private static boolean yearInFuture(AddSeriesDto dto) {
7374
}
7475

7576
return Year.of(dto.getYear())
76-
.isAfter(Year.now());
77+
.isAfter(Year.now(ZoneOffset.UTC));
7778
}
7879

7980
private static boolean yearAndMonthInFuture(AddSeriesDto dto) {
@@ -82,7 +83,7 @@ private static boolean yearAndMonthInFuture(AddSeriesDto dto) {
8283
}
8384

8485
return YearMonth.of(dto.getYear(), dto.getMonth())
85-
.isAfter(YearMonth.now());
86+
.isAfter(YearMonth.now(ZoneOffset.UTC));
8687
}
8788

8889
private static boolean dateInFuture(AddSeriesDto dto) {
@@ -91,7 +92,7 @@ private static boolean dateInFuture(AddSeriesDto dto) {
9192
}
9293

9394
return LocalDate.of(dto.getYear(), dto.getMonth(), dto.getDay())
94-
.isAfter(LocalDate.now());
95+
.isAfter(LocalDate.now(ZoneOffset.UTC));
9596
}
9697

9798
}

src/main/java/ru/mystamps/web/feature/series/SeriesController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import javax.validation.groups.Default;
6565
import java.io.IOException;
6666
import java.time.Year;
67+
import java.time.ZoneOffset;
6768
import java.util.Collections;
6869
import java.util.HashMap;
6970
import java.util.LinkedHashMap;
@@ -80,8 +81,7 @@
8081
@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "PMD.TooManyMethods", "PMD.GodClass" })
8182
public class SeriesController {
8283

83-
private static final Integer CURRENT_YEAR = Integer.valueOf(Year.now().getValue());
84-
84+
private static final Integer CURRENT_YEAR;
8585
private static final Map<Integer, Integer> YEARS;
8686

8787
private final CategoryService categoryService;
@@ -93,6 +93,7 @@ public class SeriesController {
9393
private final ParticipantService participantService;
9494

9595
static {
96+
CURRENT_YEAR = Integer.valueOf(Year.now(ZoneOffset.UTC).getValue());
9697
YEARS = new LinkedHashMap<>();
9798
for (Integer i = CURRENT_YEAR; i >= MIN_RELEASE_YEAR; i--) {
9899
YEARS.put(i, i);

src/test/java/ru/mystamps/web/service/TestObjects.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import ru.mystamps.web.tests.Random;
5454
import ru.mystamps.web.util.SlugUtils;
5555

56-
import java.math.BigDecimal;
5756
import java.nio.charset.StandardCharsets;
5857
import java.util.Collections;
5958
import java.util.Date;
@@ -77,7 +76,6 @@ public final class TestObjects {
7776

7877
private static final String TEST_NAME = "Test Name";
7978
private static final String TEST_URL = "test.example.org";
80-
private static final BigDecimal TEST_PRICE = new BigDecimal("100.99");
8179

8280
private static final String TEST_ENTITY_NAME = TEST_NAME;
8381
private static final String TEST_ENTITY_SLUG = "test-slug";

src/test/java/ru/mystamps/web/tests/Random.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.text.ParseException;
3535
import java.text.SimpleDateFormat;
3636
import java.time.Year;
37+
import java.time.ZoneOffset;
3738
import java.util.Arrays;
3839
import java.util.Date;
3940
import java.util.List;
@@ -187,7 +188,10 @@ public static String sellerName() {
187188
}
188189

189190
public static Integer issueYear() {
190-
return between(ValidationRules.MIN_RELEASE_YEAR, Year.now().getValue()).integer();
191+
return between(
192+
ValidationRules.MIN_RELEASE_YEAR,
193+
Year.now(ZoneOffset.UTC).getValue()
194+
).integer();
191195
}
192196

193197
public static Integer quantity() {

0 commit comments

Comments
 (0)