Skip to content

Commit

Permalink
8339550: Enable javac lint options for tests
Browse files Browse the repository at this point in the history
8338340: [TestBug] fix varargs parameter type warnings

Reviewed-by: angorya, mhanl
kevinrushforth committed Sep 16, 2024
1 parent 4f1d42a commit 3e6a272
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -577,7 +577,9 @@ def defaultToolLintOptions = ""
defineProperty("TOOL_LINT", defaultToolLintOptions)
ext.IS_TOOL_LINT = TOOL_LINT != ""

def defaultTestLintOptions = ""
def defaultTestLintOptions =
"-options" + "," +
"removal"
defineProperty("TEST_LINT", defaultTestLintOptions)
ext.IS_TEST_LINT = TEST_LINT != ""

@@ -587,7 +589,7 @@ ext.IS_JAVAC_WERROR = Boolean.parseBoolean(JAVAC_WERROR)
defineProperty("TOOL_JAVAC_WERROR", "false")
ext.IS_TOOL_JAVAC_WERROR = Boolean.parseBoolean(TOOL_JAVAC_WERROR)

defineProperty("TEST_JAVAC_WERROR", "false")
defineProperty("TEST_JAVAC_WERROR", "true")
ext.IS_TEST_JAVAC_WERROR = Boolean.parseBoolean(TEST_JAVAC_WERROR)

// Doclint options (all enabled by default)
@@ -2137,7 +2139,7 @@ allprojects {
testImplementation group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.8.1"
testImplementation group: "org.junit.jupiter", name: "junit-jupiter-params", version: "5.8.1"
testImplementation group: "org.opentest4j", name: "opentest4j", version: "1.2.0"
testRuntimeOnly group: "org.apiguardian", name: "apiguardian-api", version: "1.1.2"
testImplementation group: "org.apiguardian", name: "apiguardian-api", version: "1.1.2"
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.8.1"
testRuntimeOnly group: "org.junit.platform", name: "junit-platform-commons", version: "1.8.1"
testRuntimeOnly group: "org.junit.platform", name: "junit-platform-engine", version: "1.8.1"
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ public static NumberFormat getNumberFormatVar(NumberStringConverter nsc) {
return nsc.numberFormat;
}

@SuppressWarnings("removal")
public static NumberFormat getNumberFormat(NumberStringConverter nsc) {
return nsc.getNumberFormat();
}
Original file line number Diff line number Diff line change
@@ -226,7 +226,7 @@ private void testLatch(CountDownLatch latch) {
final byte[] expectedArrayBuffer = in.readAllBytes();
submit(() -> {
final JSObject obj = (JSObject) getEngine().executeScript("new Uint8Array(window.result)");
assertEquals(String.format("%s length must be equal in both Java & JavaScript", fileList),
assertEquals(String.format("%s length must be equal in both Java & JavaScript", fileList[0]),
expectedArrayBuffer.length, obj.getMember("length"));
for (int i = 0; i < expectedArrayBuffer.length; i++) {
assertEquals("Unexpected file content received", expectedArrayBuffer[i], ((Number)(obj.getSlot(i))).byteValue());
Original file line number Diff line number Diff line change
@@ -444,7 +444,7 @@ public void testMousePressThrowsISEOnWrongThread() {
public void testMousePressThrowsNPEForNullArgument() {
Util.runAndWait(() -> {
try {
robot.mousePress(null);
robot.mousePress((MouseButton[])null);
} catch (NullPointerException e) {
return;
}
@@ -466,7 +466,7 @@ public void testMouseReleaseThrowsISEOnWrongThread() {
public void testMouseReleaseThrowsNPEForNullArgument() {
Util.runAndWait(() -> {
try {
robot.mouseRelease(null);
robot.mouseRelease((MouseButton[])null);
} catch (NullPointerException e) {
return;
}
@@ -488,7 +488,7 @@ public void testMouseClickThrowsISEOnWrongThread() {
public void testMouseClickThrowsNPEForNullArgument() {
Util.runAndWait(() -> {
try {
robot.mouseClick(null);
robot.mouseClick((MouseButton[])null);
} catch (NullPointerException e) {
return;
}

1 comment on commit 3e6a272

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.