8260522: Clean up warnings in hotspot JTReg runtime tests
Reviewed-by: lfoltan, coleenp
This commit is contained in:
parent
02d586e13e
commit
181d63ffce
test
hotspot/jtreg
runtime
CommandLine/OptionsValidation
LoadClass
cds/appcds
modules/PatchModule
records
reflect
sealedClasses
verifier/defaultMethods
testlibrary/jvmti
lib/jdk/test/lib/classloader
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -63,8 +63,8 @@ public class TestJcmdOutput {
|
||||
public static class runJcmd {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
int minHeapFreeRatio = new Integer((new DynamicVMOption("MinHeapFreeRatio")).getValue());
|
||||
int maxHeapFreeRatio = new Integer((new DynamicVMOption("MaxHeapFreeRatio")).getValue());
|
||||
int minHeapFreeRatio = Integer.valueOf((new DynamicVMOption("MinHeapFreeRatio")).getValue());
|
||||
int maxHeapFreeRatio = Integer.valueOf((new DynamicVMOption("MaxHeapFreeRatio")).getValue());
|
||||
PidJcmdExecutor executor = new PidJcmdExecutor();
|
||||
|
||||
Asserts.assertGT(minHeapFreeRatio, 0, "MinHeapFreeRatio must be greater than 0");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -76,7 +76,7 @@ public class DoubleJVMOption extends JVMOption {
|
||||
*/
|
||||
@Override
|
||||
void setMin(String min) {
|
||||
this.min = new Double(min);
|
||||
this.min = Double.valueOf(min);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +96,7 @@ public class DoubleJVMOption extends JVMOption {
|
||||
*/
|
||||
@Override
|
||||
void setMax(String max) {
|
||||
this.max = new Double(max);
|
||||
this.max = Double.valueOf(max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,6 +39,7 @@ import java.nio.file.FileStore;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.spi.ToolProvider;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
@ -47,6 +48,9 @@ public class LongBCP {
|
||||
|
||||
private static final int MAX_PATH = 260;
|
||||
|
||||
private static final ToolProvider JAR = ToolProvider.findFirst("jar")
|
||||
.orElseThrow(() -> new RuntimeException("ToolProvider for jar not found"));
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
Path sourceDir = Paths.get(System.getProperty("test.src"), "test-classes");
|
||||
Path classDir = Paths.get(System.getProperty("test.classes"));
|
||||
@ -85,11 +89,9 @@ public class LongBCP {
|
||||
.shouldHaveExitValue(0);
|
||||
|
||||
// create a hello.jar
|
||||
sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
|
||||
String helloJar = destDir.toString() + File.separator + "hello.jar";
|
||||
if (!jarTool.run(new String[]
|
||||
{"-cf", helloJar, "-C", destDir.toString(), "Hello.class"})) {
|
||||
throw new RuntimeException("Could not write the Hello jar file");
|
||||
if (JAR.run(System.out, System.err, "-cf", helloJar, "-C", destDir.toString(), "Hello.class") != 0) {
|
||||
throw new RuntimeException("jar operation for hello.jar failed");
|
||||
}
|
||||
|
||||
// run with long bootclasspath to hello.jar
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -89,7 +89,7 @@ public class TriggerResize extends ClassLoader
|
||||
{
|
||||
int count = 0;
|
||||
if (args.length >= 1) {
|
||||
Integer i = new Integer(args[0]);
|
||||
Integer i = Integer.parseInt(args[0]);
|
||||
count = i.intValue();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,6 @@ public class CommandLineFlagCombo {
|
||||
// shared base address test table
|
||||
private static final String[] testTable = {
|
||||
"-XX:+UseG1GC", "-XX:+UseSerialGC", "-XX:+UseParallelGC",
|
||||
"-XX:+FlightRecorder",
|
||||
"-XX:+UseLargePages", // may only take effect on machines with large-pages
|
||||
"-XX:+UseCompressedClassPointers",
|
||||
"-XX:+UseCompressedOops",
|
||||
@ -122,7 +121,7 @@ public class CommandLineFlagCombo {
|
||||
}
|
||||
}
|
||||
|
||||
if (!WhiteBox.getWhiteBox().isJFRIncludedInVmBuild() && testEntry.equals("-XX:+FlightRecorder"))
|
||||
if (!WhiteBox.getWhiteBox().isJFRIncludedInVmBuild())
|
||||
{
|
||||
System.out.println("JFR does not exist");
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,7 +49,6 @@ public class TestWithProfiler {
|
||||
output = TestCommon.exec(appJar,
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-Xint",
|
||||
"-XX:+FlightRecorder",
|
||||
"-XX:StartFlightRecording=duration=15s,filename=myrecording.jfr,settings=profile,dumponexit=true",
|
||||
"TestWithProfilerHelper");
|
||||
TestCommon.checkExec(output);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,7 +45,7 @@ public class MirrorWithReferenceFieldsApp {
|
||||
|
||||
public MirrorWithReferenceFieldsApp() {
|
||||
non_archived_field_1 = new Object();
|
||||
non_archived_field_2 = new Integer(1);
|
||||
non_archived_field_2 = Integer.valueOf(1);
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,13 +31,16 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import sun.tools.jar.Main;
|
||||
import java.util.spi.ToolProvider;
|
||||
|
||||
// Using JarBuilder requires that all to-be-jarred classes should be placed
|
||||
// in the current working directory, aka "."
|
||||
public class BasicJarBuilder {
|
||||
private static final String classDir = System.getProperty("test.classes");
|
||||
|
||||
private static final ToolProvider JAR = ToolProvider.findFirst("jar")
|
||||
.orElseThrow(() -> new RuntimeException("ToolProvider for jar not found"));
|
||||
|
||||
public static void build(boolean classesInWorkDir, String jarName,
|
||||
String ...classNames) throws Exception {
|
||||
|
||||
@ -73,8 +76,7 @@ public class BasicJarBuilder {
|
||||
}
|
||||
|
||||
private static void createJar(ArrayList<String> args) {
|
||||
Main jarTool = new Main(System.out, System.err, "jar");
|
||||
if (!jarTool.run(args.toArray(new String[1]))) {
|
||||
if (JAR.run(System.out, System.err, args.toArray(new String[1])) != 0) {
|
||||
throw new RuntimeException("jar operation failed");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,6 @@
|
||||
* @summary Test that a class that is a record can be redefined.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @requires vm.jvmti
|
||||
* @run main RedefineRecord buildagent
|
||||
* @run main/othervm/timeout=6000 RedefineRecord runtest
|
||||
@ -41,11 +40,15 @@ import java.lang.instrument.ClassFileTransformer;
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.lang.instrument.IllegalClassFormatException;
|
||||
import java.util.spi.ToolProvider;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class RedefineRecord {
|
||||
|
||||
private static final ToolProvider JAR = ToolProvider.findFirst("jar")
|
||||
.orElseThrow(() -> new RuntimeException("ToolProvider for jar not found"));
|
||||
|
||||
record Tester(int x, String y, long z) { }
|
||||
|
||||
static class LoggingTransformer implements ClassFileTransformer {
|
||||
@ -67,6 +70,7 @@ public class RedefineRecord {
|
||||
inst.retransformClasses(demoClass);
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildAgent() {
|
||||
try {
|
||||
ClassFileInstaller.main("RedefineRecord");
|
||||
@ -85,11 +89,11 @@ public class RedefineRecord {
|
||||
throw new RuntimeException("Could not write manifest file for the agent", e);
|
||||
}
|
||||
|
||||
sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
|
||||
if (!jarTool.run(new String[] { "-cmf", "MANIFEST.MF", "redefineagent.jar", "RedefineRecord.class" })) {
|
||||
if (JAR.run(System.out, System.err, "-cmf", "MANIFEST.MF", "redefineagent.jar", "RedefineRecord.class") != 0) {
|
||||
throw new RuntimeException("Could not write the agent jar file");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) throws Exception {
|
||||
if (argv.length == 1 && argv[0].equals("buildagent")) {
|
||||
buildAgent();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,7 +32,7 @@ import java.lang.reflect.Array;
|
||||
|
||||
public class ArrayGetIntException {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Object[] objArray = {new Integer(Integer.MAX_VALUE)};
|
||||
Object[] objArray = {Integer.valueOf(Integer.MAX_VALUE)};
|
||||
|
||||
// this access is legal
|
||||
try {
|
||||
|
@ -29,7 +29,6 @@
|
||||
class, can be redefined.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} RedefinePermittedSubclass.java
|
||||
* @run main/othervm --enable-preview RedefinePermittedSubclass buildagent
|
||||
@ -41,13 +40,17 @@ import java.io.PrintWriter;
|
||||
import java.lang.RuntimeException;
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.lang.instrument.IllegalClassFormatException;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.util.spi.ToolProvider;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class RedefinePermittedSubclass {
|
||||
|
||||
private static final ToolProvider JAR = ToolProvider.findFirst("jar")
|
||||
.orElseThrow(() -> new RuntimeException("ToolProvider for jar not found"));
|
||||
|
||||
non-sealed class A extends Tester {
|
||||
public void printIt() { System.out.println("In A"); }
|
||||
}
|
||||
@ -99,8 +102,8 @@ public class RedefinePermittedSubclass {
|
||||
throw new RuntimeException("Could not write manifest file for the agent", e);
|
||||
}
|
||||
|
||||
sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
|
||||
if (!jarTool.run(new String[] { "-cmf", "MANIFEST.MF", "redefineagent.jar", "RedefinePermittedSubclass.class" })) {
|
||||
if (JAR.run(System.out, System.err, "-cmf", "MANIFEST.MF", "redefineagent.jar",
|
||||
"RedefinePermittedSubclass.class") != 0) {
|
||||
throw new RuntimeException("Could not write the agent jar file");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,6 @@
|
||||
* @summary Test that a class that is a sealed class can be redefined.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineSealedClass.java
|
||||
* @run main/othervm --enable-preview RedefineSealedClass buildagent
|
||||
@ -40,13 +39,17 @@ import java.io.PrintWriter;
|
||||
import java.lang.RuntimeException;
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.lang.instrument.IllegalClassFormatException;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.util.spi.ToolProvider;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class RedefineSealedClass {
|
||||
|
||||
private static final ToolProvider JAR = ToolProvider.findFirst("jar")
|
||||
.orElseThrow(() -> new RuntimeException("ToolProvider for jar not found"));
|
||||
|
||||
final class A extends Tester { }
|
||||
final class B extends Tester { }
|
||||
|
||||
@ -90,8 +93,7 @@ public class RedefineSealedClass {
|
||||
throw new RuntimeException("Could not write manifest file for the agent", e);
|
||||
}
|
||||
|
||||
sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
|
||||
if (!jarTool.run(new String[] { "-cmf", "MANIFEST.MF", "redefineagent.jar", "RedefineSealedClass.class" })) {
|
||||
if (JAR.run(System.out, System.err, "-cmf", "MANIFEST.MF", "redefineagent.jar", "RedefineSealedClass.class") != 0) {
|
||||
throw new RuntimeException("Could not write the agent jar file");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -71,10 +71,10 @@ public class DefaultMethodRegressionTests {
|
||||
}
|
||||
void testLostOverloadedMethod() {
|
||||
C c = new C();
|
||||
assertEquals(c.bbb(new Integer(1)), 22);
|
||||
assertEquals(c.bbb(new Float(1.1)), 33);
|
||||
assertEquals(c.bbb(new Long(1L)), 44);
|
||||
assertEquals(c.bbb(new Double(0.01)), 55);
|
||||
assertEquals(c.bbb(Integer.valueOf(1)), 22);
|
||||
assertEquals(c.bbb(Float.valueOf(1.1F)), 33);
|
||||
assertEquals(c.bbb(Long.valueOf(1L)), 44);
|
||||
assertEquals(c.bbb(Double.valueOf(0.01)), 55);
|
||||
assertEquals(c.bbb(new String("")), 66);
|
||||
}
|
||||
// Test to ensure that the inference verifier accepts older classfiles
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -98,9 +98,9 @@ public class TransformerAgent {
|
||||
static Integer incrCounter(String className) {
|
||||
Integer i = counterMap.get(className);
|
||||
if (i == null) {
|
||||
i = new Integer(1);
|
||||
i = Integer.valueOf(1);
|
||||
} else {
|
||||
i = new Integer(i.intValue() + 1);
|
||||
i = Integer.valueOf(i.intValue() + 1);
|
||||
}
|
||||
counterMap.put(className, i);
|
||||
return i;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -173,7 +173,7 @@ public class GeneratingClassLoader extends ClassLoader {
|
||||
if (i == bytecode.length) {
|
||||
break;
|
||||
}
|
||||
offsets.add(new Integer(i));
|
||||
offsets.add(i);
|
||||
i++;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user