diff --git a/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java b/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java index e880071e583..2368182f558 100644 --- a/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java +++ b/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java @@ -120,19 +120,16 @@ public class TestMaxNewSize { public static void main(String args[]) throws Exception { String gcName = args[0]; - final int M32 = 32 * 1024 * 1024; - final int M64 = 64 * 1024 * 1024; - final int M96 = 96 * 1024 * 1024; - final int M128 = 128 * 1024 * 1024; - checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, M128); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, M128); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, M128); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, M128); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, M32); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, M32); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, M32); - checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, M128); - checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, M96); - checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, M128); + final int M = 1024 * 1024; + checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, 128*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, 128*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, 128*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, 128*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, 32*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, 32*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, 32*M); + checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, 128*M); + checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, 96*M); + checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, 128*M); } } diff --git a/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java b/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java index 719e984bf29..deaab959594 100644 --- a/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java +++ b/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java @@ -297,6 +297,7 @@ public class TestTargetSurvivorRatioFlag { // force minor GC while (youngGCBean.getCollectionCount() <= initialGcId + MAX_TENURING_THRESHOLD * 2) { + @SuppressWarnings("unused") byte b[] = new byte[ARRAY_LENGTH]; } diff --git a/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java b/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java index 5c8d2e822b3..093b85a7a5d 100644 --- a/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java +++ b/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java @@ -41,6 +41,7 @@ public class DisableResizePLAB { } long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime < 10_000) { + @SuppressWarnings("unused") Object o = new byte[1024]; } } diff --git a/test/hotspot/jtreg/gc/cslocker/TestCSLocker.java b/test/hotspot/jtreg/gc/cslocker/TestCSLocker.java index 4032802e16f..f71eab2a7be 100644 --- a/test/hotspot/jtreg/gc/cslocker/TestCSLocker.java +++ b/test/hotspot/jtreg/gc/cslocker/TestCSLocker.java @@ -73,8 +73,8 @@ class GarbageProducer extends Thread while (isRunning) { try { - int[] arr = null; - arr = new int[size]; + @SuppressWarnings("unused") + int[] arr = new int[size]; sleep(sleepTime); } catch (InterruptedException e) { isRunning = false; diff --git a/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java b/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java index 012a9f6d74d..9d1c9341890 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java +++ b/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java @@ -57,8 +57,8 @@ public class TestMemoryMXBeans { MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); long heapInit = memoryMXBean.getHeapMemoryUsage().getInit(); long heapMax = memoryMXBean.getHeapMemoryUsage().getMax(); - long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit(); - long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax(); + memoryMXBean.getNonHeapMemoryUsage().getInit(); // value not used + memoryMXBean.getNonHeapMemoryUsage().getMax(); // value not used if (initSize > 0 && heapInit != initSize) { throw new IllegalStateException("Init heap size is wrong: " + heapInit + " vs " + initSize); diff --git a/test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java b/test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java index acd4a738cb2..0c3b759968f 100644 --- a/test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java +++ b/test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java @@ -130,7 +130,7 @@ public class TestFromCardCacheIndex { if (target == null) { continue; } - final long startAddress = WB.getObjectAddress(target); + WB.getObjectAddress(target); // startAddress not used final long lastAddress = getObjectLastAddress(target); final int card = getCardIndex32bit(lastAddress); if (card == -1) { diff --git a/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java b/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java index 7782b275120..4920c5af105 100644 --- a/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java +++ b/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java @@ -62,6 +62,7 @@ public class TestHumongousAllocNearlyFullRegion { for (int i = 0; i < heapSize; i++) { // 131069 is the number of longs it takes to fill a heapRegion except // for 8 bytes on 64 bit. + @SuppressWarnings("unused") long[] largeObect = new long[131069]; } } diff --git a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java index a206dc1a77a..3465c8f8444 100644 --- a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java +++ b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java @@ -54,10 +54,6 @@ public class TestRemsetLoggingThreads { OutputAnalyzer output = new OutputAnalyzer(pb.start()); - // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used. - // Additionally use at least one thread. - int expectedNumRefinementThreads = refinementThreads; - String pattern = "Concurrent RS threads times \\(s\\)$"; Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout()); diff --git a/test/hotspot/jtreg/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java b/test/hotspot/jtreg/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java index bd83dba3a85..84331048dec 100644 --- a/test/hotspot/jtreg/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java +++ b/test/hotspot/jtreg/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java @@ -139,6 +139,7 @@ public class TestNoAllocationsInHRegions { // Dead object allocation () -> { int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE); + @SuppressWarnings("unused") byte[] deadObject = new byte[size]; }, diff --git a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java index ddf7df33f97..95b25cd3e0b 100644 --- a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java +++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java @@ -27,7 +27,6 @@ package gc.logging; import java.io.File; import java.net.URL; import java.net.URLClassLoader; -import java.util.function.Predicate; import java.util.regex.Pattern; import java.util.regex.Matcher; @@ -67,8 +66,6 @@ public class TestMetaSpaceLog { } private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) { - Predicate collectedMetaSpace = line -> check(line); - // At least one metaspace line from GC should show GC being collected. boolean foundCollectedMetaSpace = output.asLines().stream() .filter(s -> s.contains("[gc,metaspace")) diff --git a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java index 406d28137d9..3f11b577d2a 100644 --- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java +++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java @@ -131,7 +131,6 @@ public class TestPrintReferences { // Find the first Reference Processing log and check its format. private static void checkLogFormat(OutputAnalyzer output, boolean parallelRefProcEnabled) { - String countRegex = "[0-9]+"; String timeRegex = doubleRegex + "ms"; /* Total Reference processing time */ diff --git a/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java b/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java index 17ebdf87c55..e959137311c 100644 --- a/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java +++ b/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java @@ -128,6 +128,7 @@ class MemoryStresser implements Runnable { // Dead object allocation () -> { int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE); + @SuppressWarnings("unused") byte[] deadObject = new byte[size]; } }; diff --git a/test/hotspot/jtreg/gc/metaspace/G1AddMetaspaceDependency.java b/test/hotspot/jtreg/gc/metaspace/G1AddMetaspaceDependency.java index ddf2bdce1fd..2fa74089c8b 100644 --- a/test/hotspot/jtreg/gc/metaspace/G1AddMetaspaceDependency.java +++ b/test/hotspot/jtreg/gc/metaspace/G1AddMetaspaceDependency.java @@ -111,13 +111,12 @@ public class G1AddMetaspaceDependency { Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader); Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader); - Class c; - c = b_loader.loadClass(b_name); - c = c_loader.loadClass(b_name); - c = d_loader.loadClass(b_name); - c = e_loader.loadClass(b_name); - c = f_loader.loadClass(b_name); - c = g_loader.loadClass(b_name); + b_loader.loadClass(b_name); + c_loader.loadClass(b_name); + d_loader.loadClass(b_name); + e_loader.loadClass(b_name); + f_loader.loadClass(b_name); + g_loader.loadClass(b_name); } public class A { } diff --git a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java index 7bd0f0b438a..d7270da0145 100644 --- a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java +++ b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java @@ -33,6 +33,7 @@ import java.util.ArrayList; */ public class TestMetaspaceInitialization { private class Internal { + @SuppressWarnings("unused") public int x; public Internal(int x) { this.x = x; diff --git a/test/hotspot/jtreg/gc/stress/gcbasher/Decompiler.java b/test/hotspot/jtreg/gc/stress/gcbasher/Decompiler.java index ca93f81ca20..a6b399bc013 100644 --- a/test/hotspot/jtreg/gc/stress/gcbasher/Decompiler.java +++ b/test/hotspot/jtreg/gc/stress/gcbasher/Decompiler.java @@ -132,7 +132,7 @@ class Decompiler { byteCodeIndex++; } - int def = cursor.readIntAt(byteCodeIndex); + cursor.readIntAt(byteCodeIndex); // def byteCodeIndex +=4; int npairs = cursor.readIntAt(byteCodeIndex); @@ -149,7 +149,7 @@ class Decompiler { byteCodeIndex++; } - int def = cursor.readIntAt(byteCodeIndex); + cursor.readIntAt(byteCodeIndex); // def byteCodeIndex +=4; int low = cursor.readIntAt(byteCodeIndex); @@ -245,7 +245,7 @@ class Decompiler { private ConstantPoolEntry[] decodeConstantPool() { final int CONSTANT_Utf8 = 1; - final int CONSTANT_Unicode = 2; + // final int CONSTANT_Unicode = 2; final int CONSTANT_Integer = 3; final int CONSTANT_Float = 4; final int CONSTANT_Long = 5;