Skip to content

Commit 9ca9a49

Browse files
committed
Fix checkstyle issues in samples
Fix checkstyle issues with samples following the spring-javaformat upgrade. See gh-13932
1 parent 63b6098 commit 9ca9a49

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/HotelSummary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface HotelSummary {
2525
Double getAverageRating();
2626

2727
default Integer getAverageRatingRounded() {
28-
return (getAverageRating() != null ? (int) Math.round(getAverageRating()) : null);
28+
return (getAverageRating() != null) ? (int) Math.round(getAverageRating()) : null;
2929
}
3030

3131
}

spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private static class ReviewsSummaryImpl implements ReviewsSummary {
9191
@Override
9292
public long getNumberOfReviewsWithRating(Rating rating) {
9393
Long count = this.ratingCount.get(rating);
94-
return (count != null ? count : 0);
94+
return (count != null) ? count : 0;
9595
}
9696

9797
}

spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/domain/VehicleIdentificationNumber.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ public VehicleIdentificationNumber(String vin) {
3333
this.vin = vin;
3434
}
3535

36-
@Override
37-
public int hashCode() {
38-
return this.vin.hashCode();
39-
}
40-
4136
@Override
4237
public boolean equals(Object obj) {
4338
if (obj == this) {
@@ -49,6 +44,11 @@ public boolean equals(Object obj) {
4944
return this.vin.equals(((VehicleIdentificationNumber) obj).vin);
5045
}
5146

47+
@Override
48+
public int hashCode() {
49+
return this.vin.hashCode();
50+
}
51+
5252
@Override
5353
public String toString() {
5454
return this.vin;

spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleDetails.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ public String getModel() {
4949
return this.model;
5050
}
5151

52-
@Override
53-
public int hashCode() {
54-
return this.make.hashCode() * 31 + this.model.hashCode();
55-
}
56-
5752
@Override
5853
public boolean equals(Object obj) {
5954
if (obj == this) {
@@ -66,4 +61,9 @@ public boolean equals(Object obj) {
6661
return this.make.equals(other.make) && this.model.equals(other.model);
6762
}
6863

64+
@Override
65+
public int hashCode() {
66+
return this.make.hashCode() * 31 + this.model.hashCode();
67+
}
68+
6969
}

spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
2121
private final String echoFormat;
2222

2323
public DefaultEchoService(String echoFormat) {
24-
this.echoFormat = (echoFormat != null ? echoFormat : "%s");
24+
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
2525
}
2626

2727
@Override

spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
2121
private final String echoFormat;
2222

2323
public DefaultEchoService(String echoFormat) {
24-
this.echoFormat = (echoFormat != null ? echoFormat : "%s");
24+
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
2525
}
2626

2727
@Override

spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
2121
private final String echoFormat;
2222

2323
public DefaultEchoService(String echoFormat) {
24-
this.echoFormat = (echoFormat != null ? echoFormat : "%s");
24+
this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
2525
}
2626

2727
@Override

0 commit comments

Comments
 (0)