mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8347840: Fix testlibrary compilation warnings
Reviewed-by: dholmes
This commit is contained in:
parent
2c41f5adbf
commit
2ca1b4d48d
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 2025, 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
|
||||
@ -64,7 +64,6 @@ $(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
|
||||
BIN := $(TEST_LIB_SUPPORT)/test-lib_classes, \
|
||||
HEADERS := $(TEST_LIB_SUPPORT)/test-lib_headers, \
|
||||
JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \
|
||||
DISABLED_WARNINGS := try deprecation rawtypes unchecked serial cast removal preview restricted dangling-doc-comments, \
|
||||
JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.attribute=ALL-UNNAMED \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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
|
||||
@ -638,7 +638,7 @@ public class Asserts {
|
||||
testMethod.execute();
|
||||
} catch (Throwable exc) {
|
||||
if (expected.isInstance(exc)) {
|
||||
return (T) exc;
|
||||
return expected.cast(exc);
|
||||
} else {
|
||||
fail(Objects.toString(msg, "An unexpected exception was thrown.")
|
||||
+ " Expected " + expected.getName(), exc);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, 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
|
||||
@ -429,7 +429,7 @@ public class LingeredApp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* High level interface for test writers
|
||||
*/
|
||||
|
||||
@ -599,6 +599,7 @@ public class LingeredApp {
|
||||
* This part is the application itself. First arg is optional "forceCrash".
|
||||
* Following arg is the lock file name.
|
||||
*/
|
||||
@SuppressWarnings("restricted")
|
||||
public static void main(String args[]) {
|
||||
boolean forceCrash = false;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2025, 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
|
||||
@ -33,7 +33,7 @@ public class ArtifactResolver {
|
||||
try {
|
||||
String managerName = System.getProperty("jdk.test.lib.artifacts.artifactmanager");
|
||||
if (managerName != null) {
|
||||
manager = (ArtifactManager) Class.forName(managerName).newInstance();
|
||||
manager = (ArtifactManager) Class.forName(managerName).getDeclaredConstructor().newInstance();
|
||||
} else if (System.getenv().containsKey(JibArtifactManager.JIB_HOME_ENV_NAME)) {
|
||||
manager = JibArtifactManager.newInstance();
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -23,10 +23,14 @@
|
||||
|
||||
package jdk.test.lib.artifacts;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* Thrown by the ArtifactResolver when failing to resolve an Artifact.
|
||||
*/
|
||||
public class ArtifactResolverException extends Exception {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8341884506180926911L;
|
||||
|
||||
public ArtifactResolverException(String message) {
|
||||
super(message);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2025, 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
|
||||
@ -75,7 +75,7 @@ public class JibArtifactManager implements ArtifactManager {
|
||||
ClassLoader oldContextLoader = currentThread.getContextClassLoader();
|
||||
currentThread.setContextClassLoader(classLoader);
|
||||
|
||||
Class jibServiceFactory = classLoader.loadClass(JIB_SERVICE_FACTORY);
|
||||
Class<?> jibServiceFactory = classLoader.loadClass(JIB_SERVICE_FACTORY);
|
||||
try {
|
||||
Object jibArtifactInstaller = jibServiceFactory.getMethod("createJibArtifactInstaller").invoke(null);
|
||||
return new JibArtifactManager(jibArtifactInstaller, classLoader);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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,6 +32,7 @@ package jdk.test.lib.classloader;
|
||||
import jdk.test.whitebox.WhiteBox;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serial;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
@ -45,6 +46,9 @@ import java.util.stream.Stream;
|
||||
|
||||
public class ClassUnloadCommon {
|
||||
public static class TestFailure extends RuntimeException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8108935949624559549L;
|
||||
|
||||
TestFailure(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, 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
|
||||
@ -38,13 +38,13 @@ class TemplateClass {
|
||||
|
||||
public class GeneratingClassLoader extends ClassLoader {
|
||||
|
||||
public synchronized Class loadClass(String name) throws ClassNotFoundException {
|
||||
public synchronized Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
return loadClass(name, false);
|
||||
}
|
||||
|
||||
public synchronized Class loadClass(String name, boolean resolve)
|
||||
public synchronized Class<?> loadClass(String name, boolean resolve)
|
||||
throws ClassNotFoundException {
|
||||
Class c = findLoadedClass(name);
|
||||
Class<?> c = findLoadedClass(name);
|
||||
if (c != null) {
|
||||
return c;
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class GeneratingClassLoader extends ClassLoader {
|
||||
throw new RuntimeException("Class name not found in template class file");
|
||||
}
|
||||
}
|
||||
return (byte[]) bytecode.clone();
|
||||
return bytecode.clone();
|
||||
}
|
||||
|
||||
private void readByteCode() throws ClassNotFoundException {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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
|
||||
@ -202,7 +202,7 @@ public class GeneratingCompilingClassLoader extends ClassLoader {
|
||||
*/
|
||||
public Class<?>[] getGeneratedClasses(int sizeFactor, int numClasses) throws IOException {
|
||||
GeneratedClass[] gc = getGeneratedClass(sizeFactor, numClasses);
|
||||
Class<?>[] classes = new Class[numClasses];
|
||||
Class<?>[] classes = new Class<?>[numClasses];
|
||||
for (int i = 0; i < numClasses; ++i) {
|
||||
classes[i] = defineClass(gc[i].name, gc[i].bytes, 0 , gc[i].bytes.length);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -107,7 +107,7 @@ public class ArrayDiff<E> implements Diff {
|
||||
* @throws NullPointerException if at least one of the arrays is null
|
||||
* @return an ArrayDiff instance for the two arrays and formatting parameters provided
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static ArrayDiff<?> of(Object first, Object second, int width, int contextBefore) {
|
||||
Objects.requireNonNull(first);
|
||||
Objects.requireNonNull(second);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -35,12 +35,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import jdk.test.lib.hprof.util.Misc;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents an object that's allocated out of the Java heap. It occupies
|
||||
* memory in the VM, and is the sort of thing that in a JDK 1.1 VM had
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -30,11 +30,6 @@
|
||||
|
||||
package jdk.test.lib.hprof.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the value of a static field of a JavaClass
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -30,12 +30,6 @@
|
||||
|
||||
package jdk.test.lib.hprof.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a java "Thing". A thing is anything that can be the value of
|
||||
* a field. This includes JavaHeapObject, JavaObjectRef, and JavaValue.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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,12 +32,6 @@ package jdk.test.lib.hprof.model;
|
||||
|
||||
import jdk.test.lib.hprof.util.Misc;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a member of the rootset, that is, one of the objects that
|
||||
* the GC starts from when marking reachable objects.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -30,17 +30,13 @@
|
||||
|
||||
package jdk.test.lib.hprof.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.*;
|
||||
|
||||
import jdk.test.lib.hprof.parser.ReadBuffer;
|
||||
import jdk.test.lib.hprof.util.Misc;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a snapshot of the Java objects in the VM at one instant.
|
||||
* This is the top-level "model" object read out of a single .hprof or .bod
|
||||
@ -637,7 +633,7 @@ public class Snapshot implements AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() throws IOException {
|
||||
readBuf.close();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -30,12 +30,6 @@
|
||||
|
||||
package jdk.test.lib.hprof.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a stack frame.
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -30,12 +30,6 @@
|
||||
|
||||
package jdk.test.lib.hprof.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bill Foote
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Represents a stack trace, that is, an ordered collection of stack frames.
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -86,7 +86,7 @@ class FileReadBuffer implements ReadBuffer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() throws IOException {
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -127,7 +127,7 @@ class MappedReadBuffer implements ReadBuffer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() throws IOException {
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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
|
||||
@ -43,4 +43,5 @@ public interface ReadBuffer extends AutoCloseable {
|
||||
public short getShort(long pos) throws IOException;
|
||||
public int getInt(long pos) throws IOException;
|
||||
public long getLong(long pos) throws IOException;
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, 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,6 +63,7 @@ public abstract class Reader {
|
||||
* @param heapFile The name of a file containing a heap dump
|
||||
* @param callStack If true, read the call stack of allocaation sites
|
||||
*/
|
||||
@SuppressWarnings("try")
|
||||
public static Snapshot readFile(String heapFile, boolean callStack,
|
||||
int debugLevel)
|
||||
throws IOException {
|
||||
@ -136,6 +137,7 @@ public abstract class Reader {
|
||||
*
|
||||
* @param heapFile The name of a file containing a heap dump
|
||||
*/
|
||||
@SuppressWarnings("try")
|
||||
public static String getStack(String heapFile, int debugLevel)
|
||||
throws IOException {
|
||||
int dumpNumber = 1;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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
|
||||
@ -233,7 +233,7 @@ public class Events {
|
||||
|
||||
private static void assertThread(RecordedThread eventThread, Thread thread) {
|
||||
assertNotNull(eventThread, "Thread in event was null");
|
||||
assertEquals(eventThread.getJavaThreadId(), thread.getId(), "Wrong thread id");
|
||||
assertEquals(eventThread.getJavaThreadId(), thread.threadId(), "Wrong thread id");
|
||||
assertEquals(eventThread.getJavaName(), thread.getName(), "Wrong thread name");
|
||||
|
||||
ThreadGroup threadGroup = thread.getThreadGroup();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2025, 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
|
||||
@ -23,6 +23,8 @@
|
||||
|
||||
package jdk.test.lib.jvmti;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* Base class for debuggee class in JVMTI tests.
|
||||
*
|
||||
@ -49,6 +51,7 @@ public class DebugeeClass {
|
||||
/**
|
||||
* This method is used to load library with native methods implementation, if needed.
|
||||
*/
|
||||
@SuppressWarnings("restricted")
|
||||
public static void loadLibrary(String name) {
|
||||
try {
|
||||
System.loadLibrary(name);
|
||||
@ -70,6 +73,9 @@ public class DebugeeClass {
|
||||
}
|
||||
|
||||
public class Failure extends RuntimeException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4069390356498980839L;
|
||||
|
||||
public Failure() {
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, 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 final class ThreadMXBeanTool {
|
||||
+ Integer.toHexString(System.identityHashCode(object));
|
||||
ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
|
||||
while (thread.isAlive()) {
|
||||
ThreadInfo ti = tmx.getThreadInfo(thread.getId());
|
||||
ThreadInfo ti = tmx.getThreadInfo(thread.threadId());
|
||||
if (ti.getThreadState() == state
|
||||
&& (want == null || want.equals(ti.getLockName()))) {
|
||||
return;
|
||||
@ -60,7 +60,7 @@ public final class ThreadMXBeanTool {
|
||||
public static void waitUntilInNative(Thread thread) throws InterruptedException {
|
||||
ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
|
||||
while (thread.isAlive()) {
|
||||
ThreadInfo ti = tmx.getThreadInfo(thread.getId());
|
||||
ThreadInfo ti = tmx.getThreadInfo(thread.threadId());
|
||||
if (ti.isInNative()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2025, 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
|
||||
@ -60,6 +60,7 @@ public class IPSupport {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("try")
|
||||
private static boolean isSupported(Class<? extends InetAddress> addressType) {
|
||||
ProtocolFamily family = addressType == Inet4Address.class ?
|
||||
StandardProtocolFamily.INET : StandardProtocolFamily.INET6;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2024, Red Hat Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -160,7 +160,6 @@ public class HugePageConfiguration {
|
||||
while (scanner.hasNextLine()) {
|
||||
Matcher mat = pat.matcher(scanner.nextLine());
|
||||
if (mat.matches()) {
|
||||
scanner.close();
|
||||
return Long.parseLong(mat.group(1)) * 1024;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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
|
||||
@ -981,7 +981,7 @@ public final class ProcessTools {
|
||||
String[] classArgs = new String[args.length - 2];
|
||||
System.arraycopy(args, 2, classArgs, 0, args.length - 2);
|
||||
Class<?> c = Class.forName(className);
|
||||
Method mainMethod = c.getMethod("main", new Class[] { String[].class });
|
||||
Method mainMethod = c.getMethod("main", new Class<?>[] { String[].class });
|
||||
mainMethod.setAccessible(true);
|
||||
|
||||
if (testThreadFactoryName.equals("Virtual")) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, 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
|
||||
@ -114,7 +114,9 @@ public class VThreadPinner {
|
||||
throw e;
|
||||
if (ex instanceof Error e)
|
||||
throw e;
|
||||
throw (X) ex;
|
||||
@SuppressWarnings("unchecked")
|
||||
var x = (X) ex;
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2025, 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
|
||||
@ -94,7 +94,9 @@ public class VThreadRunner {
|
||||
throw e;
|
||||
if (ex instanceof Error e)
|
||||
throw e;
|
||||
throw (X) ex;
|
||||
@SuppressWarnings("unchecked")
|
||||
var x = (X) ex;
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2025, 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
|
||||
@ -266,7 +266,7 @@ public final class FileUtils {
|
||||
(new InputStreamReader(proc.getInputStream()));
|
||||
// Skip the first line as it is the "df" output header.
|
||||
if (reader.readLine() != null ) {
|
||||
Set mountPoints = new HashSet();
|
||||
Set<String> mountPoints = new HashSet<>();
|
||||
String mountPoint = null;
|
||||
while ((mountPoint = reader.readLine()) != null) {
|
||||
if (!mountPoints.add(mountPoint)) {
|
||||
@ -299,8 +299,8 @@ public final class FileUtils {
|
||||
};
|
||||
});
|
||||
|
||||
final AtomicReference throwableReference =
|
||||
new AtomicReference<Throwable>();
|
||||
final AtomicReference<Throwable> throwableReference =
|
||||
new AtomicReference<>();
|
||||
thr.setUncaughtExceptionHandler(
|
||||
new Thread.UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
@ -315,7 +315,7 @@ public final class FileUtils {
|
||||
throw new RuntimeException(ie);
|
||||
}
|
||||
|
||||
Throwable uncaughtException = (Throwable)throwableReference.get();
|
||||
Throwable uncaughtException = throwableReference.get();
|
||||
if (uncaughtException != null) {
|
||||
throw new RuntimeException(uncaughtException);
|
||||
}
|
||||
@ -365,6 +365,7 @@ public final class FileUtils {
|
||||
}
|
||||
|
||||
// Return the current process handle count
|
||||
@SuppressWarnings("restricted")
|
||||
public static long getProcessHandleCount() {
|
||||
if (IS_WINDOWS) {
|
||||
if (!nativeLibLoaded) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user