Skip to content

Commit dab2016

Browse files
committed
Enable all compiler warnings for Java test sources
1 parent b0f78a2 commit dab2016

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ tasks.compileJava {
274274
tasks.compileTestJava {
275275
// See: https://docs.oracle.com/en/java/javase/12/tools/javac.html
276276
options.compilerArgs.addAll(listOf(
277-
"-Xlint", // Enables all recommended warnings.
278-
"-Xlint:-overrides", // Disables "method overrides" warnings.
277+
"-Xlint:all", // Enables all recommended warnings.
279278
"-Werror", // Terminates compilation when warnings occur.
280279
"-parameters" // Generates metadata for reflection on method parameters.
281280
))

jupiter-tests/src/test/java/org/junit/jupiter/api/AssertEqualsAssertionsTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ void chars() {
752752

753753
// -------------------------------------------------------------------------
754754

755+
@SuppressWarnings("overrides")
755756
private static class EqualsThrowsException {
756757

757758
@Override

jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotEqualsAssertionsTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ void chars() {
757757

758758
// -------------------------------------------------------------------------
759759

760+
@SuppressWarnings("overrides")
760761
private static class EqualsThrowsExceptionClass {
761762

762763
@Override

platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ public boolean equals(Object obj) {
167167
return Objects.equals(this.title, that.title);
168168
}
169169

170+
@Override
171+
public int hashCode() {
172+
return Objects.hash(title);
173+
}
174+
170175
}
171176

172177
static class Journal {
@@ -188,6 +193,11 @@ public boolean equals(Object obj) {
188193
return Objects.equals(this.title, that.title);
189194
}
190195

196+
@Override
197+
public int hashCode() {
198+
return Objects.hash(title);
199+
}
200+
191201
}
192202

193203
static class Newspaper {
@@ -217,6 +227,11 @@ public boolean equals(Object obj) {
217227
return Objects.equals(this.title, that.title);
218228
}
219229

230+
@Override
231+
public int hashCode() {
232+
return Objects.hash(title);
233+
}
234+
220235
}
221236

222237
static class Magazine {

0 commit comments

Comments
 (0)