From 1ead7a7fdeb6ddbbe3ad0896b7d492929ef9b7a3 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Wed, 29 May 2024 08:41:36 +0000 Subject: [PATCH 001/329] 8331265: Bump update version for OpenJDK: jdk-17.0.13 Reviewed-by: mdoerr, sgehwolf --- .jcheck/conf | 2 +- make/conf/version-numbers.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.jcheck/conf b/.jcheck/conf index c39a4fe49e6..e8b8223875e 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk-updates jbs=JDK -version=17.0.12 +version=17.0.13 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists diff --git a/make/conf/version-numbers.conf b/make/conf/version-numbers.conf index 37266259ef2..9b91536f591 100644 --- a/make/conf/version-numbers.conf +++ b/make/conf/version-numbers.conf @@ -28,12 +28,12 @@ DEFAULT_VERSION_FEATURE=17 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=12 +DEFAULT_VERSION_UPDATE=13 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2024-07-16 +DEFAULT_VERSION_DATE=2024-10-15 DEFAULT_VERSION_CLASSFILE_MAJOR=61 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_VERSION_DOCS_API_SINCE=11 From cc3f0e52bfee9d96c464ae55999e834717aa3772 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 29 May 2024 10:25:39 +0000 Subject: [PATCH 002/329] 8308144: Uncontrolled memory consumption in SSLFlowDelegate.Reader Backport-of: 099a8f5b2f924fddd43ff72f3f7c6f34b6c15b0f --- .../net/http/common/SSLFlowDelegate.java | 54 +- .../whitebox/SSLFlowDelegateTestDriver.java | 33 + .../net/http/SSLFlowDelegateTest.java | 595 ++++++++++++++++++ 3 files changed, 662 insertions(+), 20 deletions(-) create mode 100644 test/jdk/java/net/httpclient/whitebox/SSLFlowDelegateTestDriver.java create mode 100644 test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLFlowDelegateTest.java diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java index 3f3e4ff339a..aefae6507dc 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java @@ -53,17 +53,27 @@ import java.util.function.IntBinaryOperator; /** - * Implements SSL using two SubscriberWrappers. + * Implements SSL using two {@link SubscriberWrapper}s. * - *

Constructor takes two Flow.Subscribers: one that receives the network - * data (after it has been encrypted by SSLFlowDelegate) data, and one that - * receives the application data (before it has been encrypted by SSLFlowDelegate). + *

Constructor takes two {@linkplain Flow.Subscriber subscribers} - {@code downReader} + * and {@code downWriter}. {@code downReader} receives the application data (after it has + * been decrypted by SSLFlowDelegate). {@code downWriter} receives the network data (after it has + * been encrypted by SSLFlowDelegate). * - *

Methods upstreamReader() and upstreamWriter() return the corresponding - * Flow.Subscribers containing Flows for the encrypted/decrypted upstream data. - * See diagram below. + *

Method {@link #upstreamWriter()} returns a {@linkplain Subscriber subscriber} which should + * be subscribed with a {@linkplain Flow.Publisher publisher} which publishes application data + * that can then be encrypted into network data by this SSLFlowDelegate and handed off to the + * {@code downWriter}. * - *

How Flow.Subscribers are used in this class, and where they come from: + *

Method {@link #upstreamReader()} returns a {@link Subscriber subscriber} which should be + * subscribed with a {@linkplain Flow.Publisher publisher} which publishes encrypted network data + * that can then be decrypted into application data by this SSLFlowDelegate and handed off to the + * {@code downReader}. + * + *

Errors are reported to the {@code downReader} subscriber. + * + *

The diagram below illustrates how the Flow.Subscribers are used in this class, and where + * they come from: *

  * {@code
  *
@@ -72,17 +82,21 @@
  * --------->  data flow direction
  *
  *
- *                         +------------------+
- *        upstreamWriter   |                  | downWriter
- *        ---------------> |                  | ------------>
- *  obtained from this     |                  | supplied to constructor
- *                         | SSLFlowDelegate  |
- *        downReader       |                  | upstreamReader
- *        <--------------- |                  | <--------------
- * supplied to constructor |                  | obtained from this
- *                         +------------------+
- *
- * Errors are reported to the downReader Flow.Subscriber
+ *                  |                                   ^
+ *  upstreamWriter  |                                   | downReader
+ *  obtained from   |                                   | supplied to
+ * upstreamWriter() |                                   | constructor
+ *                  v                                   |
+ *      +-----------------------------------------------------------+
+ *      *                                            decrypts       *
+ *      *                       SSLFlowDelegate                     *
+ *      *        encrypts                                           *
+ *      +-----------------------------------------------------------+
+ *                  |                                   ^
+ *    downWriter    |                                   | upstreamReader
+ *    supplied to   |                                   | obtained from
+ *    constructor   |                                   | upstreamReader()
+ *                  v                                   |
  *
  * }
  * 
@@ -467,7 +481,7 @@ else if (this.completing) { } } // request more data and return. - requestMore(); + requestMoreDataIfNeeded(); return; } if (complete && result.status() == Status.CLOSED) { diff --git a/test/jdk/java/net/httpclient/whitebox/SSLFlowDelegateTestDriver.java b/test/jdk/java/net/httpclient/whitebox/SSLFlowDelegateTestDriver.java new file mode 100644 index 00000000000..083a291751f --- /dev/null +++ b/test/jdk/java/net/httpclient/whitebox/SSLFlowDelegateTestDriver.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8308144 + * @summary tests that the SSLFlowDelegate doesn't accumulate application data when the + * downReader doesn't request any + * @modules java.net.http/jdk.internal.net.http + * @run testng/othervm -Djdk.internal.httpclient.debug=true + * -Djavax.net.debug=ssl:handshake + * java.net.http/jdk.internal.net.http.SSLFlowDelegateTest + */ diff --git a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLFlowDelegateTest.java b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLFlowDelegateTest.java new file mode 100644 index 00000000000..45af27a96a8 --- /dev/null +++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLFlowDelegateTest.java @@ -0,0 +1,595 @@ +/* + * Copyright (c) 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.net.http; + +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Flow; +import java.util.concurrent.Flow.Subscriber; +import java.util.concurrent.SubmissionPublisher; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLServerSocketFactory; + +import jdk.internal.net.http.common.Logger; +import jdk.internal.net.http.common.SSLFlowDelegate; +import jdk.internal.net.http.common.SubscriberWrapper; +import jdk.internal.net.http.common.Utils; +import org.testng.Assert; +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +// jtreg test definition for this test resides in SSLFlowDelegateTestDriver.java +public class SSLFlowDelegateTest { + private static final String ALPN = "foobar"; + private static final String debugTag = SSLFlowDelegateTest.class.getSimpleName(); + private static final Random random = new Random(); + private static final byte DATA_BYTE = (byte) random.nextInt(); + + private ExecutorService executor; + private SSLContext sslContext; + private SSLParameters sslParams; + private SSLServerSocket sslServerSocket; + private SSLEngine clientEngine; + private CompletableFuture testCompletion; + + @BeforeTest + public void beforeTest() throws Exception { + this.executor = Executors.newCachedThreadPool(); + this.sslContext = new jdk.internal.net.http.SimpleSSLContext().get(); + this.testCompletion = new CompletableFuture<>(); + + final SSLParameters sp = new SSLParameters(); + sp.setApplicationProtocols(new String[]{ALPN}); + this.sslParams = sp; + + this.sslServerSocket = startServer(this.sslContext); + println(debugTag, "Server started at " + this.sslServerSocket.getInetAddress() + ":" + + this.sslServerSocket.getLocalPort()); + + this.clientEngine = createClientEngine(this.sslContext); + } + + @AfterTest + public void afterTest() throws Exception { + if (this.sslServerSocket != null) { + println(debugTag, "Closing server socket " + this.sslServerSocket); + this.sslServerSocket.close(); + } + if (this.executor != null) { + println(debugTag, "Shutting down the executor " + this.executor); + this.executor.shutdownNow(); + } + } + + private static void println(final String debugTag, final String msg) { + println(debugTag, msg, null); + } + + private static void println(final String debugTag, final String msg, final Throwable t) { + final Logger logger = Utils.getDebugLogger(() -> debugTag); + logger.log(msg); + if (t != null) { + t.printStackTrace(); + } + } + + private SSLServerSocket createSSLServerSocket( + final SSLContext ctx, final InetSocketAddress bindAddr) throws IOException { + final SSLServerSocketFactory fac = ctx.getServerSocketFactory(); + final SSLServerSocket sslServerSocket = (SSLServerSocket) fac.createServerSocket(); + sslServerSocket.setReuseAddress(false); + sslServerSocket.setSSLParameters(this.sslParams); + sslServerSocket.bind(bindAddr); + return sslServerSocket; + } + + private SSLServerSocket startServer(final SSLContext ctx) throws Exception { + final SSLServerSocket sslServerSocket = createSSLServerSocket(ctx, + new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); + final Runnable serverResponsePusher = new ServerResponsePusher(sslServerSocket, + this.testCompletion); + final Thread serverThread = new Thread(serverResponsePusher, "serverResponsePusher"); + // start the thread which will accept() a socket connection and send data over it + serverThread.start(); + return sslServerSocket; + } + + private SSLEngine createClientEngine(final SSLContext ctx) { + final SSLEngine clientEngine = ctx.createSSLEngine(); + clientEngine.setSSLParameters(this.sslParams); + clientEngine.setUseClientMode(true); + return clientEngine; + } + + /** + * Constructs a {@code SSLFlowDelegate} with a {@code downReader} which only requests one + * item and then never requests any more. After that one item has been received by the + * {@code downReader}, this test feeds the + * {@linkplain SSLFlowDelegate#upstreamReader() upstreamReader} with (network SSL) data in + * such a manner that while + * {@link SSLEngine#unwrap(ByteBuffer, ByteBuffer) unwrapping} it in the internal implementation + * of {@code SSLFlowDelegate}, it will often trigger {@code BUFFER_UNDERFLOW} state. + * This test then verifies that the {@code SSLFlowDelegate} when it reaches such a state will + * not keep asking for more (network SSL) data and decrypting it to application data and + * accumulating it (since the {@code downReader} won't be using any of this accumulated data). + */ + @Test + public void testUnsolicitedBytes() throws Exception { + // initiate a connection to the server + try (final Socket socket = new Socket(sslServerSocket.getInetAddress(), + sslServerSocket.getLocalPort())) { + println(debugTag, "connected to server, local socket: " + socket); + // this future is completed when the AppResponseReceiver subscriber receives + // the sole item that is requests for (through just one subscription.request(1)) + final CompletableFuture soleExpectedAppData = new CompletableFuture<>(); + // the "testCompletion" CompletableFuture represents that future that's used + // in various places in this test. If the "testCompletion" completes before + // the "soleExpectedAppData" completes (typically due to some exception), + // then we complete the "soleExpectedAppData" too. + this.testCompletion.whenComplete((r, t) -> { + if (soleExpectedAppData.isDone()) { + return; + } + if (t == null) { + soleExpectedAppData.complete(-1L); // -1 indicates no item received + return; + } + soleExpectedAppData.completeExceptionally(t); + }); + // the "downReader" Subscriber which is passed to the constructor of SSLFlowDelegate. + // This subscriber receives the (decrypted) application data. This subscriber requests + // only one item (no restriction on how many bytes are received in this one item). + final AppResponseReceiver appResponseReceiver = new AppResponseReceiver( + this.testCompletion, soleExpectedAppData); + // the "downWriter" Subscriber which is passed to the constructor of the + // SSLFlowDelegate. + // This subscriber receives the (encrypted) network data and just writes it out to the + // connected socket's OutputStream. Makes no restrictions on how much items (and thus + // bytes) it receives and just keeps writing as and when it receives the data. + final SocketWriter networkDataWriter = new SocketWriter(socket, this.testCompletion); + // construct the SSLFlowDelegate + final SSLFlowDelegate sslFlowDelegate = new SSLFlowDelegate(clientEngine, executor, + appResponseReceiver, networkDataWriter); + // the SocketReader runs in a thread and it keeps reading data from the connected + // socket's InputStream. This data keeps coming from the ServerResponsePusher which too + // is running in a thread of its own and is writing it out over the connected socket's + // OutputStream. The SocketReader and ServerResponsePusher are convenience constructs + // which use the simple APIs (InputStream/OutputStream) provided by SSLServerSocket + // and (SSL)Socket to generate SSL network data. This generated data is then fed to + // the relevant subscribers of SSLFlowDelegate. The SocketReader and the + // ServerResponsePusher play no other role than just generating this SSL network data. + final SocketReader socketReader = new SocketReader(socket, executor, + sslFlowDelegate.upstreamReader(), this.testCompletion); + // start reading from the socket in separate thread + new Thread(socketReader, "socketReader").start(); + + // we use this publisher only to trigger the SSL handshake and the publisher itself + // doesn't publish any data i.e. there is no application client "request" data needed + // in this test + final Flow.Publisher> publisher = new ZeroDataPublisher<>(); + println(debugTag, "Subscribing the upstreamWriter() to trigger SSL handshake"); + // now connect all the pieces. + // this call to subscribe the upstreamWriter() triggers the SSL handshake (doesn't + // matter if our zero app data publisher publishes no app data; SSL handshake + // doesn't require app data). see SSLFlowDelegate$Writer.onSubscribe() where + // it triggers the SSL handshake when this subscription happens + publisher.subscribe(sslFlowDelegate.upstreamWriter()); + println(debugTag, "Waiting for handshake to complete"); + final String negotiatedALPN = sslFlowDelegate.alpn().join(); + println(debugTag, "handshake completed, with negotiated ALPN: " + negotiatedALPN); + Assert.assertEquals(negotiatedALPN, ALPN, "unexpected ALPN negotiated"); + try { + // now wait for the initial (and the only) chunk of application data to be + // received by the AppResponseReceiver + println(debugTag, "waiting for the sole expected chunk of application data to" + + " become available to " + appResponseReceiver); + final long numAppDataBytesReceived = soleExpectedAppData.join(); + println(debugTag, "Received " + numAppDataBytesReceived + " app data bytes," + + " no more app data expected"); + // at this point, we have received the only expected item in the downReader + // i.e. the AppResponseReceiver. We no longer expect the SSLFlowDelegate to be + // accumulating any decrypted application data (because the downReader hasn't + // requested any). + // We will now let the SocketReader and the ServerResponsePusher threads to keep + // generating and feeding the SSL network data to the SSLFlowDelegate subscribers, + // until they are "done" (either normally or exceptionally). Those threads decide + // when to stop generating the SSL network data. + this.testCompletion.join(); + } catch (CompletionException ce) { + // fail with a Assert.fail instead of throwing an exception, thus providing a + // better failure report + failTest(ce); + } + println(debugTag, "now checking if any unsolicited bytes accumulated"); + // SSL network data generation has completed, now check if the SSLFlowDelegate + // decrypted and accumulated any application data when it shouldn't have. + assertNoUnsolicitedBytes(sslFlowDelegate); + println(debugTag, "testing completed successfully, no unsolicited bytes accumulated"); + } + } + + private void failTest(final CompletionException ce) { + final Throwable cause = ce.getCause(); + Assert.fail(cause.getMessage() == null ? "test failed" : cause.getMessage(), cause); + } + + // uses reflection to get hold of the SSLFlowDelegate.reader.outputQ member field, + // which is a ConcurrentLinkedQueue holding the decrypted application data that + // is supposed to be sent to the downReader subscriber of the SSLFlowDelegate. + // Asserts that this outputQ has 0 bytes of data accumulated + private void assertNoUnsolicitedBytes(final SSLFlowDelegate sslFlowDelegate) throws Exception { + final Field readerField = SSLFlowDelegate.class.getDeclaredField("reader"); + readerField.setAccessible(true); + + final Field readerOutputQField = SubscriberWrapper.class.getDeclaredField("outputQ"); + readerOutputQField.setAccessible(true); + + final Object reader = readerField.get(sslFlowDelegate); + final ConcurrentLinkedQueue> outputQ = + ConcurrentLinkedQueue.class.cast(readerOutputQField.get(reader)); + long numUnsolicitated = 0; + List accumulations; + while ((accumulations = outputQ.poll()) != null) { + println(debugTag, "found some items in outputQ"); + for (final ByteBuffer buf : accumulations) { + if (!buf.hasRemaining()) { + continue; + } + try { + numUnsolicitated = Math.addExact(numUnsolicitated, buf.remaining()); + } catch (ArithmeticException ame) { + numUnsolicitated = Long.MAX_VALUE; + break; + } + } + println(debugTag, "num unsolicited bytes so far = " + numUnsolicitated); + } + Assert.assertEquals(numUnsolicitated, 0, + "SSLFlowDelegate has accumulated " + numUnsolicitated + " unsolicited bytes"); + } + + // A publisher which accepts only one subscriber and doesn't ever publish any data + private static final class ZeroDataPublisher implements Flow.Publisher { + private final AtomicBoolean hasSubscriber = new AtomicBoolean(); + + @Override + public void subscribe(final Subscriber subscriber) { + if (!hasSubscriber.compareAndSet(false, true)) { + // we allow only one subscriber + throw new IllegalStateException("Cannot subscribe more than once"); + } + subscriber.onSubscribe(new Flow.Subscription() { + @Override + public void request(long n) { + // no-op, we don't publish any data + } + + @Override + public void cancel() { + // no-op + } + }); + } + } + + // a Subscriber which subscribers for encrypted SSL network data that it will then + // write to a connected (SSL) Socket's OutputStream + private static final class SocketWriter implements Subscriber> { + private static final String debugTag = SocketWriter.class.getSimpleName(); + + private final Socket socket; + private final CompletableFuture completion; + private volatile Flow.Subscription subscription; + private final AtomicLong numBytesWritten = new AtomicLong(); + + private SocketWriter(final Socket socket, final CompletableFuture completion) { + this.socket = socket; + this.completion = completion; + } + + @Override + public void onSubscribe(final Flow.Subscription subscription) { + this.subscription = subscription; + println(debugTag, "onSubscribe invoked, requesting for data to write to socket"); + subscription.request(1); + } + + @Override + public void onNext(final List bufs) { + try { + final OutputStream os = + new BufferedOutputStream(this.socket.getOutputStream()); + + // these buffers contain encrypted SSL network data that we receive + // from the SSLFlowDelegate. We just write them out to the + // Socket's OutputStream. + for (final ByteBuffer buf : bufs) { + int len = buf.remaining(); + int written = writeToStream(os, buf); + assert len == written; + this.numBytesWritten.addAndGet(len); + assert !buf.hasRemaining() + : "buffer has " + buf.remaining() + " bytes left"; + this.subscription.request(1); // willing to write out more data when available + } + } catch (Throwable e) { + println(debugTag, "failed: " + e, e); + completion.completeExceptionally(e); + } + } + + @Override + public void onError(final Throwable throwable) { + println(debugTag, "error: " + throwable, throwable); + completion.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + println(debugTag, "onComplete(), total bytes written: " + this.numBytesWritten.get()); + } + + private int writeToStream(final OutputStream os, final ByteBuffer buf) throws IOException { + final byte[] b = buf.array(); + final int offset = buf.arrayOffset() + buf.position(); + final int n = buf.limit() - buf.position(); + os.write(b, offset, n); + buf.position(buf.limit()); + os.flush(); + return n; + } + } + + // a background task that keeps reading encrypted SSL network data from a connected + // (SSL) Socket and publishes this data to the SSLFlowDelegate's upstreamReader() subscriber. + // Very importantly, irrespective of how many bytes of data this SocketReader reads + // of the Socket's InputStream in one read() operation, it publishes this data to the + // upstreamReader() subscriber in very small chunks, so that when the upstreamReader() + // subscriber receives it and starts unwrapping that SSL network data, it often + // encounters a BUFFER_UNDERFLOW state. + private static final class SocketReader implements Runnable { + private static final String debugTag = SocketReader.class.getSimpleName(); + + // the size of data that will be published to the upstreamReader() subscriber. + // small enough; no other meaning to this value + private static final int VERY_SMALL_DATA_SIZE = 123; + + private final Socket socket; + private final SubmissionPublisher> publisher; + private final CompletableFuture completion; + + private SocketReader(final Socket socket, final Executor executor, + final Subscriber> incomingNetworkDataSubscriber, + final CompletableFuture completion) { + this.socket = socket; + this.completion = completion; + this.publisher = new SubmissionPublisher<>(executor, Flow.defaultBufferSize(), + (s, t) -> completion.completeExceptionally(t)); + this.publisher.subscribe(incomingNetworkDataSubscriber); + } + + @Override + public void run() { + try { + // reads off the SSLSocket the data from the "server" + final InputStream is = socket.getInputStream(); + long numBytesRead = 0; + long numBytesPublished = 0; + while (true) { + final byte[] buf = new byte[10240]; // this size doesn't matter + final int n = is.read(buf); + if (n == -1) { + println(debugTag, "got EOF, now closing resources; total read " + + numBytesRead + " bytes, total published " + numBytesPublished + + " bytes"); + closeAndComplete(is); + return; + } + println(debugTag, "read " + n + " bytes from socket"); + numBytesRead = Math.addExact(numBytesRead, n); + int remaining = n; + int index = 0; + while (remaining > 0) { + final int chunkSize = Math.min(remaining, VERY_SMALL_DATA_SIZE); + final byte[] chunk = Arrays.copyOfRange(buf, index, index + chunkSize); + index += chunkSize; + remaining -= chunkSize; + final int lagOrDrops = publisher.offer( + List.of(ByteBuffer.wrap(chunk)), 2, TimeUnit.SECONDS, null); + if (lagOrDrops < 0) { + println(debugTag, "dropped a chunk, re-offering"); + // dropped, we now re-attempt once more and if that too is dropped, + // we stop + final int newLagOrDrops = publisher.offer( + List.of(ByteBuffer.wrap(chunk)), 2, TimeUnit.SECONDS, null); + if (newLagOrDrops < 0) { + println(debugTag, "dropped the re-offered chunk; closing resources," + + " total bytes read: " + numBytesRead + + " total bytes published: " + numBytesPublished); + closeAndComplete(is); + return; + } + } + numBytesPublished += chunkSize; + println(debugTag, "published " + numBytesPublished + " bytes of total " + + numBytesRead + " bytes read"); + } + } + } catch (Throwable e) { + println(debugTag, "failed: " + e, e); + completion.completeExceptionally(e); + } + } + + private void closeAndComplete(final InputStream is) { + publisher.close(); + completion.complete(null); + Utils.close(is); + } + } + + // a background task which accepts one socket connection on a SSLServerSocket and keeps + // writing (application) data to the OutputStream of that socket. + private static final class ServerResponsePusher implements Runnable { + private static final String debugTag = ServerResponsePusher.class.getSimpleName(); + private final SSLServerSocket sslServerSocket; + private final CompletableFuture completion; + + private ServerResponsePusher(final SSLServerSocket sslServerSocket, + final CompletableFuture completion) { + this.sslServerSocket = sslServerSocket; + this.completion = completion; + } + + @Override + public void run() { + try { + // accept a connection + try (final Socket socket = this.sslServerSocket.accept()) { + println(debugTag, "Accepted connection from " + socket); + try (final OutputStream os = socket.getOutputStream()) { + final byte[] resp = new byte[10240]; // this size doesn't matter + Arrays.fill(resp, DATA_BYTE); + long numWritten = 0; + // reasonable number of times to generate enough network data + final int numTimes = 50; + for (int i = 0; i < numTimes; i++) { + println(debugTag, "writing " + resp.length + " bytes, " + + numWritten + " written so far"); + os.write(resp); + numWritten += resp.length; + os.flush(); + } + println(debugTag, "stopped writing, total bytes written: " + numWritten); + } + } + } catch (Throwable e) { + println(debugTag, "error: " + e, e); + this.completion.completeExceptionally(e); + } + } + } + + // the "downReader" Subscriber which is passed to the constructor of SSLFlowDelegate. + // This subscriber receives the (decrypted) application data. This subscriber requests + // only one item (no restriction on how many bytes are received in this one item). + private static final class AppResponseReceiver implements Subscriber> { + private static final String debugTag = AppResponseReceiver.class.getSimpleName(); + + private final byte[] expectedData = new byte[1024]; // no significance of the size + + private final AtomicLong numBytesReceived; + private volatile Flow.Subscription subscription; + private final CompletableFuture completion; + private final CompletableFuture soleExpectedAppData; + private boolean receivedOneItem; + + private AppResponseReceiver(final CompletableFuture completion, + final CompletableFuture soleExpectedAppData) { + this.numBytesReceived = new AtomicLong(0); + this.soleExpectedAppData = soleExpectedAppData; + this.completion = completion; + Arrays.fill(expectedData, DATA_BYTE); + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + println(debugTag, "onSubscribe invoked"); + this.subscription = subscription; + subscription.request(1); // the sole item request this subscriber will make + } + + @Override + public void onNext(final List buffers) { + if (receivedOneItem) { + // don't throw an exception since that will go against the Subscriber's + // specification, instead complete the future exceptionally + completion.completeExceptionally(new AssertionError("onNext() called more than" + + " once, even though no request was made")); + return; + } + receivedOneItem = true; + // these buffers contain (decrypted) application data that the SSLFlowDelegate has + // forwarded to this subscriber + for (final ByteBuffer buf : buffers) { + final int numBytes = buf.remaining(); + // verify the content of the received application data + while (buf.hasRemaining()) { + final int size = Math.min(buf.remaining(), expectedData.length); + final byte[] actual = new byte[size]; + buf.get(actual); + // this is just convenience/performance optimization - instead of checking + // one byte at a time, we compare multiple bytes + final int index = Arrays.mismatch(expectedData, 0, size, actual, 0, size); + if (index != -1) { + final String errMsg = "Unexpected byte received: " + actual[index]; + println(debugTag, "Cancelling subscription due to error: " + errMsg); + subscription.cancel(); + completion.completeExceptionally(new AssertionError(errMsg)); + return; + } + } + numBytesReceived.addAndGet(numBytes); + } + println(debugTag, "Received " + numBytesReceived.get() + " bytes," + + " will not request any more data"); + soleExpectedAppData.complete(numBytesReceived.get()); + } + + @Override + public void onError(final Throwable throwable) { + completion.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + final long n = numBytesReceived.get(); + println(debugTag, "Completed: received " + n + " bytes"); + } + } +} From 24aa1e1f1835c83cbf5cfeda56186511a3bd0100 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 29 May 2024 10:27:18 +0000 Subject: [PATCH 003/329] 8313873: java/nio/channels/DatagramChannel/SendReceiveMaxSize.java fails on AIX due to small default RCVBUF size and different IPv6 Header interpretation Backport-of: 486fa08d4b22243443d39efa34c78d7e9eb44775 --- .../DatagramChannel/SendReceiveMaxSize.java | 17 +++++++------ test/lib/jdk/test/lib/net/IPSupport.java | 25 +++++++++++++++++-- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/test/jdk/java/nio/channels/DatagramChannel/SendReceiveMaxSize.java b/test/jdk/java/nio/channels/DatagramChannel/SendReceiveMaxSize.java index 6f20df76deb..83854fe4a42 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/SendReceiveMaxSize.java +++ b/test/jdk/java/nio/channels/DatagramChannel/SendReceiveMaxSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -57,6 +57,7 @@ import static java.net.StandardProtocolFamily.INET; import static java.net.StandardProtocolFamily.INET6; import static java.net.StandardSocketOptions.SO_SNDBUF; +import static java.net.StandardSocketOptions.SO_RCVBUF; import static jdk.test.lib.net.IPSupport.hasIPv4; import static jdk.test.lib.net.IPSupport.hasIPv6; import static jdk.test.lib.net.IPSupport.preferIPv4Stack; @@ -65,8 +66,6 @@ import static org.testng.Assert.assertTrue; public class SendReceiveMaxSize { - private final static int IPV4_SNDBUF = 65507; - private final static int IPV6_SNDBUF = 65527; private final static Class IOE = IOException.class; private final static Random random = RandomFactory.getRandom(); @@ -91,12 +90,12 @@ public Object[][] invariants() throws IOException { .orElse((Inet4Address) InetAddress.getByName("127.0.0.1")); testcases.add(new Object[]{ supplier(() -> DatagramChannel.open()), - IPV4_SNDBUF, + IPSupport.getMaxUDPSendBufSizeIPv4(), IPv4Addr }); testcases.add(new Object[]{ supplier(() -> DatagramChannel.open(INET)), - IPV4_SNDBUF, + IPSupport.getMaxUDPSendBufSizeIPv4(), IPv4Addr }); } @@ -107,12 +106,12 @@ public Object[][] invariants() throws IOException { .orElse((Inet6Address) InetAddress.getByName("::1")); testcases.add(new Object[]{ supplier(() -> DatagramChannel.open()), - IPV6_SNDBUF, + IPSupport.getMaxUDPSendBufSizeIPv6(), IPv6Addr }); testcases.add(new Object[]{ supplier(() -> DatagramChannel.open(INET6)), - IPV6_SNDBUF, + IPSupport.getMaxUDPSendBufSizeIPv6(), IPv6Addr }); } @@ -134,6 +133,10 @@ public void testSendReceiveMaxSize(DatagramChannelSupplier supplier, int capacit throws IOException { try (var receiver = DatagramChannel.open()) { receiver.bind(new InetSocketAddress(host, 0)); + assertTrue(receiver.getOption(SO_RCVBUF) >= capacity, + receiver.getOption(SO_RCVBUF) + + " for UDP receive buffer too small to hold capacity " + + capacity); var port = receiver.socket().getLocalPort(); var addr = new InetSocketAddress(host, port); diff --git a/test/lib/jdk/test/lib/net/IPSupport.java b/test/lib/jdk/test/lib/net/IPSupport.java index 05f3966dd5e..c9873fa644a 100644 --- a/test/lib/jdk/test/lib/net/IPSupport.java +++ b/test/lib/jdk/test/lib/net/IPSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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.net; +import jdk.test.lib.Platform; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; @@ -47,6 +49,9 @@ public class IPSupport { private static final boolean hasIPv6; private static final boolean preferIPv4Stack; private static final boolean preferIPv6Addresses; + private static final int IPV4_SNDBUF = 65507; + private static final int IPV6_SNDBUF = 65527; + private static final int IPV6_SNDBUF_AIX = 65487; static { try { @@ -121,7 +126,6 @@ public static final boolean preferIPv6Addresses() { return preferIPv6Addresses; } - /** * Whether or not the current networking configuration is valid or not. * @@ -164,4 +168,21 @@ public static void printPlatformSupport(PrintStream out) { out.println("preferIPv6Addresses: " + preferIPv6Addresses()); } + /** + * Return current platform's maximum size for IPv4 UDP send buffer + */ + public static final int getMaxUDPSendBufSizeIPv4() { + return IPV4_SNDBUF; + } + + /** + * Return current platform's maximum size for IPv6 UDP send buffer + */ + public static final int getMaxUDPSendBufSizeIPv6() { + if (Platform.isAix()) { + return IPV6_SNDBUF_AIX; + } else { + return IPV6_SNDBUF; + } + } } From 787cf27a8bb19c58bfa5bd17bf433ddaa99117d7 Mon Sep 17 00:00:00 2001 From: Rinku Kumar Maurya Date: Wed, 29 May 2024 10:28:30 +0000 Subject: [PATCH 004/329] 8265919: RunThese30M fails "assert((!(((((JfrTraceIdBits::load(value)) & ((1 << 4) << 8)) != 0))))) failed: invariant" Backport-of: ffa34ed429079827c9b0acb843288fde4b7fa53d --- src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index 78d6ab48f97..c3c47d3dd72 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -429,8 +429,6 @@ static void do_previous_epoch_artifact(JfrArtifactClosure* callback, T* value) { assert(value != NULL, "invariant"); if (USED_PREVIOUS_EPOCH(value)) { callback->do_artifact(value); - assert(IS_NOT_SERIALIZED(value), "invariant"); - return; } if (IS_SERIALIZED(value)) { CLEAR_SERIALIZED(value); From 2d834b36ec68890befc21d93b667d07cbf3c007a Mon Sep 17 00:00:00 2001 From: Long Yang Date: Wed, 29 May 2024 12:46:14 +0000 Subject: [PATCH 005/329] 8326446: The User and System of jdk.CPULoad on Apple M1 are inaccurate Reviewed-by: phh Backport-of: 8dbd4b391f7deb1a46a5f07f0bc46f23d6715ddb --- src/hotspot/os/bsd/os_perf_bsd.cpp | 62 ++++++++++++++---------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/src/hotspot/os/bsd/os_perf_bsd.cpp b/src/hotspot/os/bsd/os_perf_bsd.cpp index e69bfc79558..546cef8edc5 100644 --- a/src/hotspot/os/bsd/os_perf_bsd.cpp +++ b/src/hotspot/os/bsd/os_perf_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, 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 @@ #include #include #include + #include #endif static const double NANOS_PER_SEC = 1000000000.0; @@ -46,10 +47,10 @@ static const double NANOS_PER_SEC = 1000000000.0; class CPUPerformanceInterface::CPUPerformance : public CHeapObj { friend class CPUPerformanceInterface; private: - long _total_cpu_nanos; + uint64_t _jvm_real; long _total_csr_nanos; - long _jvm_user_nanos; - long _jvm_system_nanos; + uint64_t _jvm_user; + uint64_t _jvm_system; long _jvm_context_switches; long _used_ticks; long _total_ticks; @@ -83,11 +84,11 @@ class CPUPerformanceInterface::CPUPerformance : public CHeapObj { }; CPUPerformanceInterface::CPUPerformance::CPUPerformance() { - _total_cpu_nanos= 0; - _total_csr_nanos= 0; + _jvm_real = 0; + _total_csr_nanos = 0; _jvm_context_switches = 0; - _jvm_user_nanos = 0; - _jvm_system_nanos = 0; + _jvm_user = 0; + _jvm_system = 0; _used_ticks = 0; _total_ticks = 0; _active_processor_count = 0; @@ -148,42 +149,35 @@ int CPUPerformanceInterface::CPUPerformance::cpu_load_total_process(double* cpu_ int CPUPerformanceInterface::CPUPerformance::cpu_loads_process(double* pjvmUserLoad, double* pjvmKernelLoad, double* psystemTotalLoad) { #ifdef __APPLE__ int result = cpu_load_total_process(psystemTotalLoad); - mach_port_t task = mach_task_self(); - mach_msg_type_number_t task_info_count = TASK_INFO_MAX; - task_info_data_t task_info_data; - kern_return_t kr = task_info(task, TASK_ABSOLUTETIME_INFO, (task_info_t)task_info_data, &task_info_count); - if (kr != KERN_SUCCESS) { + + struct tms buf; + clock_t jvm_real = times(&buf); + if (jvm_real == (clock_t) (-1)) { return OS_ERR; } - task_absolutetime_info_t absolutetime_info = (task_absolutetime_info_t)task_info_data; int active_processor_count = os::active_processor_count(); - long jvm_user_nanos = absolutetime_info->total_user; - long jvm_system_nanos = absolutetime_info->total_system; - - long total_cpu_nanos; - if(!now_in_nanos(&total_cpu_nanos)) { - return OS_ERR; - } + uint64_t jvm_user = buf.tms_utime; + uint64_t jvm_system = buf.tms_stime; - if (_total_cpu_nanos == 0 || active_processor_count != _active_processor_count) { - // First call or change in active processor count + if (active_processor_count != _active_processor_count) { + // Change in active processor count result = OS_ERR; - } + } else { + uint64_t delta = active_processor_count * (jvm_real - _jvm_real); + if (delta == 0) { + // Avoid division by zero + return OS_ERR; + } - long delta_nanos = active_processor_count * (total_cpu_nanos - _total_cpu_nanos); - if (delta_nanos == 0) { - // Avoid division by zero - return OS_ERR; + *pjvmUserLoad = normalize((double)(jvm_user - _jvm_user) / delta); + *pjvmKernelLoad = normalize((double)(jvm_system - _jvm_system) / delta); } - *pjvmUserLoad = normalize((double)(jvm_user_nanos - _jvm_user_nanos)/delta_nanos); - *pjvmKernelLoad = normalize((double)(jvm_system_nanos - _jvm_system_nanos)/delta_nanos); - _active_processor_count = active_processor_count; - _total_cpu_nanos = total_cpu_nanos; - _jvm_user_nanos = jvm_user_nanos; - _jvm_system_nanos = jvm_system_nanos; + _jvm_real = jvm_real; + _jvm_user = jvm_user; + _jvm_system = jvm_system; return result; #else From e85eecbea09e68fcac68a39901a58ddf41fa9dbd Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Wed, 29 May 2024 12:46:30 +0000 Subject: [PATCH 006/329] 8288568: Reduce runtime of java.security microbenchmarks Backport-of: a28ab7b62abcfce56425d62d5a8162d8f1623393 --- .../java/security/AlgorithmConstraintsPermits.java | 6 +++++- .../openjdk/bench/java/security/CacheBench.java | 6 +++++- .../bench/java/security/CipherSuiteBench.java | 6 ++++-- .../openjdk/bench/java/security/DoPrivileged.java | 8 +++++++- .../openjdk/bench/java/security/GetContext.java | 8 +++++++- .../bench/java/security/GetMessageDigest.java | 4 ++-- .../bench/java/security/MessageDigests.java | 14 +++++++------- .../bench/java/security/PKCS12KeyStores.java | 8 ++++---- .../bench/java/security/PermissionsImplies.java | 4 ++-- .../openjdk/bench/java/security/SSLHandshake.java | 6 +++--- 10 files changed, 46 insertions(+), 24 deletions(-) diff --git a/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java b/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java index 3cb9567b92b..46e68ea627f 100644 --- a/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java +++ b/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java @@ -25,12 +25,14 @@ import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import sun.security.util.DisabledAlgorithmConstraints; import java.security.AlgorithmConstraints; @@ -43,8 +45,10 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) +@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) @State(Scope.Thread) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) public class AlgorithmConstraintsPermits { AlgorithmConstraints tlsDisabledAlgConstraints; diff --git a/test/micro/org/openjdk/bench/java/security/CacheBench.java b/test/micro/org/openjdk/bench/java/security/CacheBench.java index a7fe33432f7..9b66b2b6337 100644 --- a/test/micro/org/openjdk/bench/java/security/CacheBench.java +++ b/test/micro/org/openjdk/bench/java/security/CacheBench.java @@ -27,6 +27,7 @@ import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Param; @@ -38,11 +39,14 @@ import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; +import org.openjdk.jmh.annotations.Warmup; import sun.security.util.Cache; @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED", "-Xmx1g"}) +@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED", "-Xmx1g"}) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) public class CacheBench { @State(Scope.Benchmark) diff --git a/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java b/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java index 8703e85fef0..e37cec895ca 100644 --- a/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java +++ b/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java @@ -30,10 +30,12 @@ import java.util.concurrent.TimeUnit; -@Fork(jvmArgsAppend = {"--add-exports", "java.base/sun.security.ssl=ALL-UNNAMED", "--add-opens", "java.base/sun.security.ssl=ALL-UNNAMED"}) +@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.ssl=ALL-UNNAMED", "--add-opens", "java.base/sun.security.ssl=ALL-UNNAMED"}) @State(Scope.Benchmark) @OutputTimeUnit(TimeUnit.MICROSECONDS) @BenchmarkMode(Mode.Throughput) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) public class CipherSuiteBench { Method nameOf; @@ -53,6 +55,6 @@ public void initilizeClass() throws ClassNotFoundException, NoSuchMethodExceptio @Benchmark public Object benchmarkCipherSuite() throws InvocationTargetException, IllegalAccessException { - return nameOf.invoke(null,cipherSuite); + return nameOf.invoke(null, cipherSuite); } } diff --git a/test/micro/org/openjdk/bench/java/security/DoPrivileged.java b/test/micro/org/openjdk/bench/java/security/DoPrivileged.java index f8d16082f8b..583da306fa0 100644 --- a/test/micro/org/openjdk/bench/java/security/DoPrivileged.java +++ b/test/micro/org/openjdk/bench/java/security/DoPrivileged.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -24,11 +24,14 @@ import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import java.security.AccessController; import java.security.PrivilegedAction; @@ -40,6 +43,9 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Thread) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) +@Fork(value = 3) public class DoPrivileged { private PrivilegedAction privilegedAction; diff --git a/test/micro/org/openjdk/bench/java/security/GetContext.java b/test/micro/org/openjdk/bench/java/security/GetContext.java index e72813d2811..1e36165d3f0 100644 --- a/test/micro/org/openjdk/bench/java/security/GetContext.java +++ b/test/micro/org/openjdk/bench/java/security/GetContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -26,11 +26,14 @@ import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import java.security.AccessControlContext; import java.security.AccessController; @@ -43,6 +46,9 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Thread) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) +@Fork(value = 3) public abstract class GetContext { public static class Top extends GetContext { diff --git a/test/micro/org/openjdk/bench/java/security/GetMessageDigest.java b/test/micro/org/openjdk/bench/java/security/GetMessageDigest.java index 17434394ba1..5c7b31fa133 100644 --- a/test/micro/org/openjdk/bench/java/security/GetMessageDigest.java +++ b/test/micro/org/openjdk/bench/java/security/GetMessageDigest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -47,7 +47,7 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(iterations = 5, time = 1) -@Measurement(iterations = 10, time = 1) +@Measurement(iterations = 5, time = 1) @Fork(value = 3) public class GetMessageDigest { diff --git a/test/micro/org/openjdk/bench/java/security/MessageDigests.java b/test/micro/org/openjdk/bench/java/security/MessageDigests.java index 2969baaa22e..a3ab483c39c 100644 --- a/test/micro/org/openjdk/bench/java/security/MessageDigests.java +++ b/test/micro/org/openjdk/bench/java/security/MessageDigests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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,18 +45,18 @@ */ @State(Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Warmup(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) -@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) -@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 5) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) +@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) public class MessageDigests { - @Param({"64", "1024", "16384"}) + @Param({"64", "16384"}) private int length; - @Param({"md2", "md5", "SHA-1", "SHA-224", "SHA-256", "SHA-384", "SHA-512", "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512"}) + @Param({"md5", "SHA-1", "SHA-224", "SHA-256", "SHA-384", "SHA-512", "SHA3-256", "SHA3-512"}) private String digesterName; - @Param({"DEFAULT", "SUN"}) + @Param({"DEFAULT"}) protected String provider; private byte[] inputBytes; diff --git a/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java b/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java index 9c8f378fb9b..f68b4503ef5 100644 --- a/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java +++ b/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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,10 +38,10 @@ */ @State(Scope.Benchmark) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Warmup(iterations = 2) -@Measurement(iterations = 10) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) @BenchmarkMode(Mode.AverageTime) -@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 5) +@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) public class PKCS12KeyStores { private static final char[] PASS = "changeit".toCharArray(); diff --git a/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java b/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java index 22bccdcb859..7018cc73c37 100644 --- a/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java +++ b/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java @@ -42,8 +42,8 @@ */ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) -@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) @Fork(3) @State(Scope.Thread) public class PermissionsImplies { diff --git a/test/micro/org/openjdk/bench/java/security/SSLHandshake.java b/test/micro/org/openjdk/bench/java/security/SSLHandshake.java index 714fc9de31c..67e51e9532d 100644 --- a/test/micro/org/openjdk/bench/java/security/SSLHandshake.java +++ b/test/micro/org/openjdk/bench/java/security/SSLHandshake.java @@ -51,6 +51,9 @@ @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.SECONDS) @State(Scope.Benchmark) +@Warmup(iterations = 5, time = 5) +@Measurement(iterations = 5, time = 5) +@Fork(value = 3) public class SSLHandshake { private SSLContext sslc; @@ -109,9 +112,6 @@ private HandshakeStatus checkResult(SSLEngine engine, SSLEngineResult result) { * The client and the server both operate on the same thread. */ @Benchmark - @Warmup(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS) - @Measurement(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS) - @Fork(3) public SSLSession doHandshake() throws Exception { createSSLEngines(); From 8faeefc1509a5b890bdae852472c318c64dc0772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Arias=20de=20Reyna?= Date: Wed, 29 May 2024 13:55:21 +0000 Subject: [PATCH 007/329] 8289182: NMT: MemTracker::baseline should return void Backport-of: b96ba19807845739b36274efb168dd048db819a3 --- src/hotspot/share/services/memBaseline.cpp | 11 ++---- src/hotspot/share/services/memBaseline.hpp | 4 +- src/hotspot/share/services/memTracker.cpp | 23 ++++++------ src/hotspot/share/services/nmtDCmd.cpp | 37 ++++++++----------- .../jtreg/runtime/NMT/JcmdBaselineDetail.java | 2 +- .../jtreg/runtime/NMT/JcmdDetailDiff.java | 2 +- .../jtreg/runtime/NMT/JcmdSummaryDiff.java | 2 +- .../runtime/NMT/MallocSiteTypeChange.java | 2 +- 8 files changed, 36 insertions(+), 47 deletions(-) diff --git a/src/hotspot/share/services/memBaseline.cpp b/src/hotspot/share/services/memBaseline.cpp index 7a04ee2a6a4..9e8307e5522 100644 --- a/src/hotspot/share/services/memBaseline.cpp +++ b/src/hotspot/share/services/memBaseline.cpp @@ -145,11 +145,10 @@ class VirtualMemoryAllocationWalker : public VirtualMemoryWalker { }; -bool MemBaseline::baseline_summary() { +void MemBaseline::baseline_summary() { MallocMemorySummary::snapshot(&_malloc_memory_snapshot); VirtualMemorySummary::snapshot(&_virtual_memory_snapshot); _metaspace_stats = MetaspaceUtils::get_combined_statistics(); - return true; } bool MemBaseline::baseline_allocation_sites() { @@ -186,15 +185,12 @@ bool MemBaseline::baseline_allocation_sites() { return true; } -bool MemBaseline::baseline(bool summaryOnly) { +void MemBaseline::baseline(bool summaryOnly) { reset(); _instance_class_count = ClassLoaderDataGraph::num_instance_classes(); _array_class_count = ClassLoaderDataGraph::num_array_classes(); - - if (!baseline_summary()) { - return false; - } + baseline_summary(); _baseline_type = Summary_baselined; @@ -205,7 +201,6 @@ bool MemBaseline::baseline(bool summaryOnly) { _baseline_type = Detail_baselined; } - return true; } int compare_allocation_site(const VirtualMemoryAllocationSite& s1, diff --git a/src/hotspot/share/services/memBaseline.hpp b/src/hotspot/share/services/memBaseline.hpp index 45b3774f27d..7b895798792 100644 --- a/src/hotspot/share/services/memBaseline.hpp +++ b/src/hotspot/share/services/memBaseline.hpp @@ -90,7 +90,7 @@ class MemBaseline { _baseline_type(Not_baselined) { } - bool baseline(bool summaryOnly = true); + void baseline(bool summaryOnly = true); BaselineType baseline_type() const { return _baseline_type; } @@ -190,7 +190,7 @@ class MemBaseline { private: // Baseline summary information - bool baseline_summary(); + void baseline_summary(); // Baseline allocation sites (detail tracking only) bool baseline_allocation_sites(); diff --git a/src/hotspot/share/services/memTracker.cpp b/src/hotspot/share/services/memTracker.cpp index 343703213ad..28aaa63d565 100644 --- a/src/hotspot/share/services/memTracker.cpp +++ b/src/hotspot/share/services/memTracker.cpp @@ -129,18 +129,17 @@ void MemTracker::final_report(outputStream* output) { void MemTracker::report(bool summary_only, outputStream* output, size_t scale) { assert(output != NULL, "No output stream"); MemBaseline baseline; - if (baseline.baseline(summary_only)) { - if (summary_only) { - MemSummaryReporter rpt(baseline, output, scale); - rpt.report(); - } else { - MemDetailReporter rpt(baseline, output, scale); - rpt.report(); - output->print("Metaspace:"); - // The basic metaspace report avoids any locking and should be safe to - // be called at any time. - MetaspaceUtils::print_basic_report(output, scale); - } + baseline.baseline(summary_only); + if (summary_only) { + MemSummaryReporter rpt(baseline, output, scale); + rpt.report(); + } else { + MemDetailReporter rpt(baseline, output, scale); + rpt.report(); + output->print("Metaspace:"); + // The basic metaspace report avoids any locking and should be safe to + // be called at any time. + MetaspaceUtils::print_basic_report(output, scale); } } diff --git a/src/hotspot/share/services/nmtDCmd.cpp b/src/hotspot/share/services/nmtDCmd.cpp index 6c87a664f79..e78f1b0605e 100644 --- a/src/hotspot/share/services/nmtDCmd.cpp +++ b/src/hotspot/share/services/nmtDCmd.cpp @@ -121,11 +121,8 @@ void NMTDCmd::execute(DCmdSource source, TRAPS) { report(false, scale_unit); } else if (_baseline.value()) { MemBaseline& baseline = MemTracker::get_baseline(); - if (!baseline.baseline(MemTracker::tracking_level() != NMT_detail)) { - output()->print_cr("Baseline failed"); - } else { - output()->print_cr("Baseline succeeded"); - } + baseline.baseline(MemTracker::tracking_level() != NMT_detail); + output()->print_cr("Baseline taken"); } else if (_summary_diff.value()) { MemBaseline& baseline = MemTracker::get_baseline(); if (baseline.baseline_type() >= MemBaseline::Summary_baselined) { @@ -157,14 +154,13 @@ void NMTDCmd::execute(DCmdSource source, TRAPS) { void NMTDCmd::report(bool summaryOnly, size_t scale_unit) { MemBaseline baseline; - if (baseline.baseline(summaryOnly)) { - if (summaryOnly) { - MemSummaryReporter rpt(baseline, output(), scale_unit); - rpt.report(); - } else { - MemDetailReporter rpt(baseline, output(), scale_unit); - rpt.report(); - } + baseline.baseline(summaryOnly); + if (summaryOnly) { + MemSummaryReporter rpt(baseline, output(), scale_unit); + rpt.report(); + } else { + MemDetailReporter rpt(baseline, output(), scale_unit); + rpt.report(); } } @@ -176,14 +172,13 @@ void NMTDCmd::report_diff(bool summaryOnly, size_t scale_unit) { "Not a detail baseline"); MemBaseline baseline; - if (baseline.baseline(summaryOnly)) { - if (summaryOnly) { - MemSummaryDiffReporter rpt(early_baseline, baseline, output(), scale_unit); - rpt.report_diff(); - } else { - MemDetailDiffReporter rpt(early_baseline, baseline, output(), scale_unit); - rpt.report_diff(); - } + baseline.baseline(summaryOnly); + if (summaryOnly) { + MemSummaryDiffReporter rpt(early_baseline, baseline, output(), scale_unit); + rpt.report_diff(); + } else { + MemDetailDiffReporter rpt(early_baseline, baseline, output(), scale_unit); + rpt.report_diff(); } } diff --git a/test/hotspot/jtreg/runtime/NMT/JcmdBaselineDetail.java b/test/hotspot/jtreg/runtime/NMT/JcmdBaselineDetail.java index 7b81567aef1..b537b16f575 100644 --- a/test/hotspot/jtreg/runtime/NMT/JcmdBaselineDetail.java +++ b/test/hotspot/jtreg/runtime/NMT/JcmdBaselineDetail.java @@ -47,6 +47,6 @@ public static void main(String args[]) throws Exception { pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "baseline=true"}); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Baseline succeeded"); + output.shouldContain("Baseline taken"); } } diff --git a/test/hotspot/jtreg/runtime/NMT/JcmdDetailDiff.java b/test/hotspot/jtreg/runtime/NMT/JcmdDetailDiff.java index f423642ed30..b5e0040c3b0 100644 --- a/test/hotspot/jtreg/runtime/NMT/JcmdDetailDiff.java +++ b/test/hotspot/jtreg/runtime/NMT/JcmdDetailDiff.java @@ -57,7 +57,7 @@ public static void main(String args[]) throws Exception { pb.start().waitFor(); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Baseline succeeded"); + output.shouldContain("Baseline taken"); addr = wb.NMTReserveMemory(reserveSize); pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail.diff", "scale=KB"}); diff --git a/test/hotspot/jtreg/runtime/NMT/JcmdSummaryDiff.java b/test/hotspot/jtreg/runtime/NMT/JcmdSummaryDiff.java index 744fe652210..4437f1ffdc2 100644 --- a/test/hotspot/jtreg/runtime/NMT/JcmdSummaryDiff.java +++ b/test/hotspot/jtreg/runtime/NMT/JcmdSummaryDiff.java @@ -57,7 +57,7 @@ public static void main(String args[]) throws Exception { pb.start().waitFor(); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Baseline succeeded"); + output.shouldContain("Baseline taken"); addr = wb.NMTReserveMemory(reserveSize); pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary.diff", "scale=KB"}); diff --git a/test/hotspot/jtreg/runtime/NMT/MallocSiteTypeChange.java b/test/hotspot/jtreg/runtime/NMT/MallocSiteTypeChange.java index 998ced3e83f..ac46c7253d5 100644 --- a/test/hotspot/jtreg/runtime/NMT/MallocSiteTypeChange.java +++ b/test/hotspot/jtreg/runtime/NMT/MallocSiteTypeChange.java @@ -56,7 +56,7 @@ public static void main(String args[]) throws Exception { pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "baseline"}); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Baseline succeeded"); + output.shouldContain("Baseline taken"); wb.NMTFree(addr); addr = wb.NMTMallocWithPseudoStackAndType(2 * 1024, pc, 8 /* mtInternal */ ); From dcb2c35151a846b7c44045235b389baf9713885c Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Thu, 30 May 2024 07:35:37 +0000 Subject: [PATCH 008/329] 8295111: dpkg appears to have problems resolving symbolically linked native libraries Backport-of: 32946e1882e9b22c983cbba3c6bda3cc7295946a --- .../jpackage/internal/LinuxDebBundler.java | 66 ++++++++++++------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java index ccc36c3e166..71e98a4b2ac 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, 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 @@ -195,6 +195,24 @@ protected void initLibProvidersLookup( Map params, LibProvidersLookup libProvidersLookup) { + libProvidersLookup.setPackageLookup(file -> { + Path realPath = file.toRealPath(); + + try { + // Try the real path first as it works better on newer Ubuntu versions + return findProvidingPackages(realPath); + } catch (IOException ex) { + // Try the default path if differ + if (!realPath.toString().equals(file.toString())) { + return findProvidingPackages(file); + } else { + throw ex; + } + } + }); + } + + private static Stream findProvidingPackages(Path file) throws IOException { // // `dpkg -S` command does glob pattern lookup. If not the absolute path // to the file is specified it might return mltiple package names. @@ -237,32 +255,30 @@ protected void initLibProvidersLookup( // 4. Arch suffix should be stripped from accepted package names. // - libProvidersLookup.setPackageLookup(file -> { - Set archPackages = new HashSet<>(); - Set otherPackages = new HashSet<>(); - - Executor.of(TOOL_DPKG, "-S", file.toString()) - .saveOutput(true).executeExpectSuccess() - .getOutput().forEach(line -> { - Matcher matcher = PACKAGE_NAME_REGEX.matcher(line); - if (matcher.find()) { - String name = matcher.group(1); - if (name.endsWith(":" + DEB_ARCH)) { - // Strip arch suffix - name = name.substring(0, - name.length() - (DEB_ARCH.length() + 1)); - archPackages.add(name); - } else { - otherPackages.add(name); - } + Set archPackages = new HashSet<>(); + Set otherPackages = new HashSet<>(); + + Executor.of(TOOL_DPKG, "-S", file.toString()) + .saveOutput(true).executeExpectSuccess() + .getOutput().forEach(line -> { + Matcher matcher = PACKAGE_NAME_REGEX.matcher(line); + if (matcher.find()) { + String name = matcher.group(1); + if (name.endsWith(":" + DEB_ARCH)) { + // Strip arch suffix + name = name.substring(0, + name.length() - (DEB_ARCH.length() + 1)); + archPackages.add(name); + } else { + otherPackages.add(name); } - }); + } + }); - if (!archPackages.isEmpty()) { - return archPackages.stream(); - } - return otherPackages.stream(); - }); + if (!archPackages.isEmpty()) { + return archPackages.stream(); + } + return otherPackages.stream(); } @Override From 515bc9a264c1e44cfcada0405a74ab2fba428e10 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 30 May 2024 07:35:57 +0000 Subject: [PATCH 009/329] 8318986: Improve GenericWaitBarrier performance Backport-of: 30462f9da40d3a7ec18fcf46e2154fabb5fd4753 --- .../share/utilities/waitBarrier_generic.cpp | 261 ++++++++++++++---- .../share/utilities/waitBarrier_generic.hpp | 74 ++++- 2 files changed, 274 insertions(+), 61 deletions(-) diff --git a/src/hotspot/share/utilities/waitBarrier_generic.cpp b/src/hotspot/share/utilities/waitBarrier_generic.cpp index b5d9ff67eb7..dbf4db336c2 100644 --- a/src/hotspot/share/utilities/waitBarrier_generic.cpp +++ b/src/hotspot/share/utilities/waitBarrier_generic.cpp @@ -1,5 +1,6 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright Amazon.com Inc. 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 @@ -29,66 +30,228 @@ #include "utilities/waitBarrier_generic.hpp" #include "utilities/spinYield.hpp" +// Implements the striped semaphore wait barrier. +// +// To guarantee progress and safety, we need to make sure that new barrier tag +// starts with the completely empty set of waiters and free semaphore. This +// requires either waiting for all threads to leave wait() for current barrier +// tag on disarm(), or waiting for all threads to leave the previous tag before +// reusing the semaphore in arm(). +// +// When there are multiple threads, it is normal for some threads to take +// significant time to leave the barrier. Waiting for these threads introduces +// stalls on barrier reuse. +// +// If we wait on disarm(), this stall is nearly guaranteed to happen if some threads +// are de-scheduled by prior wait(). It would be especially bad if there are more +// waiting threads than CPUs: every thread would need to wake up and register itself +// as leaving, before we can unblock from disarm(). +// +// If we wait on arm(), we can get lucky that most threads would be able to catch up, +// exit wait(), and so we arrive to arm() with semaphore ready for reuse. However, +// that is still insufficient in practice. +// +// Therefore, this implementation goes a step further and implements the _striped_ +// semaphores. We maintain several semaphores in cells. The barrier tags are assigned +// to cells in some simple manner. Most of the current uses have sequential barrier +// tags, so simple modulo works well. We then operate on a cell like we would operate +// on a single semaphore: we wait at arm() for all threads to catch up before reusing +// the cell. For the cost of maintaining just a few cells, we have enough window for +// threads to catch up. +// +// The correctness is guaranteed by using a single atomic state variable per cell, +// with updates always done with CASes: +// +// [.......... barrier tag ..........][.......... waiters ..........] +// 63 31 0 +// +// Cell starts with zero tag and zero waiters. Arming the cell swings barrier tag from +// zero to some tag, while checking that no waiters have appeared. Disarming swings +// the barrier tag back from tag to zero. Every waiter registers itself by incrementing +// the "waiters", while checking that barrier tag is still the same. Every completing waiter +// decrements the "waiters". When all waiters complete, a cell ends up in initial state, +// ready to be armed again. This allows accurate tracking of how many signals +// to issue and does not race with disarm. +// +// The implementation uses the strongest (default) barriers for extra safety, even +// when not strictly required to do so for correctness. Extra barrier overhead is +// dominated by the actual wait/notify latency anyway. +// + void GenericWaitBarrier::arm(int barrier_tag) { - assert(_barrier_tag == 0, "Already armed"); - assert(_waiters == 0, "We left a thread hanging"); - _barrier_tag = barrier_tag; - _waiters = 0; + assert(barrier_tag != 0, "Pre arm: Should be arming with armed value"); + assert(Atomic::load(&_barrier_tag) == 0, + "Pre arm: Should not be already armed. Tag: %d", + Atomic::load(&_barrier_tag)); + Atomic::release_store(&_barrier_tag, barrier_tag); + + Cell &cell = tag_to_cell(barrier_tag); + cell.arm(barrier_tag); + + // API specifies arm() must provide a trailing fence. OrderAccess::fence(); } -int GenericWaitBarrier::wake_if_needed() { - assert(_barrier_tag == 0, "Not disarmed"); - int w = _waiters; - if (w == 0) { - // Load of _barrier_threads in caller must not pass the load of _waiters. - OrderAccess::loadload(); - return 0; - } - assert(w > 0, "Bad counting"); - // We need an exact count which never goes below zero, - // otherwise the semaphore may be signalled too many times. - if (Atomic::cmpxchg(&_waiters, w, w - 1) == w) { - _sem_barrier.signal(); - return w - 1; - } - return w; +void GenericWaitBarrier::disarm() { + int barrier_tag = Atomic::load_acquire(&_barrier_tag); + assert(barrier_tag != 0, "Pre disarm: Should be armed. Tag: %d", barrier_tag); + Atomic::release_store(&_barrier_tag, 0); + + Cell &cell = tag_to_cell(barrier_tag); + cell.disarm(barrier_tag); + + // API specifies disarm() must provide a trailing fence. + OrderAccess::fence(); } -void GenericWaitBarrier::disarm() { - assert(_barrier_tag != 0, "Not armed"); - _barrier_tag = 0; - // Loads of _barrier_threads/_waiters must not float above disarm store and - // disarm store must not sink below. +void GenericWaitBarrier::wait(int barrier_tag) { + assert(barrier_tag != 0, "Pre wait: Should be waiting on armed value"); + + Cell &cell = tag_to_cell(barrier_tag); + cell.wait(barrier_tag); + + // API specifies wait() must provide a trailing fence. OrderAccess::fence(); - int left; +} + +void GenericWaitBarrier::Cell::arm(int32_t requested_tag) { + // Before we continue to arm, we need to make sure that all threads + // have left the previous cell. + + int64_t state; + SpinYield sp; - do { - left = GenericWaitBarrier::wake_if_needed(); - if (left == 0 && _barrier_threads > 0) { - // There is no thread to wake but we still have barrier threads. + while (true) { + state = Atomic::load_acquire(&_state); + assert(decode_tag(state) == 0, + "Pre arm: Should not be armed. " + "Tag: " INT32_FORMAT "; Waiters: " INT32_FORMAT, + decode_tag(state), decode_waiters(state)); + if (decode_waiters(state) == 0) { + break; + } + sp.wait(); + } + + // Try to swing cell to armed. This should always succeed after the check above. + int64_t new_state = encode(requested_tag, 0); + int64_t prev_state = Atomic::cmpxchg(&_state, state, new_state); + if (prev_state != state) { + fatal("Cannot arm the wait barrier. " + "Tag: " INT32_FORMAT "; Waiters: " INT32_FORMAT, + decode_tag(prev_state), decode_waiters(prev_state)); + } +} + +int GenericWaitBarrier::Cell::signal_if_needed(int max) { + int signals = 0; + while (true) { + int cur = Atomic::load_acquire(&_outstanding_wakeups); + if (cur == 0) { + // All done, no more waiters. + return 0; + } + assert(cur > 0, "Sanity"); + + int prev = Atomic::cmpxchg(&_outstanding_wakeups, cur, cur - 1); + if (prev != cur) { + // Contention, return to caller for early return or backoff. + return prev; + } + + // Signal! + _sem.signal(); + + if (++signals >= max) { + // Signalled requested number of times, break out. + return prev; + } + } +} + +void GenericWaitBarrier::Cell::disarm(int32_t expected_tag) { + int32_t waiters; + + while (true) { + int64_t state = Atomic::load_acquire(&_state); + int32_t tag = decode_tag(state); + waiters = decode_waiters(state); + + assert((tag == expected_tag) && (waiters >= 0), + "Mid disarm: Should be armed with expected tag and have sane waiters. " + "Tag: " INT32_FORMAT "; Waiters: " INT32_FORMAT, + tag, waiters); + + int64_t new_state = encode(0, waiters); + if (Atomic::cmpxchg(&_state, state, new_state) == state) { + // Successfully disarmed. + break; + } + } + + // Wake up waiters, if we have at least one. + // Allow other threads to assist with wakeups, if possible. + if (waiters > 0) { + Atomic::release_store(&_outstanding_wakeups, waiters); + SpinYield sp; + while (signal_if_needed(INT_MAX) > 0) { sp.wait(); } - // We must loop here until there are no waiters or potential waiters. - } while (left > 0 || _barrier_threads > 0); - // API specifies disarm() must provide a trailing fence. - OrderAccess::fence(); + } + assert(Atomic::load(&_outstanding_wakeups) == 0, "Post disarm: Should not have outstanding wakeups"); } -void GenericWaitBarrier::wait(int barrier_tag) { - assert(barrier_tag != 0, "Trying to wait on disarmed value"); - if (barrier_tag != _barrier_tag) { - // API specifies wait() must provide a trailing fence. - OrderAccess::fence(); - return; +void GenericWaitBarrier::Cell::wait(int32_t expected_tag) { + // Try to register ourselves as pending waiter. + while (true) { + int64_t state = Atomic::load_acquire(&_state); + int32_t tag = decode_tag(state); + if (tag != expected_tag) { + // Cell tag had changed while waiting here. This means either the cell had + // been disarmed, or we are late and the cell was armed with a new tag. + // Exit without touching anything else. + return; + } + int32_t waiters = decode_waiters(state); + + assert((tag == expected_tag) && (waiters >= 0 && waiters < INT32_MAX), + "Before wait: Should be armed with expected tag and waiters are in range. " + "Tag: " INT32_FORMAT "; Waiters: " INT32_FORMAT, + tag, waiters); + + int64_t new_state = encode(tag, waiters + 1); + if (Atomic::cmpxchg(&_state, state, new_state) == state) { + // Success! Proceed to wait. + break; + } } - Atomic::add(&_barrier_threads, 1); - if (barrier_tag != 0 && barrier_tag == _barrier_tag) { - Atomic::add(&_waiters, 1); - _sem_barrier.wait(); - // We help out with posting, but we need to do so before we decrement the - // _barrier_threads otherwise we might wake threads up in next wait. - GenericWaitBarrier::wake_if_needed(); + + // Wait for notification. + _sem.wait(); + + // Unblocked! We help out with waking up two siblings. This allows to avalanche + // the wakeups for many threads, even if some threads are lagging behind. + // Note that we can only do this *before* reporting back as completed waiter, + // otherwise we might prematurely wake up threads for another barrier tag. + // Current arm() sequence protects us from this trouble by waiting until all waiters + // leave. + signal_if_needed(2); + + // Register ourselves as completed waiter before leaving. + while (true) { + int64_t state = Atomic::load_acquire(&_state); + int32_t tag = decode_tag(state); + int32_t waiters = decode_waiters(state); + + assert((tag == 0) && (waiters > 0), + "After wait: Should be not armed and have non-complete waiters. " + "Tag: " INT32_FORMAT "; Waiters: " INT32_FORMAT, + tag, waiters); + + int64_t new_state = encode(tag, waiters - 1); + if (Atomic::cmpxchg(&_state, state, new_state) == state) { + // Success! + break; + } } - Atomic::add(&_barrier_threads, -1); } diff --git a/src/hotspot/share/utilities/waitBarrier_generic.hpp b/src/hotspot/share/utilities/waitBarrier_generic.hpp index 50bfea6aebf..d3a45b33b82 100644 --- a/src/hotspot/share/utilities/waitBarrier_generic.hpp +++ b/src/hotspot/share/utilities/waitBarrier_generic.hpp @@ -26,29 +26,79 @@ #define SHARE_UTILITIES_WAITBARRIER_GENERIC_HPP #include "memory/allocation.hpp" +#include "memory/padded.hpp" #include "runtime/semaphore.hpp" #include "utilities/globalDefinitions.hpp" -// In addition to the barrier tag, it uses two counters to keep the semaphore -// count correct and not leave any late thread waiting. class GenericWaitBarrier : public CHeapObj { +private: + class Cell : public CHeapObj { + private: + // Pad out the cells to avoid interference between the cells. + // This would insulate from stalls when adjacent cells have returning + // workers and contend over the cache line for current latency-critical + // cell. + DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0); + + Semaphore _sem; + + // Cell state, tracks the arming + waiters status + volatile int64_t _state; + + // Wakeups to deliver for current waiters + volatile int _outstanding_wakeups; + + int signal_if_needed(int max); + + static int64_t encode(int32_t barrier_tag, int32_t waiters) { + int64_t val = (((int64_t) barrier_tag) << 32) | + (((int64_t) waiters) & 0xFFFFFFFF); + assert(decode_tag(val) == barrier_tag, "Encoding is reversible"); + assert(decode_waiters(val) == waiters, "Encoding is reversible"); + return val; + } + + static int32_t decode_tag(int64_t value) { + return (int32_t)(value >> 32); + } + + static int32_t decode_waiters(int64_t value) { + return (int32_t)(value & 0xFFFFFFFF); + } + + public: + Cell() : _sem(0), _state(encode(0, 0)), _outstanding_wakeups(0) {} + NONCOPYABLE(Cell); + + void arm(int32_t requested_tag); + void disarm(int32_t expected_tag); + void wait(int32_t expected_tag); + }; + + // Should be enough for most uses without exploding the footprint. + static constexpr int CELLS_COUNT = 16; + + Cell _cells[CELLS_COUNT]; + + // Trailing padding to protect the last cell. + DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0); + volatile int _barrier_tag; - // The number of threads waiting on or about to wait on the semaphore. - volatile int _waiters; - // The number of threads in the wait path, before or after the tag check. - // These threads can become waiters. - volatile int _barrier_threads; - Semaphore _sem_barrier; + + // Trailing padding to insulate the rest of the barrier from adjacent + // data structures. The leading padding is not needed, as cell padding + // handles this for us. + DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0); NONCOPYABLE(GenericWaitBarrier); - int wake_if_needed(); + Cell& tag_to_cell(int tag) { return _cells[tag & (CELLS_COUNT - 1)]; } - public: - GenericWaitBarrier() : _barrier_tag(0), _waiters(0), _barrier_threads(0), _sem_barrier(0) {} +public: + GenericWaitBarrier() : _cells(), _barrier_tag(0) {} ~GenericWaitBarrier() {} - const char* description() { return "semaphore"; } + const char* description() { return "striped semaphore"; } void arm(int barrier_tag); void disarm(); From 7a8cf6c8aec6cd648663def62d9496e516f05d4f Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Fri, 31 May 2024 00:37:24 +0000 Subject: [PATCH 010/329] 8319713: Parallel: Remove PSAdaptiveSizePolicy::should_full_GC Backport-of: 4bcda602668835c35e2ac6ff6702d15cd249bc2a --- .../share/gc/parallel/psAdaptiveSizePolicy.cpp | 16 ---------------- .../share/gc/parallel/psAdaptiveSizePolicy.hpp | 4 ---- src/hotspot/share/gc/parallel/psScavenge.cpp | 5 +---- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp index f97727c8bc8..e5817ca6f5c 100644 --- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp +++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp @@ -169,22 +169,6 @@ void PSAdaptiveSizePolicy::major_collection_end(size_t amount_live, _major_timer.start(); } -// If the remaining free space in the old generation is less that -// that expected to be needed by the next collection, do a full -// collection now. -bool PSAdaptiveSizePolicy::should_full_GC(size_t old_free_in_bytes) { - - // A similar test is done in the scavenge's should_attempt_scavenge(). If - // this is changed, decide if that test should also be changed. - bool result = padded_average_promoted_in_bytes() > (float) old_free_in_bytes; - log_trace(gc, ergo)("%s after scavenge average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT, - result ? "Full" : "No full", - (size_t) average_promoted_in_bytes(), - (size_t) padded_average_promoted_in_bytes(), - old_free_in_bytes); - return result; -} - void PSAdaptiveSizePolicy::clear_generation_free_space_flags() { AdaptiveSizePolicy::clear_generation_free_space_flags(); diff --git a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp index c39514922fc..1b058e2dd29 100644 --- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp +++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp @@ -306,10 +306,6 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy { } float major_collection_slope() { return _major_collection_estimator->slope();} - // Given the amount of live data in the heap, should we - // perform a Full GC? - bool should_full_GC(size_t live_in_old_gen); - // Calculates optimal (free) space sizes for both the young and old // generations. Stores results in _eden_size and _promo_size. // Takes current used space in all generations as input, as well diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp index c4011fff4e5..ef14ad53aa0 100644 --- a/src/hotspot/share/gc/parallel/psScavenge.cpp +++ b/src/hotspot/share/gc/parallel/psScavenge.cpp @@ -238,8 +238,7 @@ bool PSScavenge::invoke() { IsGCActiveMark mark; const bool scavenge_done = PSScavenge::invoke_no_policy(); - const bool need_full_gc = !scavenge_done || - policy->should_full_GC(heap->old_gen()->free_in_bytes()); + const bool need_full_gc = !scavenge_done; bool full_gc_done = false; if (UsePerfData) { @@ -739,8 +738,6 @@ bool PSScavenge::should_attempt_scavenge() { // Test to see if the scavenge will likely fail. PSAdaptiveSizePolicy* policy = heap->size_policy(); - // A similar test is done in the policy's should_full_GC(). If this is - // changed, decide if that test should also be changed. size_t avg_promoted = (size_t) policy->padded_average_promoted_in_bytes(); size_t promotion_estimate = MIN2(avg_promoted, young_gen->used_in_bytes()); bool result = promotion_estimate < old_gen->free_in_bytes(); From cc0c14380337f868d63f4ab746e4746a5dc2f115 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Fri, 31 May 2024 08:14:43 +0000 Subject: [PATCH 011/329] 8310108: Skip ReplaceCriticalClassesForSubgraphs when EnableJVMCI is specified Backport-of: 1b0dd7c254dc1a087874c8726d8d26b9a41d4145 --- test/hotspot/jtreg/TEST.ROOT | 1 + .../ReplaceCriticalClassesForSubgraphs.java | 1 + test/jdk/TEST.ROOT | 1 + test/jtreg-ext/requires/VMProps.java | 15 +++++++++++++++ 4 files changed, 18 insertions(+) diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index f6e6209cd6b..30a242a06d9 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -58,6 +58,7 @@ requires.properties= \ vm.gc.Epsilon \ vm.gc.Z \ vm.jvmci \ + vm.jvmci.enabled \ vm.emulatedClient \ vm.cpu.features \ vm.pageSize \ diff --git a/test/hotspot/jtreg/runtime/cds/serviceability/ReplaceCriticalClassesForSubgraphs.java b/test/hotspot/jtreg/runtime/cds/serviceability/ReplaceCriticalClassesForSubgraphs.java index 1a267665dd6..f7d50fd7fe6 100644 --- a/test/hotspot/jtreg/runtime/cds/serviceability/ReplaceCriticalClassesForSubgraphs.java +++ b/test/hotspot/jtreg/runtime/cds/serviceability/ReplaceCriticalClassesForSubgraphs.java @@ -27,6 +27,7 @@ * @summary Tests how CDS works when critical library classes are replaced with JVMTI ClassFileLoadHook * @library /test/lib * @requires vm.cds.write.archived.java.heap + * @requires !vm.jvmci.enabled * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox * @run main/othervm/native ReplaceCriticalClassesForSubgraphs diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index e2505241a0d..94ff0660b48 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -68,6 +68,7 @@ requires.properties= \ vm.hasSA \ vm.hasJFR \ vm.jvmci \ + vm.jvmci.enabled \ docker.support \ release.implementor \ jdk.containerized diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 452f3c9dce2..6cce0913eb1 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -99,6 +99,7 @@ public Map call() { map.put("vm.simpleArch", this::vmArch); map.put("vm.debug", this::vmDebug); map.put("vm.jvmci", this::vmJvmci); + map.put("vm.jvmci.enabled", this::vmJvmciEnabled); map.put("vm.emulatedClient", this::vmEmulatedClient); // vm.hasSA is "true" if the VM contains the serviceability agent // and jhsdb. @@ -260,6 +261,20 @@ protected String vmJvmci() { return "true"; } + + /** + * @return true if JVMCI is enabled + */ + protected String vmJvmciEnabled() { + // builds with jvmci have this flag + if ("false".equals(vmJvmci())) { + return "false"; + } + + return "" + Compiler.isJVMCIEnabled(); + } + + /** * @return true if VM runs in emulated-client mode and false otherwise. */ From eebb80c4bcec64dc70065b597688cbe12c892a5b Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Fri, 31 May 2024 08:15:59 +0000 Subject: [PATCH 012/329] 8317288: [macos] java/awt/Window/Grab/GrabTest.java: Press on the outside area didn't cause ungrab Backport-of: db5613af89a2d4ab5a8998ad1d43384778974866 --- test/jdk/java/awt/Window/Grab/GrabTest.java | 126 ++++++++++++-------- 1 file changed, 74 insertions(+), 52 deletions(-) diff --git a/test/jdk/java/awt/Window/Grab/GrabTest.java b/test/jdk/java/awt/Window/Grab/GrabTest.java index 5db28cb15b5..b173477c164 100644 --- a/test/jdk/java/awt/Window/Grab/GrabTest.java +++ b/test/jdk/java/awt/Window/Grab/GrabTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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 @@ -22,19 +22,34 @@ */ /* - @test - @key headful - @bug 7124430 - @summary Tests that SunToolkit.grab API works - @author anton.tarasov@oracle.com: area=awt.toolkit - @library ../../regtesthelpers - @modules java.desktop/sun.awt - @build Util - @run main GrabTest -*/ - -import java.awt.*; -import java.awt.event.*; + * @test + * @key headful + * @bug 7124430 + * @summary Tests that SunToolkit.grab API works + * @library ../../regtesthelpers + * @modules java.desktop/sun.awt + * @build Util + * @run main GrabTest + */ + + +import java.awt.AWTEvent; +import java.awt.Button; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.AWTEventListener; +import java.awt.event.MouseAdapter; + +import javax.swing.SwingUtilities; import test.java.awt.regtesthelpers.Util; public class GrabTest { @@ -56,9 +71,13 @@ public class GrabTest { static volatile boolean passed = true; - public static void main(String[] args) { + public static void main(String[] args) throws Exception { + + robot = new Robot(); + robot.setAutoDelay(100); - Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { + SwingUtilities.invokeAndWait(() -> { + Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent e) { System.out.println(e); if (e instanceof sun.awt.UngrabEvent) { @@ -67,61 +86,56 @@ public void eventDispatched(AWTEvent e) { } }, sun.awt.SunToolkit.GRAB_EVENT_MASK); - f = new Frame("Frame"); - f.setBounds(0, 0, 300, 300); - f.addMouseListener(new MouseAdapter() { + f = new Frame("Frame"); + f.setBounds(0, 0, 300, 300); + f.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println(e); framePressed = true; } }); - f1 = new Frame("OtherFrame"); - f1.setBounds(700, 100, 300, 300); + f1 = new Frame("OtherFrame"); + f1.setBounds(700, 100, 300, 300); - w = new Window(f); - w.setLayout(new FlowLayout()); - b = new Button("Press"); - b.addActionListener(new ActionListener() { + w = new Window(f); + w.setLayout(new FlowLayout()); + b = new Button("Press"); + b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println(e); buttonPressed = true; } }); - w.add(b); - w.setBounds(400, 100, 300, 300); - w.setBackground(Color.blue); - w.addMouseListener(new MouseAdapter() { + w.add(b); + w.setBounds(400, 100, 300, 300); + w.setBackground(Color.blue); + w.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println(e); windowPressed = true; } }); - f.setVisible(true); - w.setVisible(true); + f.setVisible(true); + w.setVisible(true); - frame = new Frame(); - window1 = new Window(frame); - window1.setSize(200, 200); - window1.setLocationRelativeTo(null); - window1.setBackground(Color.blue); + frame = new Frame(); + window1 = new Window(frame); + window1.setSize(200, 200); + window1.setLocationRelativeTo(null); + window1.setBackground(Color.blue); - window2 = new Window(window1); - window2.setSize(100, 100); - window2.setLocationRelativeTo(null); - window2.setBackground(Color.green); + window2 = new Window(window1); + window2.setSize(100, 100); + window2.setLocationRelativeTo(null); + window2.setBackground(Color.green); - tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit(); - - try { - robot = new Robot(); - } catch (AWTException ex) { - throw new RuntimeException(ex); - } + tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit(); + }); Util.waitForIdle(robot); - + robot.delay(500); test(); } @@ -131,6 +145,7 @@ public static void test() { // 1. Check that button press doesn't cause ungrab Util.clickOnComp(b, robot); Util.waitForIdle(robot); + checkAndThrow(buttonPressed, "Error: Button can not be pressed"); if (ungrabbed) { passed = false; @@ -151,6 +166,7 @@ public static void test() { // 3. Check that press on the frame causes ungrab, event must be dispatched Util.clickOnComp(f, robot); Util.waitForIdle(robot); + checkAndThrow(framePressed, "Error: Frame can't be pressed"); if (!ungrabbed) { passed = false; @@ -173,28 +189,33 @@ public static void test() { // 5. Check that press on the other frame's title causes ungrab f1.setVisible(true); Util.waitForIdle(robot); + robot.delay(500); + Util.clickOnTitle(f1, robot); + Util.waitForIdle(robot); + if (!ungrabbed) { passed = false; System.err.println("Failure: [5] Press inside of other Frame's title didn't cause ungrab"); } f.requestFocus(); // restore focus Util.waitForIdle(robot); + if (!f.hasFocus()) { System.err.println("Error: Frame can't be focused"); } ungrabbed = false; tk.grab(w); - // 6. Check that press on the outside area causes ungrab Point loc = f.getLocationOnScreen(); robot.mouseMove(loc.x + 100, loc.y + f.getSize().height + 10); Util.waitForIdle(robot); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.delay(50); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); Util.waitForIdle(robot); + if (!ungrabbed) { passed = false; System.err.println("Failure: [6] Press on the outside area didn't cause ungrab"); @@ -218,6 +239,7 @@ public static void test() { window1.setVisible(true); window2.setVisible(true); Util.waitForIdle(robot); + robot.delay(500); tk.grab(window1); From 1de0c0a805f68914aec7358fc4aa9c9d2499ec98 Mon Sep 17 00:00:00 2001 From: Rinku Kumar Maurya Date: Fri, 31 May 2024 08:41:03 +0000 Subject: [PATCH 013/329] 8256291: RunThese30M fails "assert(_class_unload ? true : ((((JfrTraceIdBits::load(class_loader_klass)) & ((1 << 4) << 8)) != 0))) failed: invariant" Backport-of: e38df21641f13d7ae92f72cf8e72660072d3e5fe --- .../types/traceid/jfrTraceIdLoadBarrier.inline.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp index 29bade3def6..9b7ddcd1273 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 @@ -109,7 +109,14 @@ inline traceid JfrTraceIdLoadBarrier::load(const PackageEntry* package) { inline traceid JfrTraceIdLoadBarrier::load(const ClassLoaderData* cld) { assert(cld != NULL, "invariant"); - return cld->has_class_mirror_holder() ? 0 : set_used_and_get(cld); + if (cld->has_class_mirror_holder()) { + return 0; + } + const Klass* const class_loader_klass = cld->class_loader_klass(); + if (class_loader_klass != nullptr && should_tag(class_loader_klass)) { + load_barrier(class_loader_klass); + } + return set_used_and_get(cld); } inline traceid JfrTraceIdLoadBarrier::load_leakp(const Klass* klass, const Method* method) { From 46ba9bbe7e93c561b5af833ff164596955302a9d Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 31 May 2024 09:06:56 +0000 Subject: [PATCH 014/329] 8318479: [jmh] the test security.CacheBench failed for multiple threads run Backport-of: 1535528cb119195b44244e8ee6bc0f913caa9270 --- test/micro/org/openjdk/bench/java/security/CacheBench.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/micro/org/openjdk/bench/java/security/CacheBench.java b/test/micro/org/openjdk/bench/java/security/CacheBench.java index 9b66b2b6337..9b7c39a3cf2 100644 --- a/test/micro/org/openjdk/bench/java/security/CacheBench.java +++ b/test/micro/org/openjdk/bench/java/security/CacheBench.java @@ -44,7 +44,7 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED", "-Xmx1g"}) +@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) public class CacheBench { From 9eb970264a34c82c11468b15fae89dc39c574682 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 31 May 2024 09:07:16 +0000 Subject: [PATCH 015/329] 8331164: createJMHBundle.sh download jars fail when url needed to be redirected Backport-of: eb88343fb763ee89010b7a9879638152decc6892 --- make/devkit/createJMHBundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/devkit/createJMHBundle.sh b/make/devkit/createJMHBundle.sh index b2b10769d15..889b7f914a4 100644 --- a/make/devkit/createJMHBundle.sh +++ b/make/devkit/createJMHBundle.sh @@ -44,7 +44,7 @@ rm -f * fetchJar() { url="${MAVEN_MIRROR}/$1/$2/$3/$2-$3.jar" if command -v curl > /dev/null; then - curl -O --fail $url + curl -OL --fail $url elif command -v wget > /dev/null; then wget $url else From a058ad151a7c68f65e915856b089ce4064c1caf8 Mon Sep 17 00:00:00 2001 From: Evgeny Ignatenko Date: Fri, 31 May 2024 09:31:26 +0000 Subject: [PATCH 016/329] 8315362: NMT: summary diff reports threads count incorrectly Reviewed-by: mdoerr Backport-of: 37aed6f46d19a48b7bceffde61b529a69a6abf54 --- src/hotspot/share/services/mallocTracker.hpp | 5 -- src/hotspot/share/services/memBaseline.cpp | 1 + src/hotspot/share/services/memBaseline.hpp | 6 +- .../share/services/threadStackTracker.cpp | 10 ++- .../runtime/NMT/SummaryDiffThreadCount.java | 66 +++++++++++++++++++ 5 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/NMT/SummaryDiffThreadCount.java diff --git a/src/hotspot/share/services/mallocTracker.hpp b/src/hotspot/share/services/mallocTracker.hpp index abeab0944f0..82f396beb3e 100644 --- a/src/hotspot/share/services/mallocTracker.hpp +++ b/src/hotspot/share/services/mallocTracker.hpp @@ -166,11 +166,6 @@ class MallocMemorySnapshot : public ResourceObj { // Total malloc'd memory used by arenas size_t total_arena() const; - inline size_t thread_count() const { - MallocMemorySnapshot* s = const_cast(this); - return s->by_type(mtThreadStack)->malloc_count(); - } - void copy_to(MallocMemorySnapshot* s) { // Need to make sure that mtChunks don't get deallocated while the // copy is going on, because their size is adjusted using this diff --git a/src/hotspot/share/services/memBaseline.cpp b/src/hotspot/share/services/memBaseline.cpp index 9e8307e5522..58da3f831a5 100644 --- a/src/hotspot/share/services/memBaseline.cpp +++ b/src/hotspot/share/services/memBaseline.cpp @@ -190,6 +190,7 @@ void MemBaseline::baseline(bool summaryOnly) { _instance_class_count = ClassLoaderDataGraph::num_instance_classes(); _array_class_count = ClassLoaderDataGraph::num_array_classes(); + _thread_count = ThreadStackTracker::thread_count(); baseline_summary(); _baseline_type = Summary_baselined; diff --git a/src/hotspot/share/services/memBaseline.hpp b/src/hotspot/share/services/memBaseline.hpp index 7b895798792..136baf7f9eb 100644 --- a/src/hotspot/share/services/memBaseline.hpp +++ b/src/hotspot/share/services/memBaseline.hpp @@ -66,6 +66,7 @@ class MemBaseline { size_t _instance_class_count; size_t _array_class_count; + size_t _thread_count; // Allocation sites information // Malloc allocation sites @@ -86,7 +87,7 @@ class MemBaseline { public: // create a memory baseline MemBaseline(): - _instance_class_count(0), _array_class_count(0), + _instance_class_count(0), _array_class_count(0), _thread_count(0), _baseline_type(Not_baselined) { } @@ -173,7 +174,7 @@ class MemBaseline { size_t thread_count() const { assert(baseline_type() != Not_baselined, "Not yet baselined"); - return _malloc_memory_snapshot.thread_count(); + return _thread_count; } // reset the baseline for reuse @@ -182,6 +183,7 @@ class MemBaseline { // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over. _instance_class_count = 0; _array_class_count = 0; + _thread_count = 0; _malloc_sites.clear(); _virtual_memory_sites.clear(); diff --git a/src/hotspot/share/services/threadStackTracker.cpp b/src/hotspot/share/services/threadStackTracker.cpp index 5caad66bb89..fb279b7c44e 100644 --- a/src/hotspot/share/services/threadStackTracker.cpp +++ b/src/hotspot/share/services/threadStackTracker.cpp @@ -49,40 +49,38 @@ int ThreadStackTracker::compare_thread_stack_base(const SimpleThreadStackSite& s void ThreadStackTracker::new_thread_stack(void* base, size_t size, const NativeCallStack& stack) { assert(MemTracker::tracking_level() >= NMT_summary, "Must be"); assert(base != NULL, "Should have been filtered"); + ThreadCritical tc; if (track_as_vm()) { - ThreadCritical tc; VirtualMemoryTracker::add_reserved_region((address)base, size, stack, mtThreadStack); - _thread_count ++; } else { // Use a slot in mallocMemorySummary for thread stack bookkeeping MallocMemorySummary::record_malloc(size, mtThreadStack); if (MemTracker::tracking_level() == NMT_detail) { - ThreadCritical tc; assert(_simple_thread_stacks != NULL, "Must be initialized"); SimpleThreadStackSite site((address)base, size, stack); _simple_thread_stacks->add(site); } } + _thread_count++; } void ThreadStackTracker::delete_thread_stack(void* base, size_t size) { assert(MemTracker::tracking_level() >= NMT_summary, "Must be"); assert(base != NULL, "Should have been filtered"); + ThreadCritical tc; if(track_as_vm()) { - ThreadCritical tc; VirtualMemoryTracker::remove_released_region((address)base, size); - _thread_count--; } else { // Use a slot in mallocMemorySummary for thread stack bookkeeping MallocMemorySummary::record_free(size, mtThreadStack); if (MemTracker::tracking_level() == NMT_detail) { - ThreadCritical tc; assert(_simple_thread_stacks != NULL, "Must be initialized"); SimpleThreadStackSite site((address)base, size, NativeCallStack::empty_stack()); // Fake object just to serve as compare target for delete bool removed = _simple_thread_stacks->remove(site); assert(removed, "Must exist"); } } + _thread_count--; } bool ThreadStackTracker::walk_simple_thread_stack_site(MallocSiteWalker* walker) { diff --git a/test/hotspot/jtreg/runtime/NMT/SummaryDiffThreadCount.java b/test/hotspot/jtreg/runtime/NMT/SummaryDiffThreadCount.java new file mode 100644 index 00000000000..c74bbeaa444 --- /dev/null +++ b/test/hotspot/jtreg/runtime/NMT/SummaryDiffThreadCount.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023, Azul Systems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary run NMT baseline, create threads and verify output from summary.diff + * @author Evgeny Ignatenko + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary SummaryDiffThreadCount + */ + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; + +public class SummaryDiffThreadCount { + public static void main(String args[]) throws Exception { + ProcessBuilder pb = new ProcessBuilder(); + OutputAnalyzer output; + // Grab my own PID. + String pid = Long.toString(ProcessTools.getProcessId()); + + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "baseline=true"}); + pb.start().waitFor(); + + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Baseline taken"); + + // Creating 10 threads. + for (int i = 0; i < 10; i++) { + new Thread(()-> { + while (true) { continue; } + }).start(); + } + + // Running "jcmd VM.native_memory summary.diff" and checking for five new threads reported. + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary.diff"}); + output = new OutputAnalyzer(pb.start()); + + // Trailing '+' is needed to check that NMT now reports that now we have more threads than it + // was during the baseline. + output.shouldMatch("thread #\\d+ \\+"); + } +} From 5cdff9f8c17868c5b66338fc1fa3df19eee266c5 Mon Sep 17 00:00:00 2001 From: Evgeny Ignatenko Date: Fri, 31 May 2024 10:14:25 +0000 Subject: [PATCH 017/329] 8318474: Fix memory reporter for thread_count Backport-of: 0baa9ecd76c9be33a1939e47dcae320bc8b65e96 --- src/hotspot/share/services/memReporter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hotspot/share/services/memReporter.cpp b/src/hotspot/share/services/memReporter.cpp index 50ffd1feadd..af342493217 100644 --- a/src/hotspot/share/services/memReporter.cpp +++ b/src/hotspot/share/services/memReporter.cpp @@ -225,7 +225,6 @@ void MemSummaryReporter::report_summary_of_type(MEMFLAGS flag, MallocMemory* thread_stack_memory = _malloc_snapshot->by_type(mtThreadStack); const char* scale = current_scale(); // report thread count - assert(ThreadStackTracker::thread_count() == 0, "Not used"); out->print_cr("%27s (thread #" SIZE_FORMAT ")", " ", thread_stack_memory->malloc_count()); out->print("%27s (Stack: " SIZE_FORMAT "%s", " ", amount_in_current_scale(thread_stack_memory->malloc_size()), scale); From 235baaae1b1ad22487bb7cb1aa0849a946524cd0 Mon Sep 17 00:00:00 2001 From: Xiaolong Peng Date: Fri, 31 May 2024 17:03:52 +0000 Subject: [PATCH 018/329] 8328075: Shenandoah: Avoid forwarding when objects don't move in full-GC Backport-of: 80ccc989a892e4d9f4e2c9395a100cfabbdcda64 --- src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp index d0cc794eeaa..2d2c86d1dfd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp @@ -361,11 +361,13 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure { _compact_point = _to_region->bottom(); } - // Object fits into current region, record new location: + // Object fits into current region, record new location, if object does not move: assert(_compact_point + obj_size <= _to_region->end(), "must fit"); shenandoah_assert_not_forwarded(NULL, p); - _preserved_marks->push_if_necessary(p, p->mark()); - p->forward_to(cast_to_oop(_compact_point)); + if (_compact_point != cast_from_oop(p)) { + _preserved_marks->push_if_necessary(p, p->mark()); + p->forward_to(cast_to_oop(_compact_point)); + } _compact_point += obj_size; } }; @@ -845,6 +847,7 @@ class ShenandoahCompactObjectsClosure : public ObjectClosure { if (p->is_forwarded()) { HeapWord* compact_from = cast_from_oop(p); HeapWord* compact_to = cast_from_oop(p->forwardee()); + assert(compact_from != compact_to, "Forwarded object should move"); Copy::aligned_conjoint_words(compact_from, compact_to, size); oop new_obj = cast_to_oop(compact_to); new_obj->init_mark(); From 97dbc9ada48a590d8c215ed62035d6383d35f3b7 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 3 Jun 2024 00:19:10 +0000 Subject: [PATCH 019/329] 8331746: Create a test to verify that the cmm id is not ignored Backport-of: 7c750fd95b83d0a93b0cce681dcfbbae1f220fdd --- .../awt/color/ICC_Profile/CustomCMMID.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 test/jdk/java/awt/color/ICC_Profile/CustomCMMID.java diff --git a/test/jdk/java/awt/color/ICC_Profile/CustomCMMID.java b/test/jdk/java/awt/color/ICC_Profile/CustomCMMID.java new file mode 100644 index 00000000000..5eb6221d39e --- /dev/null +++ b/test/jdk/java/awt/color/ICC_Profile/CustomCMMID.java @@ -0,0 +1,69 @@ +/* + * Copyright Amazon.com Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.color.ColorSpace; +import java.awt.color.ICC_Profile; +import java.util.Arrays; + +/** + * @test + * @bug 8321489 + * @summary tests that the cmm id is not ignored + */ +public final class CustomCMMID { + + private static final byte[] JAVA_ID = { + (byte) 'j', (byte) 'a', (byte) 'v', (byte) 'a', + }; + + private static final int[] CS = { + ColorSpace.CS_CIEXYZ, ColorSpace.CS_GRAY, ColorSpace.CS_LINEAR_RGB, + ColorSpace.CS_PYCC, ColorSpace.CS_sRGB + }; + + public static void main(String[] args) { + for (int cs : CS) { + ICC_Profile p = createProfile(cs); + validate(p); + } + } + + private static ICC_Profile createProfile(int type) { + byte[] data = ICC_Profile.getInstance(type).getData(); + System.arraycopy(JAVA_ID, 0, data, ICC_Profile.icHdrCmmId, + JAVA_ID.length); + return ICC_Profile.getInstance(data); + } + + private static void validate(ICC_Profile p) { + byte[] header = p.getData(ICC_Profile.icSigHead); + byte[] id = new byte[JAVA_ID.length]; + System.arraycopy(header, ICC_Profile.icHdrCmmId, id, 0, JAVA_ID.length); + + if (!java.util.Arrays.equals(id, JAVA_ID)) { + System.err.println("Expected: " + Arrays.toString(JAVA_ID)); + System.err.println("Actual: " + Arrays.toString(id)); + throw new RuntimeException("Wrong cmm id"); + } + } +} From 1ce0c63577a9480f162e762fd8a1db344955d5a7 Mon Sep 17 00:00:00 2001 From: Oli Gillespie Date: Mon, 3 Jun 2024 14:28:15 +0000 Subject: [PATCH 020/329] 8324646: Avoid Class.forName in SecureRandom constructor 8280970: Cleanup dead code in java.security.Provider Reviewed-by: phh, shade Backport-of: 8ef918d6678437a5b351b172bb4cf144eeaa975f --- .../share/classes/java/security/Provider.java | 40 ++++++++--------- .../java/security/SecureRandomBench.java | 43 +++++++++++++++++++ 2 files changed, 60 insertions(+), 23 deletions(-) create mode 100644 test/micro/org/openjdk/bench/java/security/SecureRandomBench.java diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index af8ebeeda57..8915ccc2d8a 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, 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 @@ -27,7 +27,9 @@ import jdk.internal.event.SecurityProviderServiceEvent; +import javax.security.auth.login.Configuration; import java.io.*; +import java.security.cert.CertStoreParameters; import java.util.*; import static java.util.Locale.ENGLISH; import java.lang.ref.*; @@ -1523,29 +1525,20 @@ public String toString() { private static class EngineDescription { final String name; final boolean supportsParameter; - final String constructorParameterClassName; - private volatile Class constructorParameterClass; + final Class constructorParameterClass; - EngineDescription(String name, boolean sp, String paramName) { + EngineDescription(String name, boolean sp, Class constructorParameterClass) { this.name = name; this.supportsParameter = sp; - this.constructorParameterClassName = paramName; - } - Class getConstructorParameterClass() throws ClassNotFoundException { - Class clazz = constructorParameterClass; - if (clazz == null) { - clazz = Class.forName(constructorParameterClassName); - constructorParameterClass = clazz; - } - return clazz; + this.constructorParameterClass = constructorParameterClass; } } // built in knowledge of the engine types shipped as part of the JDK private static final Map knownEngines; - private static void addEngine(String name, boolean sp, String paramName) { - EngineDescription ed = new EngineDescription(name, sp, paramName); + private static void addEngine(String name, boolean sp, Class constructorParameterClass) { + EngineDescription ed = new EngineDescription(name, sp, constructorParameterClass); // also index by canonical name to avoid toLowerCase() for some lookups knownEngines.put(name.toLowerCase(ENGLISH), ed); knownEngines.put(name, ed); @@ -1561,13 +1554,13 @@ private static void addEngine(String name, boolean sp, String paramName) { addEngine("KeyStore", false, null); addEngine("MessageDigest", false, null); addEngine("SecureRandom", false, - "java.security.SecureRandomParameters"); + SecureRandomParameters.class); addEngine("Signature", true, null); addEngine("CertificateFactory", false, null); addEngine("CertPathBuilder", false, null); addEngine("CertPathValidator", false, null); addEngine("CertStore", false, - "java.security.cert.CertStoreParameters"); + CertStoreParameters.class); // JCE addEngine("Cipher", true, null); addEngine("ExemptionMechanism", false, null); @@ -1585,18 +1578,20 @@ private static void addEngine(String name, boolean sp, String paramName) { addEngine("SaslClientFactory", false, null); addEngine("SaslServerFactory", false, null); // POLICY + @SuppressWarnings("removal") + Class policyParams = Policy.Parameters.class; addEngine("Policy", false, - "java.security.Policy$Parameters"); + policyParams); // CONFIGURATION addEngine("Configuration", false, - "javax.security.auth.login.Configuration$Parameters"); + Configuration.Parameters.class); // XML DSig addEngine("XMLSignatureFactory", false, null); addEngine("KeyInfoFactory", false, null); addEngine("TransformService", false, null); // Smart Card I/O addEngine("TerminalFactory", false, - "java.lang.Object"); + Object.class); } // get the "standard" (mixed-case) engine name for arbitary case engine name @@ -1850,8 +1845,7 @@ public Object newInstance(Object constructorParameter) ctrParamClz = constructorParameter == null? null : constructorParameter.getClass(); } else { - ctrParamClz = cap.constructorParameterClassName == null? - null : Class.forName(cap.constructorParameterClassName); + ctrParamClz = cap.constructorParameterClass; if (constructorParameter != null) { if (ctrParamClz == null) { throw new InvalidParameterException @@ -1862,7 +1856,7 @@ public Object newInstance(Object constructorParameter) if (ctrParamClz.isAssignableFrom(argClass) == false) { throw new InvalidParameterException ("constructorParameter must be instanceof " - + cap.constructorParameterClassName.replace('$', '.') + + cap.constructorParameterClass.getName().replace('$', '.') + " for engine type " + type); } } diff --git a/test/micro/org/openjdk/bench/java/security/SecureRandomBench.java b/test/micro/org/openjdk/bench/java/security/SecureRandomBench.java new file mode 100644 index 00000000000..b9196b25c62 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/security/SecureRandomBench.java @@ -0,0 +1,43 @@ +/* + * Copyright Amazon.com Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package org.openjdk.bench.java.security; + +import org.openjdk.jmh.annotations.*; + +import java.security.SecureRandom; +import java.util.concurrent.TimeUnit; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 5, time = 1) +@Measurement(iterations = 5, time = 1) +@Fork(value = 3) +public class SecureRandomBench { + + @Benchmark + public SecureRandom create() throws Exception { + return new SecureRandom(); + } +} From 1b807f914a8ee5030d35ebc69edc5429cac0c44d Mon Sep 17 00:00:00 2001 From: Oli Gillespie Date: Mon, 3 Jun 2024 14:30:17 +0000 Subject: [PATCH 021/329] 8315559: Delay TempSymbol cleanup to avoid symbol table churn Reviewed-by: phh, shade Backport-of: d23f4f12adf1ea26b8c340efe2c3854e50b68301 --- src/hotspot/share/classfile/symbolTable.cpp | 27 +++++++- src/hotspot/share/classfile/symbolTable.hpp | 21 +++++- .../gtest/classfile/test_symbolTable.cpp | 67 +++++++++++++++++-- 3 files changed, 106 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index 3e3f949ae8a..ac9cb27f614 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -56,6 +56,31 @@ const size_t ON_STACK_BUFFER_LENGTH = 128; // -------------------------------------------------------------------------- +Symbol* volatile TempSymbolCleanupDelayer::_queue[QueueSize] = {}; +volatile uint TempSymbolCleanupDelayer::_index = 0; + +// Keep this symbol alive for some time to allow for reuse. +// Temp symbols for the same string can often be created in quick succession, +// and this queue allows them to be reused instead of churning. +void TempSymbolCleanupDelayer::delay_cleanup(Symbol* sym) { + assert(sym != nullptr, "precondition"); + sym->increment_refcount(); + uint i = Atomic::add(&_index, 1u) % QueueSize; + Symbol* old = Atomic::xchg(&_queue[i], sym); + if (old != nullptr) { + old->decrement_refcount(); + } +} + +void TempSymbolCleanupDelayer::drain_queue() { + for (uint i = 0; i < QueueSize; i++) { + Symbol* sym = Atomic::xchg(&_queue[i], (Symbol*) nullptr); + if (sym != nullptr) { + sym->decrement_refcount(); + } + } +} + inline bool symbol_equals_compact_hashtable_entry(Symbol* value, const char* key, int len) { if (value->equals(key, len)) { return true; diff --git a/src/hotspot/share/classfile/symbolTable.hpp b/src/hotspot/share/classfile/symbolTable.hpp index a0b7287f936..8441a52713e 100644 --- a/src/hotspot/share/classfile/symbolTable.hpp +++ b/src/hotspot/share/classfile/symbolTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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,6 +33,16 @@ class JavaThread; template class GrowableArray; +class TempSymbolCleanupDelayer : AllStatic { + static Symbol* volatile _queue[]; + static volatile uint _index; + +public: + static const uint QueueSize = 128; + static void delay_cleanup(Symbol* s); + static void drain_queue(); +}; + // TempNewSymbol acts as a handle class in a handle/body idiom and is // responsible for proper resource management of the body (which is a Symbol*). // The body is resource managed by a reference counting scheme. @@ -54,7 +64,14 @@ class TempNewSymbol : public StackObj { // Conversion from a Symbol* to a TempNewSymbol. // Does not increment the current reference count. - TempNewSymbol(Symbol *s) : _temp(s) {} + TempNewSymbol(Symbol *s) : _temp(s) { + // Delay cleanup for temp symbols. Refcount is incremented while in + // queue. But don't requeue existing entries, or entries that are held + // elsewhere - it's a waste of effort. + if (s != nullptr && s->refcount() == 1) { + TempSymbolCleanupDelayer::delay_cleanup(s); + } + } // Copy constructor increments reference count. TempNewSymbol(const TempNewSymbol& rhs) : _temp(rhs._temp) { diff --git a/test/hotspot/gtest/classfile/test_symbolTable.cpp b/test/hotspot/gtest/classfile/test_symbolTable.cpp index 85be30ff479..a86444b8c42 100644 --- a/test/hotspot/gtest/classfile/test_symbolTable.cpp +++ b/test/hotspot/gtest/classfile/test_symbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -27,6 +27,14 @@ #include "threadHelper.inline.hpp" #include "unittest.hpp" +// Helper to avoid interference from the cleanup delay queue by draining it +// immediately after creation. +TempNewSymbol stable_temp_symbol(Symbol* sym) { + TempNewSymbol t = sym; + TempSymbolCleanupDelayer::drain_queue(); + return t; +} + TEST_VM(SymbolTable, temp_new_symbol) { // Assert messages assume these symbols are unique, and the refcounts start at // one, but code does not rely on this. @@ -36,7 +44,7 @@ TEST_VM(SymbolTable, temp_new_symbol) { Symbol* abc = SymbolTable::new_symbol("abc"); int abccount = abc->refcount(); - TempNewSymbol ss = abc; + TempNewSymbol ss = stable_temp_symbol(abc); ASSERT_EQ(ss->refcount(), abccount) << "only one abc"; ASSERT_EQ(ss->refcount(), abc->refcount()) << "should match TempNewSymbol"; @@ -45,8 +53,8 @@ TEST_VM(SymbolTable, temp_new_symbol) { int efgcount = efg->refcount(); int hijcount = hij->refcount(); - TempNewSymbol s1 = efg; - TempNewSymbol s2 = hij; + TempNewSymbol s1 = stable_temp_symbol(efg); + TempNewSymbol s2 = stable_temp_symbol(hij); ASSERT_EQ(s1->refcount(), efgcount) << "one efg"; ASSERT_EQ(s2->refcount(), hijcount) << "one hij"; @@ -65,13 +73,13 @@ TEST_VM(SymbolTable, temp_new_symbol) { TempNewSymbol s3; Symbol* klm = SymbolTable::new_symbol("klm"); int klmcount = klm->refcount(); - s3 = klm; // assignment + s3 = stable_temp_symbol(klm); // assignment ASSERT_EQ(s3->refcount(), klmcount) << "only one klm now"; Symbol* xyz = SymbolTable::new_symbol("xyz"); int xyzcount = xyz->refcount(); { // inner scope - TempNewSymbol s_inner = xyz; + TempNewSymbol s_inner = stable_temp_symbol(xyz); } ASSERT_EQ(xyz->refcount(), xyzcount - 1) << "Should have been decremented by dtor in inner scope"; @@ -166,3 +174,50 @@ TEST_VM(SymbolTable, test_cleanup_leak) { ASSERT_EQ(entry2->refcount(), 1) << "Symbol refcount just created is 1"; } + +TEST_VM(SymbolTable, test_cleanup_delay) { + // Check that new temp symbols have an extra refcount increment, which is then + // decremented when the queue spills over. + + TempNewSymbol s1 = SymbolTable::new_symbol("temp-s1"); + ASSERT_EQ(s1->refcount(), 2) << "TempNewSymbol refcount just created is 2"; + + // Fill up the queue + constexpr int symbol_name_length = 30; + char symbol_name[symbol_name_length]; + for (uint i = 1; i < TempSymbolCleanupDelayer::QueueSize; i++) { + os::snprintf(symbol_name, symbol_name_length, "temp-filler-%d", i); + TempNewSymbol s = SymbolTable::new_symbol(symbol_name); + ASSERT_EQ(s->refcount(), 2) << "TempNewSymbol refcount just created is 2"; + } + + // Add one more + TempNewSymbol spillover = SymbolTable::new_symbol("temp-spillover"); + ASSERT_EQ(spillover->refcount(), 2) << "TempNewSymbol refcount just created is 2"; + + // The first symbol should have been removed from the queue and decremented + ASSERT_EQ(s1->refcount(), 1) << "TempNewSymbol off queue refcount is 1"; +} + +TEST_VM(SymbolTable, test_cleanup_delay_drain) { + // Fill up the queue + constexpr int symbol_name_length = 30; + char symbol_name[symbol_name_length]; + TempNewSymbol symbols[TempSymbolCleanupDelayer::QueueSize] = {}; + for (uint i = 0; i < TempSymbolCleanupDelayer::QueueSize; i++) { + os::snprintf(symbol_name, symbol_name_length, "temp-%d", i); + TempNewSymbol s = SymbolTable::new_symbol(symbol_name); + symbols[i] = s; + } + + // While in the queue refcounts are incremented + for (uint i = 0; i < TempSymbolCleanupDelayer::QueueSize; i++) { + ASSERT_EQ(symbols[i]->refcount(), 2) << "TempNewSymbol refcount in queue is 2"; + } + + // Draining the queue should decrement the refcounts + TempSymbolCleanupDelayer::drain_queue(); + for (uint i = 0; i < TempSymbolCleanupDelayer::QueueSize; i++) { + ASSERT_EQ(symbols[i]->refcount(), 1) << "TempNewSymbol refcount after drain is 1"; + } +} From 33ab474c65d35570b91bf9821a44f9c6d0345220 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 3 Jun 2024 17:12:05 +0000 Subject: [PATCH 022/329] 8311666: Disabled tests in test/jdk/sun/java2d/marlin Backport-of: b285ed72aebe2d802fa9c071372cea6c09870b9a --- test/jdk/sun/java2d/marlin/ScaleTest.java | 6 +++++- test/jdk/sun/java2d/marlin/StrokeShapeTest.java | 6 ++++++ test/jdk/sun/java2d/marlin/ThinLineTest.java | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/jdk/sun/java2d/marlin/ScaleTest.java b/test/jdk/sun/java2d/marlin/ScaleTest.java index bfd56422ba4..c9778a6477a 100644 --- a/test/jdk/sun/java2d/marlin/ScaleTest.java +++ b/test/jdk/sun/java2d/marlin/ScaleTest.java @@ -21,13 +21,17 @@ * questions. */ +/* @test + * @summary Circle is rendered in C shape + * @bug 6829659 8311666 + */ + import java.awt.*; import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; - public class ScaleTest { public static void main(String[] args) throws Exception { BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); diff --git a/test/jdk/sun/java2d/marlin/StrokeShapeTest.java b/test/jdk/sun/java2d/marlin/StrokeShapeTest.java index 41413bff3e4..bc23f29e15d 100644 --- a/test/jdk/sun/java2d/marlin/StrokeShapeTest.java +++ b/test/jdk/sun/java2d/marlin/StrokeShapeTest.java @@ -20,6 +20,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* @test + * @summary StrokeShapeTest: createStrokedShape() behaves differently + * @bug 6829678 8311666 + */ + import java.awt.*; import java.awt.geom.Ellipse2D; import java.awt.geom.GeneralPath; diff --git a/test/jdk/sun/java2d/marlin/ThinLineTest.java b/test/jdk/sun/java2d/marlin/ThinLineTest.java index a1a033c0bd4..7450f4e421d 100644 --- a/test/jdk/sun/java2d/marlin/ThinLineTest.java +++ b/test/jdk/sun/java2d/marlin/ThinLineTest.java @@ -20,6 +20,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* @test + * @summary ThinLineTest: A line < 1 pixel disappears. + * @bug 6829673 8311666 + */ + import java.awt.*; import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; From 09ad130fd4f40278e8b228853c9a4b662521c01d Mon Sep 17 00:00:00 2001 From: Xiaolong Peng Date: Mon, 3 Jun 2024 18:37:33 +0000 Subject: [PATCH 023/329] 8329134: Reconsider TLAB zapping Backport-of: 5698f7ad29c939b7e52882ace575dd7113bf41de --- src/hotspot/share/gc/shared/memAllocator.cpp | 7 ++----- .../share/gc/shared/threadLocalAllocBuffer.inline.hpp | 10 ++-------- src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp | 7 ++----- .../share/interpreter/zero/bytecodeInterpreter.cpp | 8 +++----- src/hotspot/share/runtime/globals.hpp | 3 +++ 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/hotspot/share/gc/shared/memAllocator.cpp b/src/hotspot/share/gc/shared/memAllocator.cpp index a68a3604a6a..1167a013e2c 100644 --- a/src/hotspot/share/gc/shared/memAllocator.cpp +++ b/src/hotspot/share/gc/shared/memAllocator.cpp @@ -308,18 +308,15 @@ HeapWord* MemAllocator::allocate_inside_tlab_slow(Allocation& allocation) const PTR_FORMAT " min: " SIZE_FORMAT ", desired: " SIZE_FORMAT, p2i(mem), min_tlab_size, new_tlab_size); + // ...and clear or zap just allocated TLAB, if needed. if (ZeroTLAB) { - // ..and clear it. Copy::zero_to_words(mem, allocation._allocated_tlab_size); - } else { - // ...and zap just allocated object. -#ifdef ASSERT + } else if (ZapTLAB) { // Skip mangling the space corresponding to the object header to // ensure that the returned space is not considered parsable by // any concurrent GC thread. size_t hdr_size = oopDesc::header_size(); Copy::fill_to_words(mem + hdr_size, allocation._allocated_tlab_size - hdr_size, badHeapWordVal); -#endif // ASSERT } tlab.fill(mem, mem + _word_size, allocation._allocated_tlab_size); diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp index 3b167d752e7..56762d9e5eb 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp @@ -39,14 +39,8 @@ inline HeapWord* ThreadLocalAllocBuffer::allocate(size_t size) { invariants(); HeapWord* obj = top(); if (pointer_delta(end(), obj) >= size) { - // successful thread-local allocation -#ifdef ASSERT - // Skip mangling the space corresponding to the object header to - // ensure that the returned space is not considered parsable by - // any concurrent GC thread. - size_t hdr_size = oopDesc::header_size(); - Copy::fill_to_words(obj + hdr_size, size - hdr_size, badHeapWordVal); -#endif // ASSERT + // Successful thread-local allocation. + // This addition is safe because we know that top is // at least size below end, so the add can't wrap. set_top(obj + size); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 67ea25d31fa..44443fea52e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -778,18 +778,15 @@ HeapWord* ShenandoahHeap::allocate_from_gclab_slow(Thread* thread, size_t size) assert (size <= actual_size, "allocation should fit"); + // ...and clear or zap just allocated TLAB, if needed. if (ZeroTLAB) { - // ..and clear it. Copy::zero_to_words(gclab_buf, actual_size); - } else { - // ...and zap just allocated object. -#ifdef ASSERT + } else if (ZapTLAB) { // Skip mangling the space corresponding to the object header to // ensure that the returned space is not considered parsable by // any concurrent GC thread. size_t hdr_size = oopDesc::header_size(); Copy::fill_to_words(gclab_buf + hdr_size, actual_size - hdr_size, badHeapWordVal); -#endif // ASSERT } gclab->set_buf(gclab_buf, actual_size); return gclab->allocate(size); diff --git a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp index b93bb30f0c8..3fc57c76903 100644 --- a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp +++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp @@ -1942,11 +1942,9 @@ void BytecodeInterpreter::run(interpreterState istate) { size_t obj_size = ik->size_helper(); HeapWord* result = THREAD->tlab().allocate(obj_size); if (result != NULL) { - // Initialize object field block: - // - if TLAB is pre-zeroed, we can skip this path - // - in debug mode, ThreadLocalAllocBuffer::allocate mangles - // this area, and we still need to initialize it - if (DEBUG_ONLY(true ||) !ZeroTLAB) { + // Initialize object field block. + if (!ZeroTLAB) { + // The TLAB was not pre-zeroed, we need to clear the memory here. size_t hdr_size = oopDesc::header_size(); Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0); } diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 10909a25356..aac0dc88482 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -477,6 +477,9 @@ const intx ObjectAlignmentInBytes = 8; develop(bool, ZapFillerObjects, trueInDebug, \ "Zap filler objects") \ \ + develop(bool, ZapTLAB, trueInDebug, \ + "Zap allocated TLABs") \ + \ product(bool, ExecutingUnitTests, false, \ "Whether the JVM is running unit tests or not") \ \ From 9c89f1cd3a2b9b0f5c1eec58e4ee04b2bedd6ac8 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Tue, 4 Jun 2024 07:53:46 +0000 Subject: [PATCH 024/329] 8320945: problemlist tests failing on latest Windows 11 update Backport-of: ea6e92ed0d6dd3e8c312e523907d776f48293328 --- test/jdk/ProblemList.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index fda4c400b9e..45e41860542 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -599,6 +599,7 @@ java/nio/channels/DatagramChannel/Unref.java 8233437 generic- java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc64 java/nio/channels/DatagramChannel/ManySourcesAndTargets.java 8264385 macosx-aarch64 +java/nio/file/Files/probeContentType/Basic.java 8320943 windows-all ############################################################################ @@ -691,6 +692,7 @@ javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all +javax/swing/JFileChooser/8194044/FileSystemRootTest.java 8320944 windows-all javax/swing/JPopupMenu/6580930/bug6580930.java 7124313 macosx-all javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all From 95432a6576c8f39e7e208168a45c214d7ed5148e Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Tue, 4 Jun 2024 07:54:02 +0000 Subject: [PATCH 025/329] 8322008: Exclude some CDS tests from running with -Xshare:off Reviewed-by: mdoerr Backport-of: 4d32c607a4b496bf2bb09e54167ecbbab5569a0c --- test/hotspot/jtreg/TEST.groups | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 0973fb52cf8..8a5f7a44919 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -53,6 +53,11 @@ hotspot_gc = \ hotspot_runtime = \ runtime +hotspot_runtime_non_cds_mode = \ + runtime \ + -runtime/cds/CheckSharingWithDefaultArchive.java \ + -runtime/cds/appcds/jcmd + hotspot_handshake = \ runtime/handshake From 0fa4d917e066f8506e85d47479ab5ae723bd722c Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Tue, 4 Jun 2024 07:54:24 +0000 Subject: [PATCH 026/329] 8310201: Reduce verbose locale output in -XshowSettings launcher option Backport-of: f6e23ae4519f8eb877ae28a0bfbb4820c9718f91 --- .../classes/sun/launcher/LauncherHelper.java | 18 +++++++++++++----- test/jdk/tools/launcher/Settings.java | 11 +++++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/src/java.base/share/classes/sun/launcher/LauncherHelper.java index 43a98a86869..74c0cef881e 100644 --- a/src/java.base/share/classes/sun/launcher/LauncherHelper.java +++ b/src/java.base/share/classes/sun/launcher/LauncherHelper.java @@ -167,7 +167,7 @@ static void showSettings(boolean printToStderr, String optionFlag, printProperties(); break; case "locale": - printLocale(); + printLocale(false); break; case "security": var opt = opts.length > 2 ? opts[2].trim() : "all"; @@ -181,7 +181,7 @@ static void showSettings(boolean printToStderr, String optionFlag, default: printVmSettings(initialHeapSize, maxHeapSize, stackSize); printProperties(); - printLocale(); + printLocale(true); SecuritySettings.printSecuritySummarySettings(ostream); if (System.getProperty("os.name").contains("Linux")) { printSystemMetrics(); @@ -277,9 +277,15 @@ private static void printPropertyValue(String key, String value) { /* * prints the locale subopt/section */ - private static void printLocale() { + private static void printLocale(boolean summaryMode) { Locale locale = Locale.getDefault(); - ostream.println(LOCALE_SETTINGS); + if (!summaryMode) { + ostream.println(LOCALE_SETTINGS); + } else { + ostream.println("Locale settings summary:"); + ostream.println(INDENT + "Use \"-XshowSettings:locale\" " + + "option for verbose locale settings options"); + } ostream.println(INDENT + "default locale = " + locale.getDisplayName()); ostream.println(INDENT + "default display locale = " + @@ -288,7 +294,9 @@ private static void printLocale() { Locale.getDefault(Category.FORMAT).getDisplayName()); ostream.println(INDENT + "tzdata version = " + ZoneInfoFile.getVersion()); - printLocales(); + if (!summaryMode) { + printLocales(); + } ostream.println(); } diff --git a/test/jdk/tools/launcher/Settings.java b/test/jdk/tools/launcher/Settings.java index 29af50d5c02..36ae06640a1 100644 --- a/test/jdk/tools/launcher/Settings.java +++ b/test/jdk/tools/launcher/Settings.java @@ -25,7 +25,7 @@ /* * @test - * @bug 6994753 7123582 8305950 8281658 + * @bug 6994753 7123582 8305950 8281658 8310201 * @summary tests -XshowSettings options * @modules jdk.compiler * jdk.zipfs @@ -67,6 +67,9 @@ static void checkNotContains(TestResult tr, String str) { private static final String VM_SETTINGS = "VM settings:"; private static final String PROP_SETTINGS = "Property settings:"; private static final String LOCALE_SETTINGS = "Locale settings:"; + private static final String LOCALE_SUMMARY_SETTINGS = + "Locale settings summary:"; + private static final String AVAILABLE_LOCALES = "available locales"; private static final String SEC_PROPS_SETTINGS = "Security properties:"; private static final String SEC_SUMMARY_PROPS_SETTINGS = "Security settings summary:"; @@ -81,7 +84,9 @@ static void checkNotContains(TestResult tr, String str) { static void containsAllOptions(TestResult tr) { checkContains(tr, VM_SETTINGS); checkContains(tr, PROP_SETTINGS); - checkContains(tr, LOCALE_SETTINGS); + checkNotContains(tr, LOCALE_SETTINGS); + checkNotContains(tr, AVAILABLE_LOCALES); + checkContains(tr, LOCALE_SUMMARY_SETTINGS); // no verbose security settings unless "security" used checkNotContains(tr, SEC_PROPS_SETTINGS); checkContains(tr, SEC_SUMMARY_PROPS_SETTINGS); @@ -153,6 +158,8 @@ static void runTestOptionLocale() throws IOException { checkNotContains(tr, VM_SETTINGS); checkNotContains(tr, PROP_SETTINGS); checkContains(tr, LOCALE_SETTINGS); + checkContains(tr, AVAILABLE_LOCALES); + checkNotContains(tr, LOCALE_SUMMARY_SETTINGS); checkContains(tr, TZDATA_SETTINGS); } From 44ade1dba7503421bb4b3515e3ccd9c899fafe8d Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Tue, 4 Jun 2024 07:55:45 +0000 Subject: [PATCH 027/329] 8315804: Open source several Swing JTabbedPane JTextArea JTextField tests Backport-of: 24c3d86f32a2e2d9cb24cd8827ef1f20bb53fead --- .../swing/JTabbedPane/GetComponentAtTest.java | 96 ++++++++++++ .../swing/JTabbedPane/ReplaceCompTab.java | 97 ++++++++++++ .../javax/swing/JTabbedPane/bug4703690.java | 148 ++++++++++++++++++ .../jdk/javax/swing/JTextArea/bug4849868.java | 103 ++++++++++++ .../javax/swing/JTextField/bug4244613.java | 52 ++++++ 5 files changed, 496 insertions(+) create mode 100644 test/jdk/javax/swing/JTabbedPane/GetComponentAtTest.java create mode 100644 test/jdk/javax/swing/JTabbedPane/ReplaceCompTab.java create mode 100644 test/jdk/javax/swing/JTabbedPane/bug4703690.java create mode 100644 test/jdk/javax/swing/JTextArea/bug4849868.java create mode 100644 test/jdk/javax/swing/JTextField/bug4244613.java diff --git a/test/jdk/javax/swing/JTabbedPane/GetComponentAtTest.java b/test/jdk/javax/swing/JTabbedPane/GetComponentAtTest.java new file mode 100644 index 00000000000..ddefd541f40 --- /dev/null +++ b/test/jdk/javax/swing/JTabbedPane/GetComponentAtTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2000, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4122109 + * @summary Ensure SwingUtilities.getDeepestComponentAt() works correctly + * (in this particular case, with JTabbedPane) + * @key headful + * @run main GetComponentAtTest + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Robot; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; + +public class GetComponentAtTest { + static JFrame f; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("GetComponentAtTest"); + JTabbedPane tabbedpane = new JTabbedPane(); + f.getContentPane().add(tabbedpane, BorderLayout.CENTER); + + JPanel panel1 = new JPanel(); + panel1.setName("Panel 1"); + panel1.setLayout(new BorderLayout()); + tabbedpane.add(panel1); + JPanel subPanel = new JPanel(); + subPanel.setName("Sub-Panel"); + subPanel.setBackground(Color.green); + panel1.add(subPanel); // add sub panel to 1st tab + + JPanel panel2 = new JPanel(); + panel2.setName("Panel 2"); + tabbedpane.add(panel2); + + f.setSize(150, 150); + f.setVisible(true); + + robot.delay(1000); + + tabbedpane.setSelectedIndex(1); // display 2nd tab + tabbedpane.invalidate(); + tabbedpane.validate(); + if (SwingUtilities.getDeepestComponentAt(tabbedpane, 50, 50) != panel2) { + throw new RuntimeException("SwingUtilities.getDeepestComponentAt() " + + "returned incorrect component! (1)"); + } + + tabbedpane.setSelectedIndex(0); // display 1st tab + tabbedpane.invalidate(); + tabbedpane.validate(); + if (SwingUtilities.getDeepestComponentAt(tabbedpane, 50, 50) != subPanel) { + throw new RuntimeException("SwingUtilities.getDeepestComponentAt() " + + "returned incorrect component! (2)"); + } + }); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + + } +} diff --git a/test/jdk/javax/swing/JTabbedPane/ReplaceCompTab.java b/test/jdk/javax/swing/JTabbedPane/ReplaceCompTab.java new file mode 100644 index 00000000000..92e9ffeff13 --- /dev/null +++ b/test/jdk/javax/swing/JTabbedPane/ReplaceCompTab.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1999, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4213896 4228439 + * @summary Ensure that inserting a new tab with a component + * where that component already exists as another tab is handled + * properly. The old tab should be removed and the new tab added. + * @key headful + * @run main ReplaceCompTab + */ + +import java.awt.BorderLayout; + +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; + +public class ReplaceCompTab { + static JFrame f; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("ReplaceCompTab"); + JTabbedPane tabbedpane = new JTabbedPane(); + f.getContentPane().add(tabbedpane, BorderLayout.CENTER); + + JPanel comp = new JPanel(); + + // Add first tab + tabbedpane.addTab("First(temp)", comp); + + // Add second tab with same component (should just replace first one) + tabbedpane.insertTab("First", null, comp, "component added next", 0); + + // Check to ensure only a single tab exists + if (tabbedpane.getTabCount() > 1) { + throw new RuntimeException("Only one tab should exist"); + } + // Check to make sure second tab correctly replaced the first + if (!(tabbedpane.getTitleAt(0).equals("First"))) { + throw new RuntimeException("Tab not replaced correctly"); + } + // Check to make sure adding null continues to work + try { + tabbedpane.addTab("Second", null); + } catch (Exception e) { + throw new RuntimeException("Adding first null " + + "component failed:", e); + } + try { + tabbedpane.addTab("Third", null); + } catch (Exception e) { + throw new RuntimeException("Adding subsequent null " + + "component failed: ", e); + } + try { + tabbedpane.setComponentAt(1, new JLabel("Second Component")); + tabbedpane.setComponentAt(2, new JLabel("Third Component")); + } catch (Exception e) { + throw new RuntimeException("Setting null component " + + "to non-null failed: ", e); + } + }); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JTabbedPane/bug4703690.java b/test/jdk/javax/swing/JTabbedPane/bug4703690.java new file mode 100644 index 00000000000..08be30def82 --- /dev/null +++ b/test/jdk/javax/swing/JTabbedPane/bug4703690.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2003, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4703690 + * @summary JTabbedPane should focus proper component at the tab container + * @key headful + * @run main bug4703690 + */ + +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.InputEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; + +public class bug4703690 { + static JFrame frame; + static JTabbedPane tabbedPane; + static JButton one, two; + + static final CountDownLatch focusButtonTwo = new CountDownLatch(1); + static final CountDownLatch switchToTabTwo = new CountDownLatch(1); + static final CountDownLatch focusButtonOne = new CountDownLatch(1); + static Robot robot; + + static Point p; + static Rectangle rect; + + public static void main(String[] args) throws Exception { + bug4703690 test = new bug4703690(); + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("bug4703690"); + + JPanel panel = new JPanel(); + one = new JButton("Button 1"); + panel.add(one); + two = new JButton("Button 2"); + panel.add(two); + + tabbedPane = new JTabbedPane(); + frame.getContentPane().add(tabbedPane); + tabbedPane.addTab("Tab one", panel); + tabbedPane.addTab("Tab two", new JPanel()); + + two.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + focusButtonTwo.countDown(); + } + }); + + tabbedPane.addChangeListener(e -> { + if (tabbedPane.getSelectedIndex() == 1) { + switchToTabTwo.countDown(); + } + }); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + + test.execute(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public void execute() throws Exception { + robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(two::requestFocus); + + if (!focusButtonTwo.await(1, TimeUnit.SECONDS)) { + throw new RuntimeException("Button two didn't receive focus"); + } + + one.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + focusButtonOne.countDown(); + } + }); + + // Switch to tab two + SwingUtilities.invokeAndWait(() -> { + p = tabbedPane.getLocationOnScreen(); + rect = tabbedPane.getBoundsAt(1); + }); + robot.mouseMove(p.x + rect.x + rect.width / 2, + p.y + rect.y + rect.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + if (!switchToTabTwo.await(1, TimeUnit.SECONDS)) { + throw new RuntimeException("Switching to tab two failed"); + } + + // Switch to tab one + SwingUtilities.invokeAndWait(() -> { + p = tabbedPane.getLocationOnScreen(); + rect = tabbedPane.getBoundsAt(0); + }); + robot.mouseMove(p.x + rect.x + rect.width / 2, + p.y + rect.y + rect.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + if (!focusButtonOne.await(1, TimeUnit.SECONDS)) { + throw new RuntimeException("The 'Button 1' button doesn't have focus"); + } + } +} diff --git a/test/jdk/javax/swing/JTextArea/bug4849868.java b/test/jdk/javax/swing/JTextArea/bug4849868.java new file mode 100644 index 00000000000..efd94b46336 --- /dev/null +++ b/test/jdk/javax/swing/JTextArea/bug4849868.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2003, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 4849868 + * @summary Tests if JTextArea.getSelectionEnd works correctly + * @key headful + * @run main bug4849868 + */ + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; + +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class bug4849868 { + + private static volatile boolean passed = false; + + private static JTextArea textArea; + private static JFrame f; + private static Point p; + + private static int end; + private static int len; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); + robot.setAutoWaitForIdle(true); + + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4849868"); + textArea = new JTextArea("1234"); + textArea.setLineWrap(true); + JScrollPane pane = new JScrollPane(textArea, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + f.getContentPane().add(pane); + f.setSize(300, 300); + f.setLocationRelativeTo(null); + f.setVisible(true); + }); + + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> + p = textArea.getLocationOnScreen()); + + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseMove(p.x + 350, p.y); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + end = textArea.getSelectionEnd(); + len = textArea.getDocument().getLength(); + }); + passed = (end <= len); + + System.out.println("end: " + end); + System.out.println("len: " + len); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + + if (!passed) { + throw new RuntimeException("Test failed."); + } + } +} diff --git a/test/jdk/javax/swing/JTextField/bug4244613.java b/test/jdk/javax/swing/JTextField/bug4244613.java new file mode 100644 index 00000000000..6a1a8bb9d23 --- /dev/null +++ b/test/jdk/javax/swing/JTextField/bug4244613.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1999, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4244613 + * @summary Tests that JTextField has setAction(Action) constructor + * @run main bug4244613 + */ + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JTextField; + +public class bug4244613 { + /** Auxilliary class implementing Action + */ + static class NullAction extends AbstractAction { + @Override + public void actionPerformed(ActionEvent e) {} + public Object getValue(String key) { return null; } + public boolean isEnabled() { return false; } + } + + public static void main(String[] args) { + JTextField tf = new JTextField("bug4244613"); + Action action = new NullAction(); + tf.setAction(action); + } +} From b275236fc5b50890ffc7c0470f017913489d3193 Mon Sep 17 00:00:00 2001 From: Oli Gillespie Date: Tue, 4 Jun 2024 08:54:16 +0000 Subject: [PATCH 028/329] 8324648: Avoid NoSuchMethodError when instantiating NativePRNG Backport-of: 69b2674c6861fdb7d9f9cb39e07d50515c73e33a --- .../sun/security/provider/NativePRNG.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/java.base/unix/classes/sun/security/provider/NativePRNG.java b/src/java.base/unix/classes/sun/security/provider/NativePRNG.java index 5bdd85c4f89..a3ebfdf271d 100644 --- a/src/java.base/unix/classes/sun/security/provider/NativePRNG.java +++ b/src/java.base/unix/classes/sun/security/provider/NativePRNG.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,11 +202,13 @@ static boolean isAvailable() { } // constructor, called by the JCA framework - public NativePRNG() { - super(); + public NativePRNG(SecureRandomParameters params) { if (INSTANCE == null) { throw new AssertionError("NativePRNG not available"); } + if (params != null) { + throw new IllegalArgumentException("Unsupported params: " + params.getClass()); + } } // set the seed @@ -250,11 +252,13 @@ static boolean isAvailable() { } // constructor, called by the JCA framework - public Blocking() { - super(); + public Blocking(SecureRandomParameters params) { if (INSTANCE == null) { throw new AssertionError("NativePRNG$Blocking not available"); } + if (params != null) { + throw new IllegalArgumentException("Unsupported params: " + params.getClass()); + } } // set the seed @@ -299,12 +303,14 @@ static boolean isAvailable() { } // constructor, called by the JCA framework - public NonBlocking() { - super(); + public NonBlocking(SecureRandomParameters params) { if (INSTANCE == null) { throw new AssertionError( "NativePRNG$NonBlocking not available"); } + if (params != null) { + throw new IllegalArgumentException("Unsupported params: " + params.getClass()); + } } // set the seed From 05e645e86af1e4933af8819966d57e0d680b5d25 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Tue, 4 Jun 2024 10:41:16 +0000 Subject: [PATCH 029/329] 8322330: JavadocHelperTest.java OOMEs with Parallel GC and ZGC Backport-of: 52c7ff1d81940d6d0d1e3dd7ad0447c80708161c --- .../jdk/internal/shellsupport/doc/JavadocHelperTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/langtools/jdk/internal/shellsupport/doc/JavadocHelperTest.java b/test/langtools/jdk/internal/shellsupport/doc/JavadocHelperTest.java index 48106face35..d8539b8c656 100644 --- a/test/langtools/jdk/internal/shellsupport/doc/JavadocHelperTest.java +++ b/test/langtools/jdk/internal/shellsupport/doc/JavadocHelperTest.java @@ -30,7 +30,7 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/jdk.internal.shellsupport.doc * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask - * @run testng/timeout=900/othervm JavadocHelperTest + * @run testng/timeout=900/othervm -Xmx1024m JavadocHelperTest */ import java.io.IOException; From 44f3dc5925f3e2081348aae6656d028bf8f9c35d Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 5 Jun 2024 07:30:10 +0000 Subject: [PATCH 030/329] 8328561: test java/awt/Robot/ManualInstructions/ManualInstructions.java isn't used Backport-of: bc546c21a59d2481ba86f98d0d653c7691f68d4c --- .../ManualInstructions.java | 328 ------------------ 1 file changed, 328 deletions(-) delete mode 100644 test/jdk/java/awt/Robot/ManualInstructions/ManualInstructions.java diff --git a/test/jdk/java/awt/Robot/ManualInstructions/ManualInstructions.java b/test/jdk/java/awt/Robot/ManualInstructions/ManualInstructions.java deleted file mode 100644 index df842ab841e..00000000000 --- a/test/jdk/java/awt/Robot/ManualInstructions/ManualInstructions.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2008, 2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - test %W% %E% %I%, %G% - @bug 6315717 - @summary manual control over the Robot - @author Andrei Dmitriev : area=awt.robot - @run applet/manual=yesno ManualInstructions.html -*/ - -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import java.util.Timer; -import java.util.TimerTask; - -public class ManualInstructions extends Applet -{ - final static long SEND_DELAY = 1000; - - public static void main(String s[]){ - ManualInstructions mi = new ManualInstructions(); - mi.init(); - mi.start(); - } - - static Robot robot; - Point mouseLocation; //where mouse should be pressed each time - Panel target = new Panel(); - Button pressOn = new Button("press on ..."); - Button releaseOn = new Button("release on ..."); - Button clickOn = new Button("click on ..."); - Choice buttonNumber = new Choice(); - - public void init() - { - try { - robot = new Robot(); - } catch (AWTException ex) { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - this.setLayout (new BorderLayout ()); - - target.setBackground(Color.green); - target.setName("GreenBox");//for the ease of debug - target.setPreferredSize(new Dimension(100, 100)); - String toolkit = Toolkit.getDefaultToolkit().getClass().getName(); - - // on X systems two buttons are reserved for wheel though they are countable by MouseInfo. - int buttonsNumber = toolkit.equals("sun.awt.windows.WToolkit")?MouseInfo.getNumberOfButtons():MouseInfo.getNumberOfButtons()-2; - - for (int i = 0; i < 8; i++){ - buttonNumber.add("BUTTON"+(i+1)+"_MASK"); - } - - pressOn.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e){ - System.out.println("Now pressing : " + (buttonNumber.getSelectedIndex()+1)); - - Timer timer = new Timer(); - TimerTask robotInteraction = new TimerTask(){ - public void run(){ - robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y); - robot.mousePress(getMask(buttonNumber.getSelectedIndex()+1)); - } - }; - timer.schedule(robotInteraction, SEND_DELAY); - } - }); - - releaseOn.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e){ - System.out.println("Now releasing : " + (buttonNumber.getSelectedIndex()+1)); - Timer timer = new Timer(); - TimerTask robotInteraction = new TimerTask(){ - public void run(){ - robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y); - robot.mouseRelease(getMask(buttonNumber.getSelectedIndex()+1)); - } - }; - timer.schedule(robotInteraction, SEND_DELAY); - } - }); - - clickOn.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e){ - System.out.println("Now clicking : " + (buttonNumber.getSelectedIndex()+1)); - Timer timer = new Timer(); - TimerTask robotInteraction = new TimerTask(){ - public void run(){ - robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y); - robot.mousePress(getMask(buttonNumber.getSelectedIndex()+1)); - robot.mouseRelease(getMask(buttonNumber.getSelectedIndex()+1)); - } - }; - timer.schedule(robotInteraction, SEND_DELAY); - } - - }); - target.addMouseListener(new MouseAdapter(){ - public void mousePressed(MouseEvent e){ - Sysout.println(""+e); - } - public void mouseReleased(MouseEvent e){ - Sysout.println(""+e); - } - public void mouseClicked(MouseEvent e){ - Sysout.println(""+e); - } - }); - - String[] instructions = - { - "Do provide an instruction to the robot by", - "choosing the button number to act and ", - "pressing appropriate java.awt.Button on the left.", - "Inspect an output in the TextArea below.", - "Please don't generate non-natural sequences like Release-Release, etc.", - "If you use keyboard be sure that you released the keyboard shortly.", - "If events are generated well press Pass, otherwise Fail." - }; - Sysout.createDialogWithInstructions( instructions ); - - }//End init() - - private int getMask(int button){ - return InputEvent.getMaskForButton(button); - - /* - //this only works for standard buttons and for old JDK builds - int mask = 0; - switch (button){ - case 1: { - mask = InputEvent.BUTTON1_MASK; - break; - } - case 2: { - mask = InputEvent.BUTTON2_MASK; - break; - } - case 3: { - mask = InputEvent.BUTTON3_MASK; - break; - } - } - return mask; - */ - } - - private Point updateTargetLocation() { - return new Point(target.getLocationOnScreen().x + target.getWidth()/2, target.getLocationOnScreen().y + target.getHeight()/2); - } - - public void start () - { - //Get things going. Request focus, set size, et cetera - setSize (200,200); - setVisible(true); - validate(); - Frame f = new Frame ("Set action for Robot here."); - f.setLayout(new FlowLayout()); - f.add(buttonNumber); - f.add(pressOn); - f.add(releaseOn); - f.add(clickOn); - f.add(target); - f.pack(); - f.setVisible(true); - }// start() -}// class - -/* Place other classes related to the test after this line */ - - -/**************************************************** - Standard Test Machinery - DO NOT modify anything below -- it's a standard - chunk of code whose purpose is to make user - interaction uniform, and thereby make it simpler - to read and understand someone else's test. - ****************************************************/ - -/** - This is part of the standard test machinery. - It creates a dialog (with the instructions), and is the interface - for sending text messages to the user. - To print the instructions, send an array of strings to Sysout.createDialog - WithInstructions method. Put one line of instructions per array entry. - To display a message for the tester to see, simply call Sysout.println - with the string to be displayed. - This mimics System.out.println but works within the test harness as well - as standalone. - */ - -class Sysout -{ - private static TestDialog dialog; - - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); - } - - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); - } - -}// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog -{ - - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 120; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("Center", messageText); - - pack(); - - setVisible(true); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - }// while - }// for - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - System.out.println(messageIn); - } - -}// TestDialog class From ce428dc7574bb649e51930ff7c3fac279a74729a Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 5 Jun 2024 07:30:25 +0000 Subject: [PATCH 031/329] 8328234: Remove unused nativeUtils files Backport-of: dec68d7e36a9436468594416272c44a2afbece8d --- .../vmTestbase/nsk/share/NativeUtils.java | 31 ------------- .../nsk/share/native/native_utils.cpp | 43 ------------------- 2 files changed, 74 deletions(-) delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/NativeUtils.java delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.cpp diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/NativeUtils.java b/test/hotspot/jtreg/vmTestbase/nsk/share/NativeUtils.java deleted file mode 100644 index 4fb0db7675d..00000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/NativeUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2006, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package nsk.share; - -public class NativeUtils { - static { - System.loadLibrary("native_utils"); - } - - public static native long getCurrentPID(); -} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.cpp deleted file mode 100644 index 4331eb37286..00000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2006, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -#include - -#if (defined(WIN32) || defined (_WIN32)) -#include -#define getpid _getpid -#define pidType int -#else -#include -#define pidType pid_t -#endif - -#include -#include - -extern "C" { - -JNIEXPORT jlong -JNICALL Java_nsk_share_NativeUtils_getCurrentPID(JNIEnv * jni, jobject jobj) { - return (jlong) getpid(); -} -} From 37436e33f7eb3fd0c3d584673af6de2689b0dead Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 5 Jun 2024 07:30:51 +0000 Subject: [PATCH 032/329] 8328218: Delete test java/awt/Window/FindOwner/FindOwner.html Backport-of: 09439374edec8178fc2a0494bb96a8a24384c2a3 --- .../awt/Window/FindOwner/FindOwnerTest.html | 44 ------- .../awt/Window/FindOwner/FindOwnerTest.java | 110 ------------------ 2 files changed, 154 deletions(-) delete mode 100644 test/jdk/java/awt/Window/FindOwner/FindOwnerTest.html delete mode 100644 test/jdk/java/awt/Window/FindOwner/FindOwnerTest.java diff --git a/test/jdk/java/awt/Window/FindOwner/FindOwnerTest.html b/test/jdk/java/awt/Window/FindOwner/FindOwnerTest.html deleted file mode 100644 index 38846d9285f..00000000000 --- a/test/jdk/java/awt/Window/FindOwner/FindOwnerTest.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Testing Menus - - - - - - diff --git a/test/jdk/java/awt/Window/FindOwner/FindOwnerTest.java b/test/jdk/java/awt/Window/FindOwner/FindOwnerTest.java deleted file mode 100644 index 0d4f0ccd60e..00000000000 --- a/test/jdk/java/awt/Window/FindOwner/FindOwnerTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2015, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @bug 8139227 - @summary Text fields in JPopupMenu structure do not receive focus in hosted - Applets - @author Semyon Sadetsky -*/ - -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -public class FindOwnerTest extends Applet -{ - - private boolean gained; - - public void init() { - super.init(); - } - - @Override - public void start() { - Window owner = SwingUtilities.windowForComponent(this); - - Window window1 = new Window(owner); - window1.setVisible(true); - - Window window2 = new Window(window1); - window2.setFocusable(true); - JTextField field = new JTextField("JTextField"); - field.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - gained = true; - } - - @Override - public void focusLost(FocusEvent e) { - } - }); - window2.setBounds(100, 100, 200, 200); - window2.add(field); - window2.setVisible(true); - - try { - gained = false; - Robot robot = new Robot(); - robot.setAutoDelay(50); - robot.waitForIdle(); - robot.delay(200); - - Point p = field.getLocationOnScreen(); - System.out.println(p); - robot.mouseMove(p.x + 1, p.y + 1); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); - robot.delay(200); - - if (!gained) { - throw new Exception("Focus is not gained upon mouse click"); - } - System.out.println("ok"); - } catch (SecurityException e) { - - JOptionPane optionPane = new JOptionPane( - "You are in the browser so test is manual. Try to " + - "click \"JTextField\" in the opened window then press OK " + - "below", - JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); - JDialog dialog = - optionPane.createDialog(null,"FindOwnerTest instruction"); - dialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); - dialog.setVisible(true); - if (!gained) { - throw new RuntimeException( - "Focus is not gained upon mouse click"); - } - System.out.println("ok"); - } catch (Exception e) { - throw new RuntimeException(e); - } finally { - window1.dispose(); - stop(); - } - } -} From 1cec5b12e57f998ab9e51fa181f6111b6b465e1a Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 5 Jun 2024 08:36:49 +0000 Subject: [PATCH 033/329] 8329126: No native wrappers generated anymore with -XX:-TieredCompilation after JDK-8251462 Backport-of: f2e5808b46a3da6920dd56688c877ee0e2795de6 --- .../share/compiler/compilationPolicy.cpp | 2 +- .../jtreg/compiler/calls/NativeCalls.java | 87 +++++++++++++++++++ .../jtreg/compiler/calls/libNativeCalls.c | 27 ++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/compiler/calls/NativeCalls.java create mode 100644 test/hotspot/jtreg/compiler/calls/libNativeCalls.c diff --git a/src/hotspot/share/compiler/compilationPolicy.cpp b/src/hotspot/share/compiler/compilationPolicy.cpp index 026915246cc..d40a0183415 100644 --- a/src/hotspot/share/compiler/compilationPolicy.cpp +++ b/src/hotspot/share/compiler/compilationPolicy.cpp @@ -1011,7 +1011,7 @@ CompLevel CompilationPolicy::common(const methodHandle& method, CompLevel cur_le if (force_comp_at_level_simple(method)) { next_level = CompLevel_simple; } else { - if (is_trivial(method)) { + if (is_trivial(method) || method->is_native()) { next_level = CompilationModeFlag::disable_intermediate() ? CompLevel_full_optimization : CompLevel_simple; } else { switch(cur_level) { diff --git a/test/hotspot/jtreg/compiler/calls/NativeCalls.java b/test/hotspot/jtreg/compiler/calls/NativeCalls.java new file mode 100644 index 00000000000..64a7acbc117 --- /dev/null +++ b/test/hotspot/jtreg/compiler/calls/NativeCalls.java @@ -0,0 +1,87 @@ +/* + * Copyright Amazon.com Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 8329126 + * @summary check that native methods get compiled + * + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xbatch -XX:-UseOnStackReplacement -XX:+TieredCompilation compiler.calls.NativeCalls + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xbatch -XX:-UseOnStackReplacement -XX:-TieredCompilation compiler.calls.NativeCalls + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xbatch -XX:-UseOnStackReplacement -XX:+TieredCompilation -XX:TieredStopAtLevel=1 compiler.calls.NativeCalls + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xbatch -XX:-UseOnStackReplacement -XX:+TieredCompilation -XX:TieredStopAtLevel=2 compiler.calls.NativeCalls + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xbatch -XX:-UseOnStackReplacement -XX:+TieredCompilation -XX:TieredStopAtLevel=3 compiler.calls.NativeCalls + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xbatch -XX:-UseOnStackReplacement -XX:+TieredCompilation -XX:TieredStopAtLevel=4 compiler.calls.NativeCalls + */ + +package compiler.calls; + +import java.lang.reflect.Method; + +import jdk.test.whitebox.WhiteBox; + +public class NativeCalls { + static Method emptyStaticNativeMethod; + static Method callNativeMethod; + static WhiteBox wb; + static { + init(); + } + static void init() { + System.loadLibrary("NativeCalls"); + wb = WhiteBox.getWhiteBox(); + try { + emptyStaticNativeMethod = NativeCalls.class.getDeclaredMethod("emptyStaticNative"); + callNativeMethod = NativeCalls.class.getDeclaredMethod("callNative"); + } catch (NoSuchMethodException nsme) { + throw new Error("TEST BUG: can't find test method", nsme); + } + } + + native static void emptyStaticNative(); + + static void callNative() { + emptyStaticNative(); + } + + static public void main(String[] args) { + for (int i = 0; i < 20_000; i++) { + callNative(); + } + if (wb.getMethodCompilationLevel(callNativeMethod) > 0) { + if (!wb.isMethodCompiled(emptyStaticNativeMethod)) { + throw new Error("TEST BUG: '" + emptyStaticNativeMethod + "' should be compiled"); + } + } + } +} diff --git a/test/hotspot/jtreg/compiler/calls/libNativeCalls.c b/test/hotspot/jtreg/compiler/calls/libNativeCalls.c new file mode 100644 index 00000000000..6a08dfdacb1 --- /dev/null +++ b/test/hotspot/jtreg/compiler/calls/libNativeCalls.c @@ -0,0 +1,27 @@ +/* + * Copyright Amazon.com Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "jni.h" + +JNIEXPORT +void JNICALL Java_compiler_calls_NativeCalls_emptyStaticNative(JNIEnv* env, jclass jclazz) {} From a9ee8ba486e8c8e99d5a0d4d113a9baa4987d204 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 5 Jun 2024 08:37:15 +0000 Subject: [PATCH 034/329] 8328999: Update GIFlib to 5.2.2 Backport-of: 6969a9e0b2143eee5a7cfa02460a8ab6dfa08cda --- src/java.desktop/share/legal/giflib.md | 26 +- .../native/libsplashscreen/giflib/dgif_lib.c | 755 ++++++++++-------- .../native/libsplashscreen/giflib/gif_err.c | 52 +- .../native/libsplashscreen/giflib/gif_hash.h | 24 +- .../native/libsplashscreen/giflib/gif_lib.h | 213 +++-- .../libsplashscreen/giflib/gif_lib_private.h | 70 +- .../native/libsplashscreen/giflib/gifalloc.c | 255 +++--- .../giflib/openbsd-reallocarray.c | 13 +- 8 files changed, 741 insertions(+), 667 deletions(-) diff --git a/src/java.desktop/share/legal/giflib.md b/src/java.desktop/share/legal/giflib.md index 0be4fb8226e..8b8fde8706d 100644 --- a/src/java.desktop/share/legal/giflib.md +++ b/src/java.desktop/share/legal/giflib.md @@ -1,4 +1,4 @@ -## GIFLIB v5.2.1 +## GIFLIB v5.2.2 ### GIFLIB License ``` @@ -24,7 +24,27 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -https://sourceforge.net/p/giflib/code/ci/master/tree/openbsd-reallocarray.c +tree/README -Copyright (c) 2008 Otto Moerbeek +== Authors == + +Gershon Elber +original giflib code + +Toshio Kuratomi +uncompressed gif writing code +former maintainer + +Eric Raymond +current as well as long time former maintainer of giflib code + +There have been many other contributors; see the attributions in the +version-control history to learn more. + + +tree/openbsd-reallocarray.c + +Copyright (C) 2008 Otto Moerbeek SPDX-License-Identifier: MIT + +``` diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c b/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c index 6ddfb46060d..0b2860b4b50 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c +++ b/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c @@ -34,11 +34,11 @@ SPDX-License-Identifier: MIT *****************************************************************************/ -#include +#include #include #include -#include #include +#include #include #ifdef _WIN32 @@ -55,18 +55,19 @@ SPDX-License-Identifier: MIT /* avoid extra function call in case we use fread (TVT) */ static int InternalRead(GifFileType *gif, GifByteType *buf, int len) { - //fprintf(stderr, "### Read: %d\n", len); - return - (((GifFilePrivateType*)gif->Private)->Read ? - ((GifFilePrivateType*)gif->Private)->Read(gif,buf,len) : - fread(buf,1,len,((GifFilePrivateType*)gif->Private)->File)); + // fprintf(stderr, "### Read: %d\n", len); + return (((GifFilePrivateType *)gif->Private)->Read + ? ((GifFilePrivateType *)gif->Private)->Read(gif, buf, len) + : fread(buf, 1, len, + ((GifFilePrivateType *)gif->Private)->File)); } static int DGifGetWord(GifFileType *GifFile, GifWord *Word); static int DGifSetupDecompress(GifFileType *GifFile); static int DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen); -static int DGifGetPrefixChar(GifPrefixType *Prefix, int Code, int ClearCode); +static int DGifGetPrefixChar(const GifPrefixType *Prefix, int Code, + int ClearCode); static int DGifDecompressInput(GifFileType *GifFile, int *Code); static int DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, GifByteType *NextByte); @@ -76,15 +77,14 @@ static int DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, Returns dynamically allocated GifFileType pointer which serves as the GIF info record. ******************************************************************************/ -GifFileType * -DGifOpenFileName(const char *FileName, int *Error) -{ +GifFileType *DGifOpenFileName(const char *FileName, int *Error) { int FileHandle; GifFileType *GifFile; if ((FileHandle = open(FileName, O_RDONLY)) == -1) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_OPEN_FAILED; + } return NULL; } @@ -97,9 +97,7 @@ DGifOpenFileName(const char *FileName, int *Error) Returns dynamically allocated GifFileType pointer which serves as the GIF info record. ******************************************************************************/ -GifFileType * -DGifOpenFileHandle(int FileHandle, int *Error) -{ +GifFileType *DGifOpenFileHandle(int FileHandle, int *Error) { char Buf[GIF_STAMP_LEN + 1]; GifFileType *GifFile; GifFilePrivateType *Private; @@ -107,13 +105,14 @@ DGifOpenFileHandle(int FileHandle, int *Error) GifFile = (GifFileType *)malloc(sizeof(GifFileType)); if (GifFile == NULL) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NOT_ENOUGH_MEM; + } (void)close(FileHandle); return NULL; } - /*@i1@*/memset(GifFile, '\0', sizeof(GifFileType)); + /*@i1@*/ memset(GifFile, '\0', sizeof(GifFileType)); /* Belt and suspenders, in case the null pointer isn't zero */ GifFile->SavedImages = NULL; @@ -121,35 +120,38 @@ DGifOpenFileHandle(int FileHandle, int *Error) Private = (GifFilePrivateType *)calloc(1, sizeof(GifFilePrivateType)); if (Private == NULL) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NOT_ENOUGH_MEM; + } (void)close(FileHandle); free((char *)GifFile); return NULL; } - /*@i1@*/memset(Private, '\0', sizeof(GifFilePrivateType)); + /*@i1@*/ memset(Private, '\0', sizeof(GifFilePrivateType)); #ifdef _WIN32 - _setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ -#endif /* _WIN32 */ + _setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ +#endif /* _WIN32 */ - f = fdopen(FileHandle, "rb"); /* Make it into a stream: */ + f = fdopen(FileHandle, "rb"); /* Make it into a stream: */ /*@-mustfreeonly@*/ GifFile->Private = (void *)Private; Private->FileHandle = FileHandle; Private->File = f; Private->FileState = FILE_STATE_READ; - Private->Read = NULL; /* don't use alternate input method (TVT) */ - GifFile->UserData = NULL; /* TVT */ + Private->Read = NULL; /* don't use alternate input method (TVT) */ + GifFile->UserData = NULL; /* TVT */ /*@=mustfreeonly@*/ /* Let's see if this is a GIF file: */ /* coverity[check_return] */ - if (InternalRead(GifFile, (unsigned char *)Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { - if (Error != NULL) + if (InternalRead(GifFile, (unsigned char *)Buf, GIF_STAMP_LEN) != + GIF_STAMP_LEN) { + if (Error != NULL) { *Error = D_GIF_ERR_READ_FAILED; + } (void)fclose(f); free((char *)Private); free((char *)GifFile); @@ -159,8 +161,9 @@ DGifOpenFileHandle(int FileHandle, int *Error) /* Check for GIF prefix at start of file */ Buf[GIF_STAMP_LEN] = 0; if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NOT_GIF_FILE; + } (void)fclose(f); free((char *)Private); free((char *)GifFile); @@ -177,7 +180,7 @@ DGifOpenFileHandle(int FileHandle, int *Error) GifFile->Error = 0; /* What version of GIF? */ - Private->gif89 = (Buf[GIF_VERSION_POS] == '9'); + Private->gif89 = (Buf[GIF_VERSION_POS + 1] == '9'); return GifFile; } @@ -185,17 +188,16 @@ DGifOpenFileHandle(int FileHandle, int *Error) /****************************************************************************** GifFileType constructor with user supplied input function (TVT) ******************************************************************************/ -GifFileType * -DGifOpen(void *userData, InputFunc readFunc, int *Error) -{ +GifFileType *DGifOpen(void *userData, InputFunc readFunc, int *Error) { char Buf[GIF_STAMP_LEN + 1]; GifFileType *GifFile; GifFilePrivateType *Private; GifFile = (GifFileType *)malloc(sizeof(GifFileType)); if (GifFile == NULL) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NOT_ENOUGH_MEM; + } return NULL; } @@ -207,26 +209,29 @@ DGifOpen(void *userData, InputFunc readFunc, int *Error) Private = (GifFilePrivateType *)calloc(1, sizeof(GifFilePrivateType)); if (!Private) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NOT_ENOUGH_MEM; + } free((char *)GifFile); return NULL; } - /*@i1@*/memset(Private, '\0', sizeof(GifFilePrivateType)); + /*@i1@*/ memset(Private, '\0', sizeof(GifFilePrivateType)); GifFile->Private = (void *)Private; Private->FileHandle = 0; Private->File = NULL; Private->FileState = FILE_STATE_READ; - Private->Read = readFunc; /* TVT */ - GifFile->UserData = userData; /* TVT */ + Private->Read = readFunc; /* TVT */ + GifFile->UserData = userData; /* TVT */ /* Lets see if this is a GIF file: */ /* coverity[check_return] */ - if (InternalRead(GifFile, (unsigned char *)Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { - if (Error != NULL) + if (InternalRead(GifFile, (unsigned char *)Buf, GIF_STAMP_LEN) != + GIF_STAMP_LEN) { + if (Error != NULL) { *Error = D_GIF_ERR_READ_FAILED; + } free((char *)Private); free((char *)GifFile); return NULL; @@ -235,8 +240,9 @@ DGifOpen(void *userData, InputFunc readFunc, int *Error) /* Check for GIF prefix at start of file */ Buf[GIF_STAMP_LEN] = '\0'; if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NOT_GIF_FILE; + } free((char *)Private); free((char *)GifFile); return NULL; @@ -245,15 +251,16 @@ DGifOpen(void *userData, InputFunc readFunc, int *Error) if (DGifGetScreenDesc(GifFile) == GIF_ERROR) { free((char *)Private); free((char *)GifFile); - if (Error != NULL) + if (Error != NULL) { *Error = D_GIF_ERR_NO_SCRN_DSCR; + } return NULL; } GifFile->Error = 0; /* What version of GIF? */ - Private->gif89 = (Buf[GIF_VERSION_POS] == '9'); + Private->gif89 = (Buf[GIF_VERSION_POS + 1] == '9'); return GifFile; } @@ -262,9 +269,7 @@ DGifOpen(void *userData, InputFunc readFunc, int *Error) This routine should be called before any other DGif calls. Note that this routine is called automatically from DGif file open routines. ******************************************************************************/ -int -DGifGetScreenDesc(GifFileType *GifFile) -{ +int DGifGetScreenDesc(GifFileType *GifFile) { int BitsPerPixel; bool SortFlag; GifByteType Buf[3]; @@ -278,8 +283,9 @@ DGifGetScreenDesc(GifFileType *GifFile) /* Put the screen descriptor into the file: */ if (DGifGetWord(GifFile, &GifFile->SWidth) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->SHeight) == GIF_ERROR) + DGifGetWord(GifFile, &GifFile->SHeight) == GIF_ERROR) { return GIF_ERROR; + } if (InternalRead(GifFile, Buf, 3) != 3) { GifFile->Error = D_GIF_ERR_READ_FAILED; @@ -292,7 +298,7 @@ DGifGetScreenDesc(GifFileType *GifFile) BitsPerPixel = (Buf[0] & 0x07) + 1; GifFile->SBackGroundColor = Buf[1]; GifFile->AspectByte = Buf[2]; - if (Buf[0] & 0x80) { /* Do we have global color map? */ + if (Buf[0] & 0x80) { /* Do we have global color map? */ int i; GifFile->SColorMap = GifMakeMapObject(1 << BitsPerPixel, NULL); @@ -327,23 +333,20 @@ DGifGetScreenDesc(GifFileType *GifFile) return GIF_OK; } -const char * -DGifGetGifVersion(GifFileType *GifFile) -{ - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; +const char *DGifGetGifVersion(GifFileType *GifFile) { + GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - if (Private->gif89) + if (Private->gif89) { return GIF89_STAMP; - else + } else { return GIF87_STAMP; + } } /****************************************************************************** This routine should be called before any attempt to read an image. ******************************************************************************/ -int -DGifGetRecordType(GifFileType *GifFile, GifRecordType* Type) -{ +int DGifGetRecordType(GifFileType *GifFile, GifRecordType *Type) { GifByteType Buf; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; @@ -359,29 +362,27 @@ DGifGetRecordType(GifFileType *GifFile, GifRecordType* Type) return GIF_ERROR; } - //fprintf(stderr, "### DGifGetRecordType: %02x\n", Buf); + // fprintf(stderr, "### DGifGetRecordType: %02x\n", Buf); switch (Buf) { - case DESCRIPTOR_INTRODUCER: - *Type = IMAGE_DESC_RECORD_TYPE; - break; - case EXTENSION_INTRODUCER: - *Type = EXTENSION_RECORD_TYPE; - break; - case TERMINATOR_INTRODUCER: - *Type = TERMINATE_RECORD_TYPE; - break; - default: - *Type = UNDEFINED_RECORD_TYPE; - GifFile->Error = D_GIF_ERR_WRONG_RECORD; - return GIF_ERROR; + case DESCRIPTOR_INTRODUCER: + *Type = IMAGE_DESC_RECORD_TYPE; + break; + case EXTENSION_INTRODUCER: + *Type = EXTENSION_RECORD_TYPE; + break; + case TERMINATOR_INTRODUCER: + *Type = TERMINATE_RECORD_TYPE; + break; + default: + *Type = UNDEFINED_RECORD_TYPE; + GifFile->Error = D_GIF_ERR_WRONG_RECORD; + return GIF_ERROR; } return GIF_OK; } -int -DGifGetImageHeader(GifFileType *GifFile) -{ +int DGifGetImageHeader(GifFileType *GifFile) { unsigned int BitsPerPixel; GifByteType Buf[3]; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; @@ -395,8 +396,9 @@ DGifGetImageHeader(GifFileType *GifFile) if (DGifGetWord(GifFile, &GifFile->Image.Left) == GIF_ERROR || DGifGetWord(GifFile, &GifFile->Image.Top) == GIF_ERROR || DGifGetWord(GifFile, &GifFile->Image.Width) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Height) == GIF_ERROR) + DGifGetWord(GifFile, &GifFile->Image.Height) == GIF_ERROR) { return GIF_ERROR; + } if (InternalRead(GifFile, Buf, 1) != 1) { GifFile->Error = D_GIF_ERR_READ_FAILED; GifFreeMapObject(GifFile->Image.ColorMap); @@ -415,7 +417,8 @@ DGifGetImageHeader(GifFileType *GifFile) if (Buf[0] & 0x80) { unsigned int i; - GifFile->Image.ColorMap = GifMakeMapObject(1 << BitsPerPixel, NULL); + GifFile->Image.ColorMap = + GifMakeMapObject(1 << BitsPerPixel, NULL); if (GifFile->Image.ColorMap == NULL) { GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM; return GIF_ERROR; @@ -436,8 +439,8 @@ DGifGetImageHeader(GifFileType *GifFile) } } - Private->PixelCount = (long)GifFile->Image.Width * - (long)GifFile->Image.Height; + Private->PixelCount = + (long)GifFile->Image.Width * (long)GifFile->Image.Height; /* Reset decompress algorithm parameters. */ return DGifSetupDecompress(GifFile); @@ -447,9 +450,7 @@ DGifGetImageHeader(GifFileType *GifFile) This routine should be called before any attempt to read an image. Note it is assumed the Image desc. header has been read. ******************************************************************************/ -int -DGifGetImageDesc(GifFileType *GifFile) -{ +int DGifGetImageDesc(GifFileType *GifFile) { GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; SavedImage *sp; @@ -464,9 +465,9 @@ DGifGetImageDesc(GifFileType *GifFile) } if (GifFile->SavedImages) { - SavedImage* new_saved_images = - (SavedImage *)reallocarray(GifFile->SavedImages, - (GifFile->ImageCount + 1), sizeof(SavedImage)); + SavedImage *new_saved_images = (SavedImage *)reallocarray( + GifFile->SavedImages, (GifFile->ImageCount + 1), + sizeof(SavedImage)); if (new_saved_images == NULL) { GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM; return GIF_ERROR; @@ -474,7 +475,7 @@ DGifGetImageDesc(GifFileType *GifFile) GifFile->SavedImages = new_saved_images; } else { if ((GifFile->SavedImages = - (SavedImage *) malloc(sizeof(SavedImage))) == NULL) { + (SavedImage *)malloc(sizeof(SavedImage))) == NULL) { GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM; return GIF_ERROR; } @@ -483,9 +484,9 @@ DGifGetImageDesc(GifFileType *GifFile) sp = &GifFile->SavedImages[GifFile->ImageCount]; memcpy(&sp->ImageDesc, &GifFile->Image, sizeof(GifImageDesc)); if (GifFile->Image.ColorMap != NULL) { - sp->ImageDesc.ColorMap = GifMakeMapObject( - GifFile->Image.ColorMap->ColorCount, - GifFile->Image.ColorMap->Colors); + sp->ImageDesc.ColorMap = + GifMakeMapObject(GifFile->Image.ColorMap->ColorCount, + GifFile->Image.ColorMap->Colors); if (sp->ImageDesc.ColorMap == NULL) { GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM; return GIF_ERROR; @@ -493,7 +494,7 @@ DGifGetImageDesc(GifFileType *GifFile) } sp->RasterBits = (unsigned char *)NULL; sp->ExtensionBlockCount = 0; - sp->ExtensionBlocks = (ExtensionBlock *) NULL; + sp->ExtensionBlocks = (ExtensionBlock *)NULL; GifFile->ImageCount++; @@ -503,11 +504,9 @@ DGifGetImageDesc(GifFileType *GifFile) /****************************************************************************** Get one full scanned line (Line) of length LineLen from GIF file. ******************************************************************************/ -int -DGifGetLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) -{ +int DGifGetLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) { GifByteType *Dummy; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; + GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; if (!IS_READABLE(Private)) { /* This file was NOT open for reading: */ @@ -515,8 +514,9 @@ DGifGetLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) return GIF_ERROR; } - if (!LineLen) + if (!LineLen) { LineLen = GifFile->Image.Width; + } if ((Private->PixelCount -= LineLen) > 0xffff0000UL) { GifFile->Error = D_GIF_ERR_DATA_TOO_BIG; @@ -525,56 +525,59 @@ DGifGetLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) if (DGifDecompressLine(GifFile, Line, LineLen) == GIF_OK) { if (Private->PixelCount == 0) { - /* We probably won't be called any more, so let's clean up - * everything before we return: need to flush out all the - * rest of image until an empty block (size 0) + /* We probably won't be called any more, so let's clean + * up everything before we return: need to flush out all + * the rest of image until an empty block (size 0) * detected. We use GetCodeNext. */ - do - if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR) + do { + if (DGifGetCodeNext(GifFile, &Dummy) == + GIF_ERROR) { return GIF_ERROR; - while (Dummy != NULL) ; + } + } while (Dummy != NULL); } return GIF_OK; - } else + } else { return GIF_ERROR; + } } /****************************************************************************** Put one pixel (Pixel) into GIF file. ******************************************************************************/ -int -DGifGetPixel(GifFileType *GifFile, GifPixelType Pixel) -{ +int DGifGetPixel(GifFileType *GifFile, GifPixelType Pixel) { GifByteType *Dummy; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; + GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; if (!IS_READABLE(Private)) { /* This file was NOT open for reading: */ GifFile->Error = D_GIF_ERR_NOT_READABLE; return GIF_ERROR; } - if (--Private->PixelCount > 0xffff0000UL) - { + if (--Private->PixelCount > 0xffff0000UL) { GifFile->Error = D_GIF_ERR_DATA_TOO_BIG; return GIF_ERROR; } if (DGifDecompressLine(GifFile, &Pixel, 1) == GIF_OK) { if (Private->PixelCount == 0) { - /* We probably won't be called any more, so let's clean up - * everything before we return: need to flush out all the - * rest of image until an empty block (size 0) + /* We probably won't be called any more, so let's clean + * up everything before we return: need to flush out all + * the rest of image until an empty block (size 0) * detected. We use GetCodeNext. */ - do - if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR) + do { + if (DGifGetCodeNext(GifFile, &Dummy) == + GIF_ERROR) { return GIF_ERROR; - while (Dummy != NULL) ; + } + } while (Dummy != NULL); } return GIF_OK; - } else + } else { return GIF_ERROR; + } } /****************************************************************************** @@ -584,13 +587,12 @@ DGifGetPixel(GifFileType *GifFile, GifPixelType Pixel) The Extension should NOT be freed by the user (not dynamically allocated). Note it is assumed the Extension description header has been read. ******************************************************************************/ -int -DGifGetExtension(GifFileType *GifFile, int *ExtCode, GifByteType **Extension) -{ +int DGifGetExtension(GifFileType *GifFile, int *ExtCode, + GifByteType **Extension) { GifByteType Buf; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - //fprintf(stderr, "### -> DGifGetExtension:\n"); + // fprintf(stderr, "### -> DGifGetExtension:\n"); if (!IS_READABLE(Private)) { /* This file was NOT open for reading: */ GifFile->Error = D_GIF_ERR_NOT_READABLE; @@ -603,7 +605,8 @@ DGifGetExtension(GifFileType *GifFile, int *ExtCode, GifByteType **Extension) return GIF_ERROR; } *ExtCode = Buf; - //fprintf(stderr, "### <- DGifGetExtension: %02x, about to call next\n", Buf); + // fprintf(stderr, "### <- DGifGetExtension: %02x, about to call + // next\n", Buf); return DGifGetExtensionNext(GifFile, Extension); } @@ -613,30 +616,30 @@ DGifGetExtension(GifFileType *GifFile, int *ExtCode, GifByteType **Extension) routine should be called until NULL Extension is returned. The Extension should NOT be freed by the user (not dynamically allocated). ******************************************************************************/ -int -DGifGetExtensionNext(GifFileType *GifFile, GifByteType ** Extension) -{ +int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **Extension) { GifByteType Buf; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - //fprintf(stderr, "### -> DGifGetExtensionNext\n"); + // fprintf(stderr, "### -> DGifGetExtensionNext\n"); if (InternalRead(GifFile, &Buf, 1) != 1) { GifFile->Error = D_GIF_ERR_READ_FAILED; return GIF_ERROR; } - //fprintf(stderr, "### DGifGetExtensionNext sees %d\n", Buf); + // fprintf(stderr, "### DGifGetExtensionNext sees %d\n", Buf); if (Buf > 0) { - *Extension = Private->Buf; /* Use private unused buffer. */ - (*Extension)[0] = Buf; /* Pascal strings notation (pos. 0 is len.). */ - /* coverity[tainted_data,check_return] */ + *Extension = Private->Buf; /* Use private unused buffer. */ + (*Extension)[0] = + Buf; /* Pascal strings notation (pos. 0 is len.). */ + /* coverity[tainted_data,check_return] */ if (InternalRead(GifFile, &((*Extension)[1]), Buf) != Buf) { GifFile->Error = D_GIF_ERR_READ_FAILED; return GIF_ERROR; } - } else + } else { *Extension = NULL; - //fprintf(stderr, "### <- DGifGetExtensionNext: %p\n", Extension); + } + // fprintf(stderr, "### <- DGifGetExtensionNext: %p\n", Extension); return GIF_OK; } @@ -647,19 +650,20 @@ DGifGetExtensionNext(GifFileType *GifFile, GifByteType ** Extension) int DGifExtensionToGCB(const size_t GifExtensionLength, const GifByteType *GifExtension, - GraphicsControlBlock *GCB) -{ + GraphicsControlBlock *GCB) { if (GifExtensionLength != 4) { return GIF_ERROR; } GCB->DisposalMode = (GifExtension[0] >> 2) & 0x07; GCB->UserInputFlag = (GifExtension[0] & 0x02) != 0; - GCB->DelayTime = UNSIGNED_LITTLE_ENDIAN(GifExtension[1], GifExtension[2]); - if (GifExtension[0] & 0x01) + GCB->DelayTime = + UNSIGNED_LITTLE_ENDIAN(GifExtension[1], GifExtension[2]); + if (GifExtension[0] & 0x01) { GCB->TransparentColor = (int)GifExtension[3]; - else + } else { GCB->TransparentColor = NO_TRANSPARENT_COLOR; + } return GIF_OK; } @@ -668,23 +672,27 @@ int DGifExtensionToGCB(const size_t GifExtensionLength, Extract the Graphics Control Block for a saved image, if it exists. ******************************************************************************/ -int DGifSavedExtensionToGCB(GifFileType *GifFile, - int ImageIndex, GraphicsControlBlock *GCB) -{ +int DGifSavedExtensionToGCB(GifFileType *GifFile, int ImageIndex, + GraphicsControlBlock *GCB) { int i; - if (ImageIndex < 0 || ImageIndex > GifFile->ImageCount - 1) + if (ImageIndex < 0 || ImageIndex > GifFile->ImageCount - 1) { return GIF_ERROR; + } GCB->DisposalMode = DISPOSAL_UNSPECIFIED; GCB->UserInputFlag = false; GCB->DelayTime = 0; GCB->TransparentColor = NO_TRANSPARENT_COLOR; - for (i = 0; i < GifFile->SavedImages[ImageIndex].ExtensionBlockCount; i++) { - ExtensionBlock *ep = &GifFile->SavedImages[ImageIndex].ExtensionBlocks[i]; - if (ep->Function == GRAPHICS_EXT_FUNC_CODE) - return DGifExtensionToGCB(ep->ByteCount, ep->Bytes, GCB); + for (i = 0; i < GifFile->SavedImages[ImageIndex].ExtensionBlockCount; + i++) { + ExtensionBlock *ep = + &GifFile->SavedImages[ImageIndex].ExtensionBlocks[i]; + if (ep->Function == GRAPHICS_EXT_FUNC_CODE) { + return DGifExtensionToGCB(ep->ByteCount, ep->Bytes, + GCB); + } } return GIF_ERROR; @@ -693,13 +701,12 @@ int DGifSavedExtensionToGCB(GifFileType *GifFile, /****************************************************************************** This routine should be called last, to close the GIF file. ******************************************************************************/ -int -DGifCloseFile(GifFileType *GifFile, int *ErrorCode) -{ +int DGifCloseFile(GifFileType *GifFile, int *ErrorCode) { GifFilePrivateType *Private; - if (GifFile == NULL || GifFile->Private == NULL) + if (GifFile == NULL || GifFile->Private == NULL) { return GIF_ERROR; + } if (GifFile->Image.ColorMap) { GifFreeMapObject(GifFile->Image.ColorMap); @@ -716,22 +723,25 @@ DGifCloseFile(GifFileType *GifFile, int *ErrorCode) GifFile->SavedImages = NULL; } - GifFreeExtensions(&GifFile->ExtensionBlockCount, &GifFile->ExtensionBlocks); + GifFreeExtensions(&GifFile->ExtensionBlockCount, + &GifFile->ExtensionBlocks); - Private = (GifFilePrivateType *) GifFile->Private; + Private = (GifFilePrivateType *)GifFile->Private; if (!IS_READABLE(Private)) { /* This file was NOT open for reading: */ - if (ErrorCode != NULL) + if (ErrorCode != NULL) { *ErrorCode = D_GIF_ERR_NOT_READABLE; + } free((char *)GifFile->Private); free(GifFile); return GIF_ERROR; } if (Private->File && (fclose(Private->File) != 0)) { - if (ErrorCode != NULL) + if (ErrorCode != NULL) { *ErrorCode = D_GIF_ERR_CLOSE_FAILED; + } free((char *)GifFile->Private); free(GifFile); return GIF_ERROR; @@ -739,17 +749,16 @@ DGifCloseFile(GifFileType *GifFile, int *ErrorCode) free((char *)GifFile->Private); free(GifFile); - if (ErrorCode != NULL) + if (ErrorCode != NULL) { *ErrorCode = D_GIF_SUCCEEDED; + } return GIF_OK; } /****************************************************************************** Get 2 bytes (word) from the given file: ******************************************************************************/ -static int -DGifGetWord(GifFileType *GifFile, GifWord *Word) -{ +static int DGifGetWord(GifFileType *GifFile, GifWord *Word) { unsigned char c[2]; /* coverity[check_return] */ @@ -769,9 +778,7 @@ DGifGetWord(GifFileType *GifFile, GifWord *Word) to DGifGetCodeNext, until NULL block is returned. The block should NOT be freed by the user (not dynamically allocated). ******************************************************************************/ -int -DGifGetCode(GifFileType *GifFile, int *CodeSize, GifByteType **CodeBlock) -{ +int DGifGetCode(GifFileType *GifFile, int *CodeSize, GifByteType **CodeBlock) { GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; if (!IS_READABLE(Private)) { @@ -790,9 +797,7 @@ DGifGetCode(GifFileType *GifFile, int *CodeSize, GifByteType **CodeBlock) called until NULL block is returned. The block should NOT be freed by the user (not dynamically allocated). ******************************************************************************/ -int -DGifGetCodeNext(GifFileType *GifFile, GifByteType **CodeBlock) -{ +int DGifGetCodeNext(GifFileType *GifFile, GifByteType **CodeBlock) { GifByteType Buf; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; @@ -805,17 +810,19 @@ DGifGetCodeNext(GifFileType *GifFile, GifByteType **CodeBlock) /* coverity[lower_bounds] */ if (Buf > 0) { - *CodeBlock = Private->Buf; /* Use private unused buffer. */ - (*CodeBlock)[0] = Buf; /* Pascal strings notation (pos. 0 is len.). */ - /* coverity[tainted_data] */ + *CodeBlock = Private->Buf; /* Use private unused buffer. */ + (*CodeBlock)[0] = + Buf; /* Pascal strings notation (pos. 0 is len.). */ + /* coverity[tainted_data] */ if (InternalRead(GifFile, &((*CodeBlock)[1]), Buf) != Buf) { GifFile->Error = D_GIF_ERR_READ_FAILED; return GIF_ERROR; } } else { *CodeBlock = NULL; - Private->Buf[0] = 0; /* Make sure the buffer is empty! */ - Private->PixelCount = 0; /* And local info. indicate image read. */ + Private->Buf[0] = 0; /* Make sure the buffer is empty! */ + Private->PixelCount = + 0; /* And local info. indicate image read. */ } return GIF_OK; @@ -824,41 +831,43 @@ DGifGetCodeNext(GifFileType *GifFile, GifByteType **CodeBlock) /****************************************************************************** Setup the LZ decompression for this image: ******************************************************************************/ -static int -DGifSetupDecompress(GifFileType *GifFile) -{ +static int DGifSetupDecompress(GifFileType *GifFile) { int i, BitsPerPixel; GifByteType CodeSize; GifPrefixType *Prefix; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; /* coverity[check_return] */ - if (InternalRead(GifFile, &CodeSize, 1) < 1) { /* Read Code size from file. */ - return GIF_ERROR; /* Failed to read Code size. */ + if (InternalRead(GifFile, &CodeSize, 1) < + 1) { /* Read Code size from file. */ + GifFile->Error = D_GIF_ERR_READ_FAILED; + return GIF_ERROR; /* Failed to read Code size. */ } BitsPerPixel = CodeSize; /* this can only happen on a severely malformed GIF */ if (BitsPerPixel > 8) { - GifFile->Error = D_GIF_ERR_READ_FAILED; /* somewhat bogus error code */ - return GIF_ERROR; /* Failed to read Code size. */ + GifFile->Error = + D_GIF_ERR_READ_FAILED; /* somewhat bogus error code */ + return GIF_ERROR; /* Failed to read Code size. */ } - Private->Buf[0] = 0; /* Input Buffer empty. */ + Private->Buf[0] = 0; /* Input Buffer empty. */ Private->BitsPerPixel = BitsPerPixel; Private->ClearCode = (1 << BitsPerPixel); Private->EOFCode = Private->ClearCode + 1; Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = BitsPerPixel + 1; /* Number of bits per code. */ - Private->MaxCode1 = 1 << Private->RunningBits; /* Max. code + 1. */ - Private->StackPtr = 0; /* No pixels on the pixel stack. */ + Private->RunningBits = BitsPerPixel + 1; /* Number of bits per code. */ + Private->MaxCode1 = 1 << Private->RunningBits; /* Max. code + 1. */ + Private->StackPtr = 0; /* No pixels on the pixel stack. */ Private->LastCode = NO_SUCH_CODE; - Private->CrntShiftState = 0; /* No information in CrntShiftDWord. */ + Private->CrntShiftState = 0; /* No information in CrntShiftDWord. */ Private->CrntShiftDWord = 0; Prefix = Private->Prefix; - for (i = 0; i <= LZ_MAX_CODE; i++) + for (i = 0; i <= LZ_MAX_CODE; i++) { Prefix[i] = NO_SUCH_CODE; + } return GIF_OK; } @@ -869,14 +878,13 @@ DGifSetupDecompress(GifFileType *GifFile) This routine can be called few times (one per scan line, for example), in order the complete the whole image. ******************************************************************************/ -static int -DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) -{ +static int DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, + int LineLen) { int i = 0; int j, CrntCode, EOFCode, ClearCode, CrntPrefix, LastCode, StackPtr; GifByteType *Stack, *Suffix; GifPrefixType *Prefix; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; + GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; StackPtr = Private->StackPtr; Prefix = Private->Prefix; @@ -891,72 +899,88 @@ DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) } if (StackPtr != 0) { - /* Let pop the stack off before continueing to read the GIF file: */ - while (StackPtr != 0 && i < LineLen) + /* Let pop the stack off before continueing to read the GIF + * file: */ + while (StackPtr != 0 && i < LineLen) { Line[i++] = Stack[--StackPtr]; + } } - while (i < LineLen) { /* Decode LineLen items. */ - if (DGifDecompressInput(GifFile, &CrntCode) == GIF_ERROR) + while (i < LineLen) { /* Decode LineLen items. */ + if (DGifDecompressInput(GifFile, &CrntCode) == GIF_ERROR) { return GIF_ERROR; + } if (CrntCode == EOFCode) { - /* Note however that usually we will not be here as we will stop - * decoding as soon as we got all the pixel, or EOF code will - * not be read at all, and DGifGetLine/Pixel clean everything. */ + /* Note however that usually we will not be here as we + * will stop decoding as soon as we got all the pixel, + * or EOF code will not be read at all, and + * DGifGetLine/Pixel clean everything. */ GifFile->Error = D_GIF_ERR_EOF_TOO_SOON; return GIF_ERROR; } else if (CrntCode == ClearCode) { /* We need to start over again: */ - for (j = 0; j <= LZ_MAX_CODE; j++) + for (j = 0; j <= LZ_MAX_CODE; j++) { Prefix[j] = NO_SUCH_CODE; + } Private->RunningCode = Private->EOFCode + 1; Private->RunningBits = Private->BitsPerPixel + 1; Private->MaxCode1 = 1 << Private->RunningBits; LastCode = Private->LastCode = NO_SUCH_CODE; } else { - /* Its regular code - if in pixel range simply add it to output - * stream, otherwise trace to codes linked list until the prefix - * is in pixel range: */ + /* Its regular code - if in pixel range simply add it to + * output stream, otherwise trace to codes linked list + * until the prefix is in pixel range: */ if (CrntCode < ClearCode) { - /* This is simple - its pixel scalar, so add it to output: */ + /* This is simple - its pixel scalar, so add it + * to output: */ Line[i++] = CrntCode; } else { - /* Its a code to needed to be traced: trace the linked list - * until the prefix is a pixel, while pushing the suffix - * pixels on our stack. If we done, pop the stack in reverse - * (thats what stack is good for!) order to output. */ + /* Its a code to needed to be traced: trace the + * linked list until the prefix is a pixel, + * while pushing the suffix pixels on our stack. + * If we done, pop the stack in reverse (thats + * what stack is good for!) order to output. */ if (Prefix[CrntCode] == NO_SUCH_CODE) { CrntPrefix = LastCode; - /* Only allowed if CrntCode is exactly the running code: - * In that case CrntCode = XXXCode, CrntCode or the - * prefix code is last code and the suffix char is - * exactly the prefix of last code! */ - if (CrntCode == Private->RunningCode - 2) { - Suffix[Private->RunningCode - 2] = - Stack[StackPtr++] = DGifGetPrefixChar(Prefix, - LastCode, - ClearCode); + /* Only allowed if CrntCode is exactly + * the running code: In that case + * CrntCode = XXXCode, CrntCode or the + * prefix code is last code and the + * suffix char is exactly the prefix of + * last code! */ + if (CrntCode == + Private->RunningCode - 2) { + Suffix[Private->RunningCode - + 2] = Stack[StackPtr++] = + DGifGetPrefixChar( + Prefix, LastCode, + ClearCode); } else { - Suffix[Private->RunningCode - 2] = - Stack[StackPtr++] = DGifGetPrefixChar(Prefix, - CrntCode, - ClearCode); + Suffix[Private->RunningCode - + 2] = Stack[StackPtr++] = + DGifGetPrefixChar( + Prefix, CrntCode, + ClearCode); } - } else + } else { CrntPrefix = CrntCode; + } - /* Now (if image is O.K.) we should not get a NO_SUCH_CODE - * during the trace. As we might loop forever, in case of - * defective image, we use StackPtr as loop counter and stop - * before overflowing Stack[]. */ + /* Now (if image is O.K.) we should not get a + * NO_SUCH_CODE during the trace. As we might + * loop forever, in case of defective image, we + * use StackPtr as loop counter and stop before + * overflowing Stack[]. */ while (StackPtr < LZ_MAX_CODE && - CrntPrefix > ClearCode && CrntPrefix <= LZ_MAX_CODE) { + CrntPrefix > ClearCode && + CrntPrefix <= LZ_MAX_CODE) { Stack[StackPtr++] = Suffix[CrntPrefix]; CrntPrefix = Prefix[CrntPrefix]; } - if (StackPtr >= LZ_MAX_CODE || CrntPrefix > LZ_MAX_CODE) { + if (StackPtr >= LZ_MAX_CODE || + CrntPrefix > LZ_MAX_CODE) { GifFile->Error = D_GIF_ERR_IMAGE_DEFECT; return GIF_ERROR; } @@ -964,22 +988,29 @@ DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) Stack[StackPtr++] = CrntPrefix; /* Now lets pop all the stack into output: */ - while (StackPtr != 0 && i < LineLen) + while (StackPtr != 0 && i < LineLen) { Line[i++] = Stack[--StackPtr]; + } } - if (LastCode != NO_SUCH_CODE && Private->RunningCode - 2 < (LZ_MAX_CODE+1) && Prefix[Private->RunningCode - 2] == NO_SUCH_CODE) { + if (LastCode != NO_SUCH_CODE && + Private->RunningCode - 2 < (LZ_MAX_CODE + 1) && + Prefix[Private->RunningCode - 2] == NO_SUCH_CODE) { Prefix[Private->RunningCode - 2] = LastCode; if (CrntCode == Private->RunningCode - 2) { - /* Only allowed if CrntCode is exactly the running code: - * In that case CrntCode = XXXCode, CrntCode or the - * prefix code is last code and the suffix char is - * exactly the prefix of last code! */ + /* Only allowed if CrntCode is exactly + * the running code: In that case + * CrntCode = XXXCode, CrntCode or the + * prefix code is last code and the + * suffix char is exactly the prefix of + * last code! */ Suffix[Private->RunningCode - 2] = - DGifGetPrefixChar(Prefix, LastCode, ClearCode); + DGifGetPrefixChar(Prefix, LastCode, + ClearCode); } else { Suffix[Private->RunningCode - 2] = - DGifGetPrefixChar(Prefix, CrntCode, ClearCode); + DGifGetPrefixChar(Prefix, CrntCode, + ClearCode); } } LastCode = CrntCode; @@ -998,9 +1029,8 @@ DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen) If image is defective, we might loop here forever, so we limit the loops to the maximum possible if image O.k. - LZ_MAX_CODE times. ******************************************************************************/ -static int -DGifGetPrefixChar(GifPrefixType *Prefix, int Code, int ClearCode) -{ +static int DGifGetPrefixChar(const GifPrefixType *Prefix, int Code, + int ClearCode) { int i = 0; while (Code > ClearCode && i++ <= LZ_MAX_CODE) { @@ -1016,9 +1046,7 @@ DGifGetPrefixChar(GifPrefixType *Prefix, int Code, int ClearCode) Interface for accessing the LZ codes directly. Set Code to the real code (12bits), or to -1 if EOF code is returned. ******************************************************************************/ -int -DGifGetLZCodes(GifFileType *GifFile, int *Code) -{ +int DGifGetLZCodes(GifFileType *GifFile, int *Code) { GifByteType *CodeBlock; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; @@ -1028,15 +1056,18 @@ DGifGetLZCodes(GifFileType *GifFile, int *Code) return GIF_ERROR; } - if (DGifDecompressInput(GifFile, Code) == GIF_ERROR) + if (DGifDecompressInput(GifFile, Code) == GIF_ERROR) { return GIF_ERROR; + } if (*Code == Private->EOFCode) { - /* Skip rest of codes (hopefully only NULL terminating block): */ + /* Skip rest of codes (hopefully only NULL terminating block): + */ do { - if (DGifGetCodeNext(GifFile, &CodeBlock) == GIF_ERROR) + if (DGifGetCodeNext(GifFile, &CodeBlock) == GIF_ERROR) { return GIF_ERROR; - } while (CodeBlock != NULL) ; + } + } while (CodeBlock != NULL); *Code = -1; } else if (*Code == Private->ClearCode) { @@ -1055,15 +1086,10 @@ DGifGetLZCodes(GifFileType *GifFile, int *Code) 8 bits (bytes) packets, into the real codes. Returns GIF_OK if read successfully. ******************************************************************************/ -static int -DGifDecompressInput(GifFileType *GifFile, int *Code) -{ +static int DGifDecompressInput(GifFileType *GifFile, int *Code) { static const unsigned short CodeMasks[] = { - 0x0000, 0x0001, 0x0003, 0x0007, - 0x000f, 0x001f, 0x003f, 0x007f, - 0x00ff, 0x01ff, 0x03ff, 0x07ff, - 0x0fff - }; + 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, + 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff}; GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; @@ -1077,11 +1103,12 @@ DGifDecompressInput(GifFileType *GifFile, int *Code) while (Private->CrntShiftState < Private->RunningBits) { /* Needs to get more bytes from input stream for next code: */ - if (DGifBufferedInput(GifFile, Private->Buf, &NextByte) == GIF_ERROR) { + if (DGifBufferedInput(GifFile, Private->Buf, &NextByte) == + GIF_ERROR) { return GIF_ERROR; } - Private->CrntShiftDWord |= - ((unsigned long)NextByte) << Private->CrntShiftState; + Private->CrntShiftDWord |= ((unsigned long)NextByte) + << Private->CrntShiftState; Private->CrntShiftState += 8; } *Code = Private->CrntShiftDWord & CodeMasks[Private->RunningBits]; @@ -1109,9 +1136,8 @@ DGifDecompressInput(GifFileType *GifFile, int *Code) The routine returns the next byte from its internal buffer (or read next block in if buffer empty) and returns GIF_OK if succesful. ******************************************************************************/ -static int -DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, GifByteType *NextByte) -{ +static int DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, + GifByteType *NextByte) { if (Buf[0] == 0) { /* Needs to read the next buffer - this one is empty: */ /* coverity[check_return] */ @@ -1120,8 +1146,8 @@ DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, GifByteType *NextByte) return GIF_ERROR; } /* There shouldn't be any empty data blocks here as the LZW spec - * says the LZW termination code should come first. Therefore we - * shouldn't be inside this routine at that point. + * says the LZW termination code should come first. Therefore + * we shouldn't be inside this routine at that point. */ if (Buf[0] == 0) { GifFile->Error = D_GIF_ERR_IMAGE_DEFECT; @@ -1132,7 +1158,7 @@ DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, GifByteType *NextByte) return GIF_ERROR; } *NextByte = Buf[1]; - Buf[1] = 2; /* We use now the second place as last char read! */ + Buf[1] = 2; /* We use now the second place as last char read! */ Buf[0]--; } else { *NextByte = Buf[Buf[1]++]; @@ -1142,14 +1168,32 @@ DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, GifByteType *NextByte) return GIF_OK; } +/****************************************************************************** + This routine is called in case of error during parsing image. We need to + decrease image counter and reallocate memory for saved images. Not decreasing + ImageCount may lead to null pointer dereference, because the last element in + SavedImages may point to the spoilt image and null pointer buffers. +*******************************************************************************/ +void DGifDecreaseImageCounter(GifFileType *GifFile) { + GifFile->ImageCount--; + if (GifFile->SavedImages[GifFile->ImageCount].RasterBits != NULL) { + free(GifFile->SavedImages[GifFile->ImageCount].RasterBits); + } + + // Realloc array according to the new image counter. + SavedImage *correct_saved_images = (SavedImage *)reallocarray( + GifFile->SavedImages, GifFile->ImageCount, sizeof(SavedImage)); + if (correct_saved_images != NULL) { + GifFile->SavedImages = correct_saved_images; + } +} + /****************************************************************************** This routine reads an entire GIF into core, hanging all its state info off the GifFileType pointer. Call DGifOpenFileName() or DGifOpenFileHandle() first to initialize I/O. Its inverse is EGifSpew(). *******************************************************************************/ -int -DGifSlurp(GifFileType *GifFile) -{ +int DGifSlurp(GifFileType *GifFile) { size_t ImageSize; GifRecordType RecordType; SavedImage *sp; @@ -1160,103 +1204,130 @@ DGifSlurp(GifFileType *GifFile) GifFile->ExtensionBlockCount = 0; do { - if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) + if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) { return (GIF_ERROR); + } switch (RecordType) { - case IMAGE_DESC_RECORD_TYPE: - if (DGifGetImageDesc(GifFile) == GIF_ERROR) - return (GIF_ERROR); - - sp = &GifFile->SavedImages[GifFile->ImageCount - 1]; - /* Allocate memory for the image */ - if (sp->ImageDesc.Width <= 0 || sp->ImageDesc.Height <= 0 || - sp->ImageDesc.Width > (INT_MAX / sp->ImageDesc.Height)) { - return GIF_ERROR; - } - ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height; - - if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) { - return GIF_ERROR; - } - sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize, - sizeof(GifPixelType)); - - if (sp->RasterBits == NULL) { - return GIF_ERROR; - } - - if (sp->ImageDesc.Interlace) { - int i, j; - /* - * The way an interlaced image should be read - - * offsets and jumps... - */ - int InterlacedOffset[] = { 0, 4, 2, 1 }; - int InterlacedJumps[] = { 8, 8, 4, 2 }; - /* Need to perform 4 passes on the image */ - for (i = 0; i < 4; i++) - for (j = InterlacedOffset[i]; - j < sp->ImageDesc.Height; - j += InterlacedJumps[i]) { - if (DGifGetLine(GifFile, - sp->RasterBits+j*sp->ImageDesc.Width, - sp->ImageDesc.Width) == GIF_ERROR) - return GIF_ERROR; - } - } - else { - if (DGifGetLine(GifFile,sp->RasterBits,ImageSize)==GIF_ERROR) - return (GIF_ERROR); - } - - if (GifFile->ExtensionBlocks) { - sp->ExtensionBlocks = GifFile->ExtensionBlocks; - sp->ExtensionBlockCount = GifFile->ExtensionBlockCount; - - GifFile->ExtensionBlocks = NULL; - GifFile->ExtensionBlockCount = 0; - } - break; - - case EXTENSION_RECORD_TYPE: - if (DGifGetExtension(GifFile,&ExtFunction,&ExtData) == GIF_ERROR) - return (GIF_ERROR); - /* Create an extension block with our data */ - if (ExtData != NULL) { - if (GifAddExtensionBlock(&GifFile->ExtensionBlockCount, - &GifFile->ExtensionBlocks, - ExtFunction, ExtData[0], &ExtData[1]) - == GIF_ERROR) - return (GIF_ERROR); - } - for (;;) { - if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) - return (GIF_ERROR); - if (ExtData == NULL) - break; - /* Continue the extension block */ - if (ExtData != NULL) - if (GifAddExtensionBlock(&GifFile->ExtensionBlockCount, - &GifFile->ExtensionBlocks, - CONTINUE_EXT_FUNC_CODE, - ExtData[0], &ExtData[1]) == GIF_ERROR) - return (GIF_ERROR); - } - break; - - case TERMINATE_RECORD_TYPE: - break; - - default: /* Should be trapped by DGifGetRecordType */ - break; + case IMAGE_DESC_RECORD_TYPE: + if (DGifGetImageDesc(GifFile) == GIF_ERROR) { + return (GIF_ERROR); + } + + sp = &GifFile->SavedImages[GifFile->ImageCount - 1]; + /* Allocate memory for the image */ + if (sp->ImageDesc.Width <= 0 || + sp->ImageDesc.Height <= 0 || + sp->ImageDesc.Width > + (INT_MAX / sp->ImageDesc.Height)) { + DGifDecreaseImageCounter(GifFile); + return GIF_ERROR; + } + ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height; + + if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) { + DGifDecreaseImageCounter(GifFile); + return GIF_ERROR; + } + sp->RasterBits = (unsigned char *)reallocarray( + NULL, ImageSize, sizeof(GifPixelType)); + + if (sp->RasterBits == NULL) { + DGifDecreaseImageCounter(GifFile); + return GIF_ERROR; + } + + if (sp->ImageDesc.Interlace) { + int i, j; + /* + * The way an interlaced image should be read - + * offsets and jumps... + */ + static const int InterlacedOffset[] = {0, 4, 2, + 1}; + static const int InterlacedJumps[] = {8, 8, 4, + 2}; + /* Need to perform 4 passes on the image */ + for (i = 0; i < 4; i++) { + for (j = InterlacedOffset[i]; + j < sp->ImageDesc.Height; + j += InterlacedJumps[i]) { + if (DGifGetLine( + GifFile, + sp->RasterBits + + j * sp->ImageDesc + .Width, + sp->ImageDesc.Width) == + GIF_ERROR) { + DGifDecreaseImageCounter( + GifFile); + return GIF_ERROR; + } + } + } + } else { + if (DGifGetLine(GifFile, sp->RasterBits, + ImageSize) == GIF_ERROR) { + DGifDecreaseImageCounter(GifFile); + return GIF_ERROR; + } + } + + if (GifFile->ExtensionBlocks) { + sp->ExtensionBlocks = GifFile->ExtensionBlocks; + sp->ExtensionBlockCount = + GifFile->ExtensionBlockCount; + + GifFile->ExtensionBlocks = NULL; + GifFile->ExtensionBlockCount = 0; + } + break; + + case EXTENSION_RECORD_TYPE: + if (DGifGetExtension(GifFile, &ExtFunction, &ExtData) == + GIF_ERROR) { + return (GIF_ERROR); + } + /* Create an extension block with our data */ + if (ExtData != NULL) { + if (GifAddExtensionBlock( + &GifFile->ExtensionBlockCount, + &GifFile->ExtensionBlocks, ExtFunction, + ExtData[0], &ExtData[1]) == GIF_ERROR) { + return (GIF_ERROR); + } + } + for (;;) { + if (DGifGetExtensionNext(GifFile, &ExtData) == + GIF_ERROR) { + return (GIF_ERROR); + } + if (ExtData == NULL) { + break; + } + /* Continue the extension block */ + if (GifAddExtensionBlock( + &GifFile->ExtensionBlockCount, + &GifFile->ExtensionBlocks, + CONTINUE_EXT_FUNC_CODE, ExtData[0], + &ExtData[1]) == GIF_ERROR) { + return (GIF_ERROR); + } + } + break; + + case TERMINATE_RECORD_TYPE: + break; + + default: /* Should be trapped by DGifGetRecordType */ + break; } } while (RecordType != TERMINATE_RECORD_TYPE); /* Sanity check for corrupted file */ if (GifFile->ImageCount == 0) { GifFile->Error = D_GIF_ERR_NO_IMAG_DSCR; - return(GIF_ERROR); + return (GIF_ERROR); } return (GIF_OK); diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gif_err.c b/src/java.desktop/share/native/libsplashscreen/giflib/gif_err.c index db08838efff..3b6785f7c63 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gif_err.c +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gif_err.c @@ -38,82 +38,80 @@ SPDX-License-Identifier: MIT /***************************************************************************** Return a string description of the last GIF error *****************************************************************************/ -const char * -GifErrorString(int ErrorCode) -{ +const char *GifErrorString(int ErrorCode) { const char *Err; switch (ErrorCode) { - case E_GIF_ERR_OPEN_FAILED: + case E_GIF_ERR_OPEN_FAILED: Err = "Failed to open given file"; break; - case E_GIF_ERR_WRITE_FAILED: + case E_GIF_ERR_WRITE_FAILED: Err = "Failed to write to given file"; break; - case E_GIF_ERR_HAS_SCRN_DSCR: + case E_GIF_ERR_HAS_SCRN_DSCR: Err = "Screen descriptor has already been set"; break; - case E_GIF_ERR_HAS_IMAG_DSCR: + case E_GIF_ERR_HAS_IMAG_DSCR: Err = "Image descriptor is still active"; break; - case E_GIF_ERR_NO_COLOR_MAP: + case E_GIF_ERR_NO_COLOR_MAP: Err = "Neither global nor local color map"; break; - case E_GIF_ERR_DATA_TOO_BIG: + case E_GIF_ERR_DATA_TOO_BIG: Err = "Number of pixels bigger than width * height"; break; - case E_GIF_ERR_NOT_ENOUGH_MEM: + case E_GIF_ERR_NOT_ENOUGH_MEM: Err = "Failed to allocate required memory"; break; - case E_GIF_ERR_DISK_IS_FULL: + case E_GIF_ERR_DISK_IS_FULL: Err = "Write failed (disk full?)"; break; - case E_GIF_ERR_CLOSE_FAILED: + case E_GIF_ERR_CLOSE_FAILED: Err = "Failed to close given file"; break; - case E_GIF_ERR_NOT_WRITEABLE: + case E_GIF_ERR_NOT_WRITEABLE: Err = "Given file was not opened for write"; break; - case D_GIF_ERR_OPEN_FAILED: + case D_GIF_ERR_OPEN_FAILED: Err = "Failed to open given file"; break; - case D_GIF_ERR_READ_FAILED: + case D_GIF_ERR_READ_FAILED: Err = "Failed to read from given file"; break; - case D_GIF_ERR_NOT_GIF_FILE: + case D_GIF_ERR_NOT_GIF_FILE: Err = "Data is not in GIF format"; break; - case D_GIF_ERR_NO_SCRN_DSCR: + case D_GIF_ERR_NO_SCRN_DSCR: Err = "No screen descriptor detected"; break; - case D_GIF_ERR_NO_IMAG_DSCR: + case D_GIF_ERR_NO_IMAG_DSCR: Err = "No Image Descriptor detected"; break; - case D_GIF_ERR_NO_COLOR_MAP: + case D_GIF_ERR_NO_COLOR_MAP: Err = "Neither global nor local color map"; break; - case D_GIF_ERR_WRONG_RECORD: + case D_GIF_ERR_WRONG_RECORD: Err = "Wrong record type detected"; break; - case D_GIF_ERR_DATA_TOO_BIG: + case D_GIF_ERR_DATA_TOO_BIG: Err = "Number of pixels bigger than width * height"; break; - case D_GIF_ERR_NOT_ENOUGH_MEM: + case D_GIF_ERR_NOT_ENOUGH_MEM: Err = "Failed to allocate required memory"; break; - case D_GIF_ERR_CLOSE_FAILED: + case D_GIF_ERR_CLOSE_FAILED: Err = "Failed to close given file"; break; - case D_GIF_ERR_NOT_READABLE: + case D_GIF_ERR_NOT_READABLE: Err = "Given file was not opened for read"; break; - case D_GIF_ERR_IMAGE_DEFECT: + case D_GIF_ERR_IMAGE_DEFECT: Err = "Image is defective, decoding aborted"; break; - case D_GIF_ERR_EOF_TOO_SOON: + case D_GIF_ERR_EOF_TOO_SOON: Err = "Image EOF detected before image complete"; break; - default: + default: Err = NULL; break; } diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gif_hash.h b/src/java.desktop/share/native/libsplashscreen/giflib/gif_hash.h index 6cabd0866ed..bd00af64161 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gif_hash.h +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gif_hash.h @@ -33,27 +33,25 @@ SPDX-License-Identifier: MIT #ifndef _GIF_HASH_H_ #define _GIF_HASH_H_ -/** Begin JDK modifications to support building on Windows **/ #ifndef _WIN32 #include -#endif -/** End JDK modifications to support building on Windows **/ +#endif /* _WIN32 */ #include -#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ -#define HT_KEY_MASK 0x1FFF /* 13bits keys */ -#define HT_KEY_NUM_BITS 13 /* 13bits keys */ -#define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */ -#define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ +#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ +#define HT_KEY_MASK 0x1FFF /* 13bits keys */ +#define HT_KEY_NUM_BITS 13 /* 13bits keys */ +#define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */ +#define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ /* The 32 bits of the long are divided into two parts for the key & code: */ /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */ -/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */ +/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */ /* The key is the upper 20 bits. The code is the lower 12. */ -#define HT_GET_KEY(l) (l >> 12) -#define HT_GET_CODE(l) (l & 0x0FFF) -#define HT_PUT_KEY(l) (l << 12) -#define HT_PUT_CODE(l) (l & 0x0FFF) +#define HT_GET_KEY(l) (l >> 12) +#define HT_GET_CODE(l) (l & 0x0FFF) +#define HT_PUT_KEY(l) (l << 12) +#define HT_PUT_CODE(l) (l & 0x0FFF) typedef struct GifHashTableType { uint32_t HTable[HT_SIZE]; diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h b/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h index f739b36adfd..74a2e969c0d 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h @@ -39,27 +39,19 @@ extern "C" { #define GIFLIB_MAJOR 5 #define GIFLIB_MINOR 2 -#define GIFLIB_RELEASE 1 +#define GIFLIB_RELEASE 2 -#define GIF_ERROR 0 -#define GIF_OK 1 +#define GIF_ERROR 0 +#define GIF_OK 1 +#include #include -/** Begin JDK modifications to support building using old compilers**/ -//#include -#ifdef bool -#undef bool -#endif -typedef int bool; -#define false 0 -#define true 1 -/** End JDK modifications to support building using old compilers**/ - -#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */ + +#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */ #define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1 -#define GIF_VERSION_POS 3 /* Version first character in stamp. */ -#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */ -#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */ +#define GIF_VERSION_POS 3 /* Version first character in stamp. */ +#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */ +#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */ typedef unsigned char GifPixelType; typedef unsigned char *GifRowType; @@ -75,24 +67,24 @@ typedef struct ColorMapObject { int ColorCount; int BitsPerPixel; bool SortFlag; - GifColorType *Colors; /* on malloc(3) heap */ + GifColorType *Colors; /* on malloc(3) heap */ } ColorMapObject; typedef struct GifImageDesc { - GifWord Left, Top, Width, Height; /* Current image dimensions. */ - bool Interlace; /* Sequential/Interlaced lines. */ - ColorMapObject *ColorMap; /* The local color map */ + GifWord Left, Top, Width, Height; /* Current image dimensions. */ + bool Interlace; /* Sequential/Interlaced lines. */ + ColorMapObject *ColorMap; /* The local color map */ } GifImageDesc; typedef struct ExtensionBlock { int ByteCount; - GifByteType *Bytes; /* on malloc(3) heap */ - int Function; /* The block function code */ -#define CONTINUE_EXT_FUNC_CODE 0x00 /* continuation subblock */ -#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */ -#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control (GIF89) */ -#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */ -#define APPLICATION_EXT_FUNC_CODE 0xff /* application block (GIF89) */ + GifByteType *Bytes; /* on malloc(3) heap */ + int Function; /* The block function code */ +#define CONTINUE_EXT_FUNC_CODE 0x00 /* continuation subblock */ +#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */ +#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control (GIF89) */ +#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */ +#define APPLICATION_EXT_FUNC_CODE 0xff /* application block (GIF89) */ } ExtensionBlock; typedef struct SavedImage { @@ -103,22 +95,22 @@ typedef struct SavedImage { } SavedImage; typedef struct GifFileType { - GifWord SWidth, SHeight; /* Size of virtual canvas */ - GifWord SColorResolution; /* How many colors can we generate? */ - GifWord SBackGroundColor; /* Background color for virtual canvas */ - GifByteType AspectByte; /* Used to compute pixel aspect ratio */ - ColorMapObject *SColorMap; /* Global colormap, NULL if nonexistent. */ - int ImageCount; /* Number of current image (both APIs) */ - GifImageDesc Image; /* Current image (low-level API) */ - SavedImage *SavedImages; /* Image sequence (high-level API) */ - int ExtensionBlockCount; /* Count extensions past last image */ + GifWord SWidth, SHeight; /* Size of virtual canvas */ + GifWord SColorResolution; /* How many colors can we generate? */ + GifWord SBackGroundColor; /* Background color for virtual canvas */ + GifByteType AspectByte; /* Used to compute pixel aspect ratio */ + ColorMapObject *SColorMap; /* Global colormap, NULL if nonexistent. */ + int ImageCount; /* Number of current image (both APIs) */ + GifImageDesc Image; /* Current image (low-level API) */ + SavedImage *SavedImages; /* Image sequence (high-level API) */ + int ExtensionBlockCount; /* Count extensions past last image */ ExtensionBlock *ExtensionBlocks; /* Extensions past last image */ int Error; /* Last error condition reported */ void *UserData; /* hook to attach user data (TVT) */ void *Private; /* Don't mess with this! */ } GifFileType; -#define GIF_ASPECT_RATIO(n) ((n)+15.0/64.0) +#define GIF_ASPECT_RATIO(n) ((n) + 15.0 / 64.0) typedef enum { UNDEFINED_RECORD_TYPE, @@ -129,12 +121,12 @@ typedef enum { } GifRecordType; /* func type to read gif data from arbitrary sources (TVT) */ -typedef int (*InputFunc) (GifFileType *, GifByteType *, int); +typedef int (*InputFunc)(GifFileType *, GifByteType *, int); /* func type to write gif data to arbitrary targets. * Returns count of bytes written. (MRB) */ -typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int); +typedef int (*OutputFunc)(GifFileType *, const GifByteType *, int); /****************************************************************************** GIF89 structures @@ -142,14 +134,14 @@ typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int); typedef struct GraphicsControlBlock { int DisposalMode; -#define DISPOSAL_UNSPECIFIED 0 /* No disposal specified. */ -#define DISPOSE_DO_NOT 1 /* Leave image in place */ -#define DISPOSE_BACKGROUND 2 /* Set area too background color */ -#define DISPOSE_PREVIOUS 3 /* Restore to previous content */ - bool UserInputFlag; /* User confirmation required before disposal */ - int DelayTime; /* pre-display delay in 0.01sec units */ - int TransparentColor; /* Palette index for transparency, -1 if none */ -#define NO_TRANSPARENT_COLOR -1 +#define DISPOSAL_UNSPECIFIED 0 /* No disposal specified. */ +#define DISPOSE_DO_NOT 1 /* Leave image in place */ +#define DISPOSE_BACKGROUND 2 /* Set area too background color */ +#define DISPOSE_PREVIOUS 3 /* Restore to previous content */ + bool UserInputFlag; /* User confirmation required before disposal */ + int DelayTime; /* pre-display delay in 0.01sec units */ + int TransparentColor; /* Palette index for transparency, -1 if none */ +#define NO_TRANSPARENT_COLOR -1 } GraphicsControlBlock; /****************************************************************************** @@ -161,49 +153,44 @@ GifFileType *EGifOpenFileName(const char *GifFileName, const bool GifTestExistence, int *Error); GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); -int EGifSpew(GifFileType * GifFile); +int EGifSpew(GifFileType *GifFile); const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); -#define E_GIF_SUCCEEDED 0 -#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ -#define E_GIF_ERR_WRITE_FAILED 2 -#define E_GIF_ERR_HAS_SCRN_DSCR 3 -#define E_GIF_ERR_HAS_IMAG_DSCR 4 -#define E_GIF_ERR_NO_COLOR_MAP 5 -#define E_GIF_ERR_DATA_TOO_BIG 6 +#define E_GIF_SUCCEEDED 0 +#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ +#define E_GIF_ERR_WRITE_FAILED 2 +#define E_GIF_ERR_HAS_SCRN_DSCR 3 +#define E_GIF_ERR_HAS_IMAG_DSCR 4 +#define E_GIF_ERR_NO_COLOR_MAP 5 +#define E_GIF_ERR_DATA_TOO_BIG 6 #define E_GIF_ERR_NOT_ENOUGH_MEM 7 -#define E_GIF_ERR_DISK_IS_FULL 8 -#define E_GIF_ERR_CLOSE_FAILED 9 -#define E_GIF_ERR_NOT_WRITEABLE 10 +#define E_GIF_ERR_DISK_IS_FULL 8 +#define E_GIF_ERR_CLOSE_FAILED 9 +#define E_GIF_ERR_NOT_WRITEABLE 10 /* These are legacy. You probably do not want to call them directly */ -int EGifPutScreenDesc(GifFileType *GifFile, - const int GifWidth, const int GifHeight, - const int GifColorRes, +int EGifPutScreenDesc(GifFileType *GifFile, const int GifWidth, + const int GifHeight, const int GifColorRes, const int GifBackGround, const ColorMapObject *GifColorMap); -int EGifPutImageDesc(GifFileType *GifFile, - const int GifLeft, const int GifTop, +int EGifPutImageDesc(GifFileType *GifFile, const int GifLeft, const int GifTop, const int GifWidth, const int GifHeight, const bool GifInterlace, const ColorMapObject *GifColorMap); void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); -int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, - int GifLineLen); +int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); int EGifPutComment(GifFileType *GifFile, const char *GifComment); int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); -int EGifPutExtensionBlock(GifFileType *GifFile, - const int GifExtLen, const void *GifExtension); +int EGifPutExtensionBlock(GifFileType *GifFile, const int GifExtLen, + const void *GifExtension); int EGifPutExtensionTrailer(GifFileType *GifFile); int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, - const int GifExtLen, - const void *GifExtension); + const int GifExtLen, const void *GifExtension); int EGifPutCode(GifFileType *GifFile, int GifCodeSize, const GifByteType *GifCodeBlock); -int EGifPutCodeNext(GifFileType *GifFile, - const GifByteType *GifCodeBlock); +int EGifPutCodeNext(GifFileType *GifFile, const GifByteType *GifCodeBlock); /****************************************************************************** GIF decoding routines @@ -212,24 +199,25 @@ int EGifPutCodeNext(GifFileType *GifFile, /* Main entry points */ GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); -int DGifSlurp(GifFileType * GifFile); -GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ - int DGifCloseFile(GifFileType * GifFile, int *ErrorCode); - -#define D_GIF_SUCCEEDED 0 -#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ -#define D_GIF_ERR_READ_FAILED 102 -#define D_GIF_ERR_NOT_GIF_FILE 103 -#define D_GIF_ERR_NO_SCRN_DSCR 104 -#define D_GIF_ERR_NO_IMAG_DSCR 105 -#define D_GIF_ERR_NO_COLOR_MAP 106 -#define D_GIF_ERR_WRONG_RECORD 107 -#define D_GIF_ERR_DATA_TOO_BIG 108 +int DGifSlurp(GifFileType *GifFile); +GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, + int *Error); /* new one (TVT) */ +int DGifCloseFile(GifFileType *GifFile, int *ErrorCode); + +#define D_GIF_SUCCEEDED 0 +#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ +#define D_GIF_ERR_READ_FAILED 102 +#define D_GIF_ERR_NOT_GIF_FILE 103 +#define D_GIF_ERR_NO_SCRN_DSCR 104 +#define D_GIF_ERR_NO_IMAG_DSCR 105 +#define D_GIF_ERR_NO_COLOR_MAP 106 +#define D_GIF_ERR_WRONG_RECORD 107 +#define D_GIF_ERR_DATA_TOO_BIG 108 #define D_GIF_ERR_NOT_ENOUGH_MEM 109 -#define D_GIF_ERR_CLOSE_FAILED 110 -#define D_GIF_ERR_NOT_READABLE 111 -#define D_GIF_ERR_IMAGE_DEFECT 112 -#define D_GIF_ERR_EOF_TOO_SOON 113 +#define D_GIF_ERR_CLOSE_FAILED 110 +#define D_GIF_ERR_NOT_READABLE 111 +#define D_GIF_ERR_IMAGE_DEFECT 112 +#define D_GIF_ERR_EOF_TOO_SOON 113 /* These are legacy. You probably do not want to call them directly */ int DGifGetScreenDesc(GifFileType *GifFile); @@ -247,11 +235,10 @@ int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); const char *DGifGetGifVersion(GifFileType *GifFile); - /****************************************************************************** Error handling and reporting. ******************************************************************************/ -extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ +extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ /***************************************************************************** Everything below this point is new after version 1.2, supporting `slurp @@ -263,26 +250,26 @@ extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ ******************************************************************************/ extern ColorMapObject *GifMakeMapObject(int ColorCount, - const GifColorType *ColorMap); + const GifColorType *ColorMap); extern void GifFreeMapObject(ColorMapObject *Object); extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, - const ColorMapObject *ColorIn2, - GifPixelType ColorTransIn2[]); + const ColorMapObject *ColorIn2, + GifPixelType ColorTransIn2[]); extern int GifBitSize(int n); /****************************************************************************** Support for the in-core structures allocation (slurp mode). ******************************************************************************/ -extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]); +extern void GifApplyTranslation(SavedImage *Image, + const GifPixelType Translation[]); extern int GifAddExtensionBlock(int *ExtensionBlock_Count, - ExtensionBlock **ExtensionBlocks, - int Function, + ExtensionBlock **ExtensionBlocks, int Function, unsigned int Len, unsigned char ExtData[]); extern void GifFreeExtensions(int *ExtensionBlock_Count, ExtensionBlock **ExtensionBlocks); extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, - const SavedImage *CopyFrom); + const SavedImage *CopyFrom); extern void GifFreeSavedImages(GifFileType *GifFile); /****************************************************************************** @@ -295,37 +282,31 @@ int DGifExtensionToGCB(const size_t GifExtensionLength, size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, GifByteType *GifExtension); -int DGifSavedExtensionToGCB(GifFileType *GifFile, - int ImageIndex, +int DGifSavedExtensionToGCB(GifFileType *GifFile, int ImageIndex, GraphicsControlBlock *GCB); int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, - GifFileType *GifFile, - int ImageIndex); + GifFileType *GifFile, int ImageIndex); /****************************************************************************** The library's internal utility font ******************************************************************************/ -#define GIF_FONT_WIDTH 8 +#define GIF_FONT_WIDTH 8 #define GIF_FONT_HEIGHT 8 extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; -extern void GifDrawText8x8(SavedImage *Image, - const int x, const int y, - const char *legend, const int color); +extern void GifDrawText8x8(SavedImage *Image, const int x, const int y, + const char *legend, const int color); -extern void GifDrawBox(SavedImage *Image, - const int x, const int y, - const int w, const int d, const int color); +extern void GifDrawBox(SavedImage *Image, const int x, const int y, const int w, + const int d, const int color); -extern void GifDrawRectangle(SavedImage *Image, - const int x, const int y, - const int w, const int d, const int color); +extern void GifDrawRectangle(SavedImage *Image, const int x, const int y, + const int w, const int d, const int color); -extern void GifDrawBoxedText8x8(SavedImage *Image, - const int x, const int y, - const char *legend, - const int border, const int bg, const int fg); +extern void GifDrawBoxedText8x8(SavedImage *Image, const int x, const int y, + const char *legend, const int border, + const int bg, const int fg); #ifdef __cplusplus } diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib_private.h b/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib_private.h index 4f832676ffc..f905e0d7b48 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib_private.h +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib_private.h @@ -33,52 +33,54 @@ SPDX-License-Identifier: MIT #ifndef _GIF_LIB_PRIVATE_H #define _GIF_LIB_PRIVATE_H -#include "gif_lib.h" #include "gif_hash.h" +#include "gif_lib.h" #ifndef SIZE_MAX - #define SIZE_MAX UINTPTR_MAX +#define SIZE_MAX UINTPTR_MAX #endif -#define EXTENSION_INTRODUCER 0x21 -#define DESCRIPTOR_INTRODUCER 0x2c -#define TERMINATOR_INTRODUCER 0x3b +#define EXTENSION_INTRODUCER 0x21 +#define DESCRIPTOR_INTRODUCER 0x2c +#define TERMINATOR_INTRODUCER 0x3b -#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ -#define LZ_BITS 12 +#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ +#define LZ_BITS 12 -#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ -#define FIRST_CODE 4097 /* Impossible code, to signal first. */ -#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ +#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ +#define FIRST_CODE 4097 /* Impossible code, to signal first. */ +#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ -#define FILE_STATE_WRITE 0x01 -#define FILE_STATE_SCREEN 0x02 -#define FILE_STATE_IMAGE 0x04 -#define FILE_STATE_READ 0x08 +#define FILE_STATE_WRITE 0x01 +#define FILE_STATE_SCREEN 0x02 +#define FILE_STATE_IMAGE 0x04 +#define FILE_STATE_READ 0x08 -#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) -#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) +#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) +#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) typedef struct GifFilePrivateType { - GifWord FileState, FileHandle, /* Where all this data goes to! */ - BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ - ClearCode, /* The CLEAR LZ code. */ - EOFCode, /* The EOF LZ code. */ - RunningCode, /* The next code algorithm can generate. */ - RunningBits, /* The number of bits required to represent RunningCode. */ - MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ - LastCode, /* The code before the current code. */ - CrntCode, /* Current algorithm code. */ - StackPtr, /* For character stack (see below). */ - CrntShiftState; /* Number of bits in CrntShiftDWord. */ - unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ - unsigned long PixelCount; /* Number of pixels in image. */ - FILE *File; /* File as stream. */ - InputFunc Read; /* function to read gif input (TVT) */ - OutputFunc Write; /* function to write gif output (MRB) */ - GifByteType Buf[256]; /* Compressed input is buffered here. */ + GifWord FileState, FileHandle, /* Where all this data goes to! */ + BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ + ClearCode, /* The CLEAR LZ code. */ + EOFCode, /* The EOF LZ code. */ + RunningCode, /* The next code algorithm can generate. */ + RunningBits, /* The number of bits required to represent + RunningCode. */ + MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. + */ + LastCode, /* The code before the current code. */ + CrntCode, /* Current algorithm code. */ + StackPtr, /* For character stack (see below). */ + CrntShiftState; /* Number of bits in CrntShiftDWord. */ + unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ + unsigned long PixelCount; /* Number of pixels in image. */ + FILE *File; /* File as stream. */ + InputFunc Read; /* function to read gif input (TVT) */ + OutputFunc Write; /* function to write gif output (MRB) */ + GifByteType Buf[256]; /* Compressed input is buffered here. */ GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ - GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ + GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ GifPrefixType Prefix[LZ_MAX_CODE + 1]; GifHashTableType *HashTable; bool gif89; diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c b/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c index 75b74b4fba0..5aef3044558 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c @@ -30,59 +30,59 @@ SPDX-License-Identifier: MIT ****************************************************************************/ -#include #include +#include #include #include "gif_lib.h" #include "gif_lib_private.h" -#define MAX(x, y) (((x) > (y)) ? (x) : (y)) +#define MAX(x, y) (((x) > (y)) ? (x) : (y)) /****************************************************************************** Miscellaneous utility functions ******************************************************************************/ /* return smallest bitfield size n will fit in */ -int -GifBitSize(int n) -{ +int GifBitSize(int n) { register int i; - for (i = 1; i <= 8; i++) - if ((1 << i) >= n) + for (i = 1; i <= 8; i++) { + if ((1 << i) >= n) { break; + } + } return (i); } /****************************************************************************** - Color map object functions + Color map object functions ******************************************************************************/ /* * Allocate a color map of given size; initialize with contents of * ColorMap if that pointer is non-NULL. */ -ColorMapObject * -GifMakeMapObject(int ColorCount, const GifColorType *ColorMap) -{ +ColorMapObject *GifMakeMapObject(int ColorCount, const GifColorType *ColorMap) { ColorMapObject *Object; /*** FIXME: Our ColorCount has to be a power of two. Is it necessary to - * make the user know that or should we automatically round up instead? */ + * make the user know that or should we automatically round up instead? + */ if (ColorCount != (1 << GifBitSize(ColorCount))) { - return ((ColorMapObject *) NULL); + return ((ColorMapObject *)NULL); } Object = (ColorMapObject *)malloc(sizeof(ColorMapObject)); - if (Object == (ColorMapObject *) NULL) { - return ((ColorMapObject *) NULL); + if (Object == (ColorMapObject *)NULL) { + return ((ColorMapObject *)NULL); } - Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType)); - if (Object->Colors == (GifColorType *) NULL) { + Object->Colors = + (GifColorType *)calloc(ColorCount, sizeof(GifColorType)); + if (Object->Colors == (GifColorType *)NULL) { free(Object); - return ((ColorMapObject *) NULL); + return ((ColorMapObject *)NULL); } Object->ColorCount = ColorCount; @@ -90,19 +90,17 @@ GifMakeMapObject(int ColorCount, const GifColorType *ColorMap) Object->SortFlag = false; if (ColorMap != NULL) { - memcpy((char *)Object->Colors, - (char *)ColorMap, ColorCount * sizeof(GifColorType)); + memcpy((char *)Object->Colors, (char *)ColorMap, + ColorCount * sizeof(GifColorType)); } return (Object); } /******************************************************************************* -Free a color map object + Free a color map object *******************************************************************************/ -void -GifFreeMapObject(ColorMapObject *Object) -{ +void GifFreeMapObject(ColorMapObject *Object) { if (Object != NULL) { (void)free(Object->Colors); (void)free(Object); @@ -110,17 +108,14 @@ GifFreeMapObject(ColorMapObject *Object) } #ifdef DEBUG -void -DumpColorMap(ColorMapObject *Object, - FILE * fp) -{ +void DumpColorMap(ColorMapObject *Object, FILE *fp) { if (Object != NULL) { int i, j, Len = Object->ColorCount; for (i = 0; i < Len; i += 4) { for (j = 0; j < 4 && j < Len; j++) { - (void)fprintf(fp, "%3d: %02x %02x %02x ", i + j, - Object->Colors[i + j].Red, + (void)fprintf(fp, "%3d: %02x %02x %02x ", + i + j, Object->Colors[i + j].Red, Object->Colors[i + j].Green, Object->Colors[i + j].Blue); } @@ -137,11 +132,9 @@ DumpColorMap(ColorMapObject *Object, copied iff they didn't exist before. ColorTransIn2 maps the old ColorIn2 into the ColorUnion color map table./ *******************************************************************************/ -ColorMapObject * -GifUnionColorMap(const ColorMapObject *ColorIn1, - const ColorMapObject *ColorIn2, - GifPixelType ColorTransIn2[]) -{ +ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, + const ColorMapObject *ColorIn2, + GifPixelType ColorTransIn2[]) { int i, j, CrntSlot, RoundUpTo, NewGifBitSize; ColorMapObject *ColorUnion; @@ -152,17 +145,19 @@ GifUnionColorMap(const ColorMapObject *ColorIn1, */ /* Allocate table which will hold the result for sure. */ - ColorUnion = GifMakeMapObject(MAX(ColorIn1->ColorCount, - ColorIn2->ColorCount) * 2, NULL); + ColorUnion = GifMakeMapObject( + MAX(ColorIn1->ColorCount, ColorIn2->ColorCount) * 2, NULL); - if (ColorUnion == NULL) + if (ColorUnion == NULL) { return (NULL); + } /* * Copy ColorIn1 to ColorUnion. */ - for (i = 0; i < ColorIn1->ColorCount; i++) + for (i = 0; i < ColorIn1->ColorCount; i++) { ColorUnion->Colors[i] = ColorIn1->Colors[i]; + } CrntSlot = ColorIn1->ColorCount; /* @@ -172,22 +167,25 @@ GifUnionColorMap(const ColorMapObject *ColorIn1, * of table 1. This is very useful if your display is limited to * 16 colors. */ - while (ColorIn1->Colors[CrntSlot - 1].Red == 0 - && ColorIn1->Colors[CrntSlot - 1].Green == 0 - && ColorIn1->Colors[CrntSlot - 1].Blue == 0) + while (ColorIn1->Colors[CrntSlot - 1].Red == 0 && + ColorIn1->Colors[CrntSlot - 1].Green == 0 && + ColorIn1->Colors[CrntSlot - 1].Blue == 0) { CrntSlot--; + } /* Copy ColorIn2 to ColorUnion (use old colors if they exist): */ for (i = 0; i < ColorIn2->ColorCount && CrntSlot <= 256; i++) { /* Let's see if this color already exists: */ - for (j = 0; j < ColorIn1->ColorCount; j++) - if (memcmp (&ColorIn1->Colors[j], &ColorIn2->Colors[i], - sizeof(GifColorType)) == 0) + for (j = 0; j < ColorIn1->ColorCount; j++) { + if (memcmp(&ColorIn1->Colors[j], &ColorIn2->Colors[i], + sizeof(GifColorType)) == 0) { break; + } + } - if (j < ColorIn1->ColorCount) - ColorTransIn2[i] = j; /* color exists in Color1 */ - else { + if (j < ColorIn1->ColorCount) { + ColorTransIn2[i] = j; /* color exists in Color1 */ + } else { /* Color is new - copy it to a new slot: */ ColorUnion->Colors[CrntSlot] = ColorIn2->Colors[i]; ColorTransIn2[i] = CrntSlot++; @@ -196,7 +194,7 @@ GifUnionColorMap(const ColorMapObject *ColorIn1, if (CrntSlot > 256) { GifFreeMapObject(ColorUnion); - return ((ColorMapObject *) NULL); + return ((ColorMapObject *)NULL); } NewGifBitSize = GifBitSize(CrntSlot); @@ -210,16 +208,17 @@ GifUnionColorMap(const ColorMapObject *ColorIn1, * We know these slots exist because of the way ColorUnion's * start dimension was computed. */ - for (j = CrntSlot; j < RoundUpTo; j++) + for (j = CrntSlot; j < RoundUpTo; j++) { Map[j].Red = Map[j].Green = Map[j].Blue = 0; + } /* perhaps we can shrink the map? */ if (RoundUpTo < ColorUnion->ColorCount) { - GifColorType *new_map = (GifColorType *)reallocarray(Map, - RoundUpTo, sizeof(GifColorType)); - if( new_map == NULL ) { + GifColorType *new_map = (GifColorType *)reallocarray( + Map, RoundUpTo, sizeof(GifColorType)); + if (new_map == NULL) { GifFreeMapObject(ColorUnion); - return ((ColorMapObject *) NULL); + return ((ColorMapObject *)NULL); } ColorUnion->Colors = new_map; } @@ -234,49 +233,49 @@ GifUnionColorMap(const ColorMapObject *ColorIn1, /******************************************************************************* Apply a given color translation to the raster bits of an image *******************************************************************************/ -void -GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]) -{ +void GifApplyTranslation(SavedImage *Image, const GifPixelType Translation[]) { register int i; - register int RasterSize = Image->ImageDesc.Height * Image->ImageDesc.Width; + register int RasterSize = + Image->ImageDesc.Height * Image->ImageDesc.Width; - for (i = 0; i < RasterSize; i++) + for (i = 0; i < RasterSize; i++) { Image->RasterBits[i] = Translation[Image->RasterBits[i]]; + } } /****************************************************************************** Extension record functions ******************************************************************************/ -int -GifAddExtensionBlock(int *ExtensionBlockCount, - ExtensionBlock **ExtensionBlocks, - int Function, - unsigned int Len, - unsigned char ExtData[]) -{ +int GifAddExtensionBlock(int *ExtensionBlockCount, + ExtensionBlock **ExtensionBlocks, int Function, + unsigned int Len, unsigned char ExtData[]) { ExtensionBlock *ep; - if (*ExtensionBlocks == NULL) - *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); - else { - ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray - (*ExtensionBlocks, (*ExtensionBlockCount + 1), - sizeof(ExtensionBlock)); - if( ep_new == NULL ) + if (*ExtensionBlocks == NULL) { + *ExtensionBlocks = + (ExtensionBlock *)malloc(sizeof(ExtensionBlock)); + } else { + ExtensionBlock *ep_new = (ExtensionBlock *)reallocarray( + *ExtensionBlocks, (*ExtensionBlockCount + 1), + sizeof(ExtensionBlock)); + if (ep_new == NULL) { return (GIF_ERROR); + } *ExtensionBlocks = ep_new; } - if (*ExtensionBlocks == NULL) + if (*ExtensionBlocks == NULL) { return (GIF_ERROR); + } ep = &(*ExtensionBlocks)[(*ExtensionBlockCount)++]; ep->Function = Function; - ep->ByteCount=Len; + ep->ByteCount = Len; ep->Bytes = (GifByteType *)malloc(ep->ByteCount); - if (ep->Bytes == NULL) + if (ep->Bytes == NULL) { return (GIF_ERROR); + } if (ExtData != NULL) { memcpy(ep->Bytes, ExtData, Len); @@ -285,38 +284,36 @@ GifAddExtensionBlock(int *ExtensionBlockCount, return (GIF_OK); } -void -GifFreeExtensions(int *ExtensionBlockCount, - ExtensionBlock **ExtensionBlocks) -{ +void GifFreeExtensions(int *ExtensionBlockCount, + ExtensionBlock **ExtensionBlocks) { ExtensionBlock *ep; - if (*ExtensionBlocks == NULL) + if (*ExtensionBlocks == NULL) { return; + } for (ep = *ExtensionBlocks; - ep < (*ExtensionBlocks + *ExtensionBlockCount); - ep++) + ep < (*ExtensionBlocks + *ExtensionBlockCount); ep++) { (void)free((char *)ep->Bytes); + } (void)free((char *)*ExtensionBlocks); *ExtensionBlocks = NULL; *ExtensionBlockCount = 0; } /****************************************************************************** - Image block allocation functions + Image block allocation functions ******************************************************************************/ /* Private Function: * Frees the last image in the GifFile->SavedImages array */ -void -FreeLastSavedImage(GifFileType *GifFile) -{ +void FreeLastSavedImage(GifFileType *GifFile) { SavedImage *sp; - if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) + if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) { return; + } /* Remove one SavedImage from the GifFile */ GifFile->ImageCount--; @@ -329,54 +326,58 @@ FreeLastSavedImage(GifFileType *GifFile) } /* Deallocate the image data */ - if (sp->RasterBits != NULL) + if (sp->RasterBits != NULL) { free((char *)sp->RasterBits); + } /* Deallocate any extensions */ GifFreeExtensions(&sp->ExtensionBlockCount, &sp->ExtensionBlocks); /*** FIXME: We could realloc the GifFile->SavedImages structure but is * there a point to it? Saves some memory but we'd have to do it every - * time. If this is used in GifFreeSavedImages then it would be inefficient - * (The whole array is going to be deallocated.) If we just use it when - * we want to free the last Image it's convenient to do it here. + * time. If this is used in GifFreeSavedImages then it would be + * inefficient (The whole array is going to be deallocated.) If we just + * use it when we want to free the last Image it's convenient to do it + * here. */ } /* * Append an image block to the SavedImages array */ -SavedImage * -GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) -{ - if (GifFile->SavedImages == NULL) +SavedImage *GifMakeSavedImage(GifFileType *GifFile, + const SavedImage *CopyFrom) { + // cppcheck-suppress ctunullpointer + if (GifFile->SavedImages == NULL) { GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); - else { - SavedImage* newSavedImages = (SavedImage *)reallocarray(GifFile->SavedImages, - (GifFile->ImageCount + 1), sizeof(SavedImage)); - if( newSavedImages == NULL) + } else { + SavedImage *newSavedImages = (SavedImage *)reallocarray( + GifFile->SavedImages, (GifFile->ImageCount + 1), + sizeof(SavedImage)); + if (newSavedImages == NULL) { return ((SavedImage *)NULL); + } GifFile->SavedImages = newSavedImages; } - if (GifFile->SavedImages == NULL) + if (GifFile->SavedImages == NULL) { return ((SavedImage *)NULL); - else { + } else { SavedImage *sp = &GifFile->SavedImages[GifFile->ImageCount++]; if (CopyFrom != NULL) { memcpy((char *)sp, CopyFrom, sizeof(SavedImage)); /* - * Make our own allocated copies of the heap fields in the - * copied record. This guards against potential aliasing - * problems. + * Make our own allocated copies of the heap fields in + * the copied record. This guards against potential + * aliasing problems. */ /* first, the local color map */ if (CopyFrom->ImageDesc.ColorMap != NULL) { sp->ImageDesc.ColorMap = GifMakeMapObject( - CopyFrom->ImageDesc.ColorMap->ColorCount, - CopyFrom->ImageDesc.ColorMap->Colors); + CopyFrom->ImageDesc.ColorMap->ColorCount, + CopyFrom->ImageDesc.ColorMap->Colors); if (sp->ImageDesc.ColorMap == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); @@ -384,32 +385,36 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) } /* next, the raster */ - sp->RasterBits = (unsigned char *)reallocarray(NULL, - (CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width), - sizeof(GifPixelType)); + sp->RasterBits = (unsigned char *)reallocarray( + NULL, + (CopyFrom->ImageDesc.Height * + CopyFrom->ImageDesc.Width), + sizeof(GifPixelType)); if (sp->RasterBits == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); } memcpy(sp->RasterBits, CopyFrom->RasterBits, - sizeof(GifPixelType) * CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); + sizeof(GifPixelType) * + CopyFrom->ImageDesc.Height * + CopyFrom->ImageDesc.Width); /* finally, the extension blocks */ if (CopyFrom->ExtensionBlocks != NULL) { - sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL, - CopyFrom->ExtensionBlockCount, - sizeof(ExtensionBlock)); + sp->ExtensionBlocks = + (ExtensionBlock *)reallocarray( + NULL, CopyFrom->ExtensionBlockCount, + sizeof(ExtensionBlock)); if (sp->ExtensionBlocks == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); } - memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks, - sizeof(ExtensionBlock) * CopyFrom->ExtensionBlockCount); + memcpy(sp->ExtensionBlocks, + CopyFrom->ExtensionBlocks, + sizeof(ExtensionBlock) * + CopyFrom->ExtensionBlockCount); } - } - else { + } else { memset((char *)sp, '\0', sizeof(SavedImage)); } @@ -417,9 +422,7 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) } } -void -GifFreeSavedImages(GifFileType *GifFile) -{ +void GifFreeSavedImages(GifFileType *GifFile) { SavedImage *sp; if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) { @@ -432,10 +435,12 @@ GifFreeSavedImages(GifFileType *GifFile) sp->ImageDesc.ColorMap = NULL; } - if (sp->RasterBits != NULL) + if (sp->RasterBits != NULL) { free((char *)sp->RasterBits); + } - GifFreeExtensions(&sp->ExtensionBlockCount, &sp->ExtensionBlocks); + GifFreeExtensions(&sp->ExtensionBlockCount, + &sp->ExtensionBlocks); } free((char *)GifFile->SavedImages); GifFile->SavedImages = NULL; diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c b/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c index 452df69d7cd..7420af674c5 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c +++ b/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c @@ -28,24 +28,22 @@ * SPDX-License-Identifier: MIT */ -#include #include #include #include +#include #ifndef SIZE_MAX - #define SIZE_MAX UINTPTR_MAX +#define SIZE_MAX UINTPTR_MAX #endif /* * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW */ -#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) +#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) -void * -openbsd_reallocarray(void *optr, size_t nmemb, size_t size) -{ +void *openbsd_reallocarray(void *optr, size_t nmemb, size_t size) { if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && nmemb > 0 && SIZE_MAX / nmemb < size) { errno = ENOMEM; @@ -93,7 +91,8 @@ openbsd_reallocarray(void *optr, size_t nmemb, size_t size) * fuzzing on one platform may not detect zero-size allocation * problems on other platforms. */ - if (size == 0 || nmemb == 0) + if (size == 0 || nmemb == 0) { return NULL; + } return realloc(optr, size * nmemb); } From 4d5ed550eaab4313ef15fe32b314db832d6f57d6 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 5 Jun 2024 08:37:43 +0000 Subject: [PATCH 035/329] 8332898: failure_handler: log directory of commands Backport-of: 7f0ad513c30359816ac840f821ca0a22d723a642 --- .../classes/jdk/test/failurehandler/action/ActionHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java index aa49d2c7092..4cdced07dbb 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java @@ -164,7 +164,7 @@ private ExitCode run(PrintWriter log, Writer out, ProcessBuilder pb, Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); - log.printf("%s%n[%tF % Date: Wed, 5 Jun 2024 08:37:59 +0000 Subject: [PATCH 036/329] 8328953: JEditorPane.read throws ChangedCharSetException Backport-of: dc831aa750351c2b38cf5fee42d93ff62a230a28 --- .../classes/javax/swing/JEditorPane.java | 54 +++++++------- .../swing/JEditorPane/EditorPaneCharset.java | 74 +++++++++++++++++++ 2 files changed, 102 insertions(+), 26 deletions(-) create mode 100644 test/jdk/javax/swing/JEditorPane/EditorPaneCharset.java diff --git a/src/java.desktop/share/classes/javax/swing/JEditorPane.java b/src/java.desktop/share/classes/javax/swing/JEditorPane.java index 6d708f1b8b8..fa63442c637 100644 --- a/src/java.desktop/share/classes/javax/swing/JEditorPane.java +++ b/src/java.desktop/share/classes/javax/swing/JEditorPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -618,35 +618,37 @@ void read(InputStream in, Document doc) throws IOException { String charset = (String) getClientProperty("charset"); try(Reader r = (charset != null) ? new InputStreamReader(in, charset) : new InputStreamReader(in)) { - kit.read(r, doc, 0); - } catch (BadLocationException e) { - throw new IOException(e.getMessage()); - } catch (ChangedCharSetException changedCharSetException) { - String charSetSpec = changedCharSetException.getCharSetSpec(); - if (changedCharSetException.keyEqualsCharSet()) { - putClientProperty("charset", charSetSpec); - } else { - setCharsetFromContentTypeParameters(charSetSpec); - } try { - in.reset(); - } catch (IOException exception) { - //mark was invalidated - in.close(); - URL url = (URL)doc.getProperty(Document.StreamDescriptionProperty); - if (url != null) { - URLConnection conn = url.openConnection(); - in = conn.getInputStream(); + kit.read(r, doc, 0); + } catch (BadLocationException e) { + throw new IOException(e.getMessage()); + } catch (ChangedCharSetException changedCharSetException) { + String charSetSpec = changedCharSetException.getCharSetSpec(); + if (changedCharSetException.keyEqualsCharSet()) { + putClientProperty("charset", charSetSpec); } else { - //there is nothing we can do to recover stream - throw changedCharSetException; + setCharsetFromContentTypeParameters(charSetSpec); } + try { + in.reset(); + } catch (IOException exception) { + //mark was invalidated + in.close(); + URL url = (URL)doc.getProperty(Document.StreamDescriptionProperty); + if (url != null) { + URLConnection conn = url.openConnection(); + in = conn.getInputStream(); + } else { + //there is nothing we can do to recover stream + throw changedCharSetException; + } + } + try { + doc.remove(0, doc.getLength()); + } catch (BadLocationException e) {} + doc.putProperty("IgnoreCharsetDirective", Boolean.valueOf(true)); + read(in, doc); } - try { - doc.remove(0, doc.getLength()); - } catch (BadLocationException e) {} - doc.putProperty("IgnoreCharsetDirective", Boolean.valueOf(true)); - read(in, doc); } } diff --git a/test/jdk/javax/swing/JEditorPane/EditorPaneCharset.java b/test/jdk/javax/swing/JEditorPane/EditorPaneCharset.java new file mode 100644 index 00000000000..cf2edf0e1a1 --- /dev/null +++ b/test/jdk/javax/swing/JEditorPane/EditorPaneCharset.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.nio.charset.Charset; + +import javax.swing.JEditorPane; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.Element; + +/* + * @test + * @bug 8328953 + * @summary Verifies JEditorPane.read doesn't throw ChangedCharSetException + but handles it and reads HTML in the specified encoding + * @run main EditorPaneCharset + */ + +public final class EditorPaneCharset { + private static final String CYRILLIC_TEXT = + "\u041F\u0440\u0438\u0432\u0435\u0442, \u043C\u0438\u0440!"; + private static final String HTML_CYRILLIC = + "\n" + + "\n" + + " \n" + + "\n" + + "

" + CYRILLIC_TEXT + "

\n" + + "\n"; + + public static void main(String[] args) throws IOException, BadLocationException { + JEditorPane editorPane = new JEditorPane(); + editorPane.setContentType("text/html"); + Document document = editorPane.getDocument(); + + // Shouldn't throw ChangedCharSetException + editorPane.read( + new ByteArrayInputStream( + HTML_CYRILLIC.getBytes( + Charset.forName("windows-1251"))), + document); + + Element root = document.getDefaultRootElement(); + Element body = root.getElement(1); + Element p = body.getElement(0); + String pText = document.getText(p.getStartOffset(), + p.getEndOffset() - p.getStartOffset() - 1); + if (!CYRILLIC_TEXT.equals(pText)) { + throw new RuntimeException("Text doesn't match"); + } + } +} From a0c72d040efed165d2d8c6f08c550d8cbacdf197 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 5 Jun 2024 08:38:13 +0000 Subject: [PATCH 037/329] 8320692: Null icon returned for .exe without custom icon Backport-of: 6212264cc6fe428e8d15b7f33e2979c081e432d7 --- .../sun/awt/shell/Win32ShellFolder2.java | 10 +- .../FileSystemView/NoIconExeNPE.java | 274 ++++++++++++++++++ 2 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 test/jdk/javax/swing/JFileChooser/FileSystemView/NoIconExeNPE.java diff --git a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java index c8fc3a4627e..16726b0df4b 100644 --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -1118,7 +1118,10 @@ public Image call() { if (hiResIconAvailable(getParentIShellFolder(), getRelativePIDL()) || newIcon == null) { int size = getLargeIcon ? LARGE_ICON_SIZE : SMALL_ICON_SIZE; - newIcon = getIcon(size, size); + newIcon2 = getIcon(size, size); + if (newIcon2 != null) { + newIcon = newIcon2; + } } if (newIcon == null) { @@ -1177,6 +1180,9 @@ public Image getIcon(int width, int height) { newIcon = makeIcon(hIcon); disposeIcon(hIcon); + if (newIcon == null) { + return null; + } multiResolutionIcon.put(s, newIcon); if (size < MIN_QUALITY_ICON || size > MAX_QUALITY_ICON) { break; diff --git a/test/jdk/javax/swing/JFileChooser/FileSystemView/NoIconExeNPE.java b/test/jdk/javax/swing/JFileChooser/FileSystemView/NoIconExeNPE.java new file mode 100644 index 00000000000..5da17d04537 --- /dev/null +++ b/test/jdk/javax/swing/JFileChooser/FileSystemView/NoIconExeNPE.java @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; + +import javax.swing.Icon; +import javax.swing.UIManager; +import javax.swing.filechooser.FileSystemView; + +/* + * @test + * @bug 8320692 + * @requires (os.family == "windows") + * @summary NullPointerException is thrown for .exe file without icon + * @run main/othervm NoIconExeNPE + */ +public class NoIconExeNPE { + + /** + * Bytes of a short {@code Hello.exe} which has no icon. + */ + private static final byte[] bytes = { + (byte) 0x4d, (byte) 0x5a, (byte) 0x80, (byte) 0x00, (byte) 0x01, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, + (byte) 0x10, (byte) 0x00, (byte) 0xff, (byte) 0xff, (byte) 0x00, + (byte) 0x00, (byte) 0x40, (byte) 0x01, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0e, + (byte) 0x1f, (byte) 0xba, (byte) 0x0e, (byte) 0x00, (byte) 0xb4, + (byte) 0x09, (byte) 0xcd, (byte) 0x21, (byte) 0xb8, (byte) 0x01, + (byte) 0x4c, (byte) 0xcd, (byte) 0x21, (byte) 0x54, (byte) 0x68, + (byte) 0x69, (byte) 0x73, (byte) 0x20, (byte) 0x70, (byte) 0x72, + (byte) 0x6f, (byte) 0x67, (byte) 0x72, (byte) 0x61, (byte) 0x6d, + (byte) 0x20, (byte) 0x63, (byte) 0x61, (byte) 0x6e, (byte) 0x6e, + (byte) 0x6f, (byte) 0x74, (byte) 0x20, (byte) 0x62, (byte) 0x65, + (byte) 0x20, (byte) 0x72, (byte) 0x75, (byte) 0x6e, (byte) 0x20, + (byte) 0x69, (byte) 0x6e, (byte) 0x20, (byte) 0x44, (byte) 0x4f, + (byte) 0x53, (byte) 0x20, (byte) 0x6d, (byte) 0x6f, (byte) 0x64, + (byte) 0x65, (byte) 0x2e, (byte) 0x0d, (byte) 0x0a, (byte) 0x24, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50, (byte) 0x45, + (byte) 0x00, (byte) 0x00, (byte) 0x4c, (byte) 0x01, (byte) 0x01, + (byte) 0x00, (byte) 0x55, (byte) 0x96, (byte) 0x96, (byte) 0x65, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xe0, (byte) 0x00, + (byte) 0x0f, (byte) 0x01, (byte) 0x0b, (byte) 0x01, (byte) 0x01, + (byte) 0x49, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x00, (byte) 0x00, + (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, + (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, + (byte) 0x00, (byte) 0xac, (byte) 0xa3, (byte) 0x00, (byte) 0x00, + (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, + (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x40, (byte) 0x10, (byte) 0x00, (byte) 0x00, + (byte) 0x86, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x2e, (byte) 0x74, (byte) 0x65, (byte) 0x78, + (byte) 0x74, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xc6, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x00, + (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x6a, (byte) 0x00, (byte) 0x68, + (byte) 0x29, (byte) 0x10, (byte) 0x40, (byte) 0x00, (byte) 0x68, + (byte) 0x1c, (byte) 0x10, (byte) 0x40, (byte) 0x00, (byte) 0x6a, + (byte) 0x00, (byte) 0xff, (byte) 0x15, (byte) 0x88, (byte) 0x10, + (byte) 0x40, (byte) 0x00, (byte) 0x6a, (byte) 0x00, (byte) 0xff, + (byte) 0x15, (byte) 0x80, (byte) 0x10, (byte) 0x40, (byte) 0x00, + (byte) 0x48, (byte) 0x65, (byte) 0x6c, (byte) 0x6c, (byte) 0x6f, + (byte) 0x20, (byte) 0x57, (byte) 0x6f, (byte) 0x72, (byte) 0x6c, + (byte) 0x64, (byte) 0x21, (byte) 0x00, (byte) 0x48, (byte) 0x65, + (byte) 0x6c, (byte) 0x6c, (byte) 0x6f, (byte) 0x20, (byte) 0x66, + (byte) 0x61, (byte) 0x73, (byte) 0x6d, (byte) 0x00, (byte) 0x90, + (byte) 0x90, (byte) 0x90, (byte) 0x90, (byte) 0x90, (byte) 0x90, + (byte) 0x90, (byte) 0x90, (byte) 0x90, (byte) 0x90, (byte) 0x90, + (byte) 0x90, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x90, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x10, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x9d, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x88, (byte) 0x10, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x90, (byte) 0x90, (byte) 0x90, (byte) 0x90, + (byte) 0xa8, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xb8, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x6b, (byte) 0x65, (byte) 0x72, (byte) 0x6e, + (byte) 0x65, (byte) 0x6c, (byte) 0x33, (byte) 0x32, (byte) 0x2e, + (byte) 0x64, (byte) 0x6c, (byte) 0x6c, (byte) 0x00, (byte) 0x75, + (byte) 0x73, (byte) 0x65, (byte) 0x72, (byte) 0x33, (byte) 0x32, + (byte) 0x2e, (byte) 0x64, (byte) 0x6c, (byte) 0x6c, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x45, (byte) 0x78, (byte) 0x69, + (byte) 0x74, (byte) 0x50, (byte) 0x72, (byte) 0x6f, (byte) 0x63, + (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x00, (byte) 0x90, + (byte) 0x90, (byte) 0x00, (byte) 0x00, (byte) 0x4d, (byte) 0x65, + (byte) 0x73, (byte) 0x73, (byte) 0x61, (byte) 0x67, (byte) 0x65, + (byte) 0x42, (byte) 0x6f, (byte) 0x78, (byte) 0x41, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 + }; + + public static void main(String[] args) throws Exception { + final Path temp = Files.createTempDirectory("no-icon"); + final Path hello = temp.resolve("Hello.exe"); + + try { + try (OutputStream out = Files.newOutputStream(hello)) { + out.write(bytes); + } + + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + FileSystemView fsv = FileSystemView.getFileSystemView(); + // No NullPointerException is expected + Icon icon = fsv.getSystemIcon(hello.toFile()); + if (icon == null) { + throw new RuntimeException("Null icon returned by FileSystemView.getSystemIcon()"); + } + } finally { + Files.deleteIfExists(hello); + Files.delete(temp); + } + } +} From 08b3f72ac5485f0d56dac7c26af859ce08ae7dfc Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 5 Jun 2024 08:38:27 +0000 Subject: [PATCH 038/329] 8312229: Crash involving yield, switch and anonymous classes Reviewed-by: mbaesken Backport-of: 1f81e5b19ebfb7cd1b5a01d6cf79efda7e827c35 --- .../sun/tools/javac/comp/LambdaToMethod.java | 11 ++++- .../tools/javac/patterns/T8312229.java | 44 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 test/langtools/tools/javac/patterns/T8312229.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index 1968d182fe0..80b70ddd957 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -1561,8 +1561,15 @@ public void visitSelect(JCFieldAccess tree) { public void visitVarDef(JCVariableDecl tree) { TranslationContext context = context(); if (context != null && context instanceof LambdaTranslationContext lambdaContext) { - if (frameStack.head.tree.hasTag(LAMBDA)) { - lambdaContext.addSymbol(tree.sym, LOCAL_VAR); + for (Frame frame : frameStack) { + if (frame.tree.hasTag(VARDEF)) { + //skip variable frames inside a lambda: + continue; + } else if (frame.tree.hasTag(LAMBDA)) { + lambdaContext.addSymbol(tree.sym, LOCAL_VAR); + } else { + break; + } } // Check for type variables (including as type arguments). // If they occur within class nested in a lambda, mark for erasure diff --git a/test/langtools/tools/javac/patterns/T8312229.java b/test/langtools/tools/javac/patterns/T8312229.java new file mode 100644 index 00000000000..20c3eb3e023 --- /dev/null +++ b/test/langtools/tools/javac/patterns/T8312229.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + /* + * @test + * @bug 8312229 + * @summary Ensure javac does not crash when a variable is used from an anonymous class + * @compile --enable-preview -source ${jdk.version} T8312229.java + */ +public class T8312229 { + void test(Object o) { + Runnable r = () -> { + var l = switch (o) { + default -> { + Integer i = 42; + yield new Runnable() { + public void run() { + i.toString(); // should not crash here + } + }; + } + }; + }; + } +} From bcdb7275d3ed00687191473c409dae0c84605928 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 5 Jun 2024 08:38:50 +0000 Subject: [PATCH 039/329] 8329004: Update Libpng to 1.6.43 Backport-of: 4e4229438ad2e8ac59ac675465e4d3d4e13bf156 --- src/java.desktop/share/legal/libpng.md | 43 +-- .../native/libsplashscreen/libpng/CHANGES | 67 +++++ .../native/libsplashscreen/libpng/LICENSE | 4 +- .../native/libsplashscreen/libpng/README | 12 +- .../libsplashscreen/libpng/UPDATING.txt | 25 +- .../share/native/libsplashscreen/libpng/png.c | 110 +++----- .../share/native/libsplashscreen/libpng/png.h | 61 ++--- .../native/libsplashscreen/libpng/pngconf.h | 4 +- .../native/libsplashscreen/libpng/pngerror.c | 34 +-- .../native/libsplashscreen/libpng/pngget.c | 245 +++++++++--------- .../libsplashscreen/libpng/pnglibconf.h | 2 +- .../native/libsplashscreen/libpng/pngpread.c | 16 +- .../native/libsplashscreen/libpng/pngpriv.h | 118 +++++++-- .../native/libsplashscreen/libpng/pngread.c | 12 +- .../native/libsplashscreen/libpng/pngrtran.c | 34 ++- .../native/libsplashscreen/libpng/pngrutil.c | 19 +- .../native/libsplashscreen/libpng/pngset.c | 22 +- .../native/libsplashscreen/libpng/pngtrans.c | 14 +- 18 files changed, 490 insertions(+), 352 deletions(-) diff --git a/src/java.desktop/share/legal/libpng.md b/src/java.desktop/share/legal/libpng.md index f420ccd94ed..cbffed81332 100644 --- a/src/java.desktop/share/legal/libpng.md +++ b/src/java.desktop/share/legal/libpng.md @@ -1,4 +1,4 @@ -## libpng v1.6.40 +## libpng v1.6.43 ### libpng License
@@ -9,11 +9,11 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
 PNG Reference Library License version 2
 ---------------------------------------
 
-Copyright (c) 1995-2023 The PNG Reference Library Authors.
-Copyright (c) 2018-2023 Cosmin Truta
-Copyright (c) 1998-2018 Glenn Randers-Pehrson
-Copyright (c) 1996-1997 Andreas Dilger
-Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+Copyright (C) 1995-2024 The PNG Reference Library Authors.
+Copyright (C) 2018-2024 Cosmin Truta
+Copyright (C) 1998-2018 Glenn Randers-Pehrson
+Copyright (C) 1996-1997 Andreas Dilger
+Copyright (C) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
 
 The software is supplied "as is", without warranty of any kind,
 express or implied, including, without limitation, the warranties
@@ -157,7 +157,9 @@ PNG REFERENCE LIBRARY AUTHORS
 This is the list of PNG Reference Library ("libpng") Contributing
 Authors, for copyright and licensing purposes.
 
+ * Adam Richter
  * Andreas Dilger
+ * Chris Blume
  * Cosmin Truta
  * Dave Martindale
  * Eric S. Raymond
@@ -186,21 +188,28 @@ Authors, for copyright and licensing purposes.
  * Vadim Barkov
  * Willem van Schaik
  * Zhijie Liang
+ * Apple Inc.
+    - Zixu Wang (王子旭)
  * Arm Holdings
-   - Richard Townsend
+    - Richard Townsend
  * Google Inc.
-   - Dan Field
-   - Leon Scroggins III
-   - Matt Sarett
-   - Mike Klein
-   - Sami Boukortt
-   - Wan-Teh Chang
+    - Dan Field
+    - Leon Scroggins III
+    - Matt Sarett
+    - Mike Klein
+    - Sami Boukortt
+    - Wan-Teh Chang
+ * Loongson Technology Corporation Ltd.
+    - GuXiWei (顾希伟)
+    - JinBo (金波)
+    - ZhangLixia (张利霞)
 
 The build projects, the build scripts, the test scripts, and other
-files in the "ci", "projects", "scripts" and "tests" directories, have
+files in the "projects", "scripts" and "tests" directories, have
 other copyright owners, but are released under the libpng license.
 
-Some files in the "contrib" directory, and some tools-generated files
-that are distributed with libpng, have other copyright owners, and are
-released under other open source licenses.
+Some files in the "ci" and "contrib" directories, as well as some
+of the tools-generated files that are distributed with libpng, have
+other copyright owners, and are released under other open source
+licenses.
 ```
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
index 2d8c585c0e7..441b57ecf1a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
@@ -6129,6 +6129,73 @@ Version 1.6.40 [June 21, 2023]
   Updated the configurations and the scripts for continuous integration.
   Cleaned up the code, the build scripts, and the documentation.
 
+Version 1.6.41 [January 24, 2024]
+  Added SIMD-optimized code for the LoongArch LSX hardware.
+    (Contributed by GuXiWei, JinBo and ZhangLixia)
+  Fixed the run-time discovery of MIPS MSA hardware.
+    (Contributed by Sui Jingfeng)
+  Fixed an off-by-one error in the function png_do_check_palette_indexes(),
+    which failed to recognize errors that might have existed in the first
+    column of a broken palette-encoded image. This was a benign regression
+    accidentally introduced in libpng-1.6.33. No pixel was harmed.
+    (Contributed by Adam Richter; reviewed by John Bowler)
+  Fixed, improved and modernized the contrib/pngminus programs, i.e.,
+    png2pnm.c and pnm2png.c
+  Removed old and peculiar portability hacks that were meant to silence
+    warnings issued by gcc version 7.1 alone.
+    (Contributed by John Bowler)
+  Fixed and modernized the CMake file, and raised the minimum required
+    CMake version from 3.1 to 3.6.
+    (Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
+  Allowed the configure script to disable the building of auxiliary tools
+    and tests, thus catching up with the CMake file.
+    (Contributed by Carlo Bramini)
+  Fixed a build issue on Mac.
+    (Contributed by Zixu Wang)
+  Moved the Autoconf macro files to scripts/autoconf.
+  Moved the CMake files (except for the main CMakeLists.txt) to
+    scripts/cmake and moved the list of their contributing authors to
+    scripts/cmake/AUTHORS.md
+  Updated the CI configurations and scripts.
+  Relicensed the CI scripts to the MIT License.
+  Improved the test coverage.
+    (Contributed by John Bowler)
+
+Version 1.6.42 [January 29, 2024]
+  Fixed the implementation of the macro function png_check_sig().
+    This was an API regression, introduced in libpng-1.6.41.
+    (Reported by Matthieu Darbois)
+  Fixed and updated the libpng manual.
+
+Version 1.6.43 [February 23, 2024]
+  Fixed the row width check in png_check_IHDR().
+    This corrected a bug that was specific to the 16-bit platforms,
+    and removed a spurious compiler warning from the 64-bit builds.
+    (Reported by Jacek Caban; fixed by John Bowler)
+  Added eXIf chunk support to the push-mode reader in pngpread.c.
+    (Contributed by Chris Blume)
+  Added contrib/pngexif for the benefit of the users who would like
+    to inspect the content of eXIf chunks.
+  Added contrib/conftest/basic.dfa, a basic build-time configuration.
+    (Contributed by John Bowler)
+  Fixed a preprocessor condition in pngread.c that broke build-time
+    configurations like contrib/conftest/pngcp.dfa.
+    (Contributed by John Bowler)
+  Added CMake build support for LoongArch LSX.
+    (Contributed by GuXiWei)
+  Fixed a CMake build error that occurred under a peculiar state of the
+    dependency tree. This was a regression introduced in libpng-1.6.41.
+    (Contributed by Dan Rosser)
+  Marked the installed libpng headers as system headers in CMake.
+    (Contributed by Benjamin Buch)
+  Updated the build support for RISCOS.
+    (Contributed by Cameron Cawley)
+  Updated the makefiles to allow cross-platform builds to initialize
+    conventional make variables like AR and ARFLAGS.
+  Added various improvements to the CI scripts in areas like version
+    consistency verification and text linting.
+  Added version consistency verification to pngtest.c also.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
 Subscription is required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
index 086d1c2fda6..25f298f0fcf 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
 PNG Reference Library License version 2
 ---------------------------------------
 
- * Copyright (c) 1995-2023 The PNG Reference Library Authors.
- * Copyright (c) 2018-2023 Cosmin Truta.
+ * Copyright (c) 1995-2024 The PNG Reference Library Authors.
+ * Copyright (c) 2018-2024 Cosmin Truta.
  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
  * Copyright (c) 1996-1997 Andreas Dilger.
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README
index dedd2c1639e..a6ca3ae9f94 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/README
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.40
+README for libpng version 1.6.43
 ================================
 
 See the note about version numbers near the top of `png.h`.
@@ -142,10 +142,11 @@ Files included in this distribution
     pngwrite.c    =>  High-level write functions
     pngwtran.c    =>  Write data transformations
     pngwutil.c    =>  Write utility functions
-    arm/          =>  Optimized code for the ARM platform
-    intel/        =>  Optimized code for the INTEL-SSE2 platform
-    mips/         =>  Optimized code for the MIPS platform
-    powerpc/      =>  Optimized code for the PowerPC platform
+    arm/          =>  Optimized code for ARM Neon
+    intel/        =>  Optimized code for INTEL SSE2
+    loongarch/    =>  Optimized code for LoongArch LSX
+    mips/         =>  Optimized code for MIPS MSA and MIPS MMI
+    powerpc/      =>  Optimized code for PowerPC VSX
     ci/           =>  Scripts for continuous integration
     contrib/      =>  External contributions
         arm-neon/     =>  Optimized code for the ARM-NEON platform
@@ -158,6 +159,7 @@ Files included in this distribution
         libtests/     =>  Test programs
         oss-fuzz/     =>  Files used by the OSS-Fuzz project for fuzz-testing
                           libpng
+        pngexif/      =>  Program to inspect the EXIF information in PNG files
         pngminim/     =>  Minimal decoder, encoder, and progressive decoder
                           programs demonstrating the use of pngusr.dfa
         pngminus/     =>  Simple pnm2png and png2pnm programs
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt b/src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt
index 93c8f5bb703..88200db5d73 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt
@@ -37,18 +37,21 @@ and instead just tweak the existing one.
 
 First cd into the libpng folder and run the following script.
 
+    shopt -s nullglob
     for f in *.c *.h;
-    do
-      # replace tabs with spaces
-      expand ${f} > ${f}.tmp;
-      mv ${f}.tmp $f;
-
-      # fix line endings to LF
-      sed -i -e 's/\r$//g' ${f};
-
-      # remove trailing spaces
-      sed -i -e 's/[ ]* $//g' ${f};
-    done
+         do
+            # replace tabs with spaces
+            expand ${f} > ${f}.tmp
+            mv ${f}.tmp $f
+
+            # fix line endings to LF
+            sed -e 's/\r$//g' ${f} > ${f}.tmp
+            mv ${f}.tmp $f
+
+            # remove trailing spaces
+            sed -e 's/[ ]* $//g' ${f} > ${f}.tmp
+            mv ${f}.tmp $f
+         done
 
 6) As with all native code, run it through the official build systems, in case
 the updated code trigger any fatal warnings with the official compilers.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.c b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
index 91a92e5f718..232dff876c7 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2023 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -42,27 +42,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_40 Your_png_h_is_not_version_1_6_40;
-
-#ifdef __GNUC__
-/* The version tests may need to be added to, but the problem warning has
- * consistently been fixed in GCC versions which obtain wide-spread release.
- * The problem is that many versions of GCC rearrange comparison expressions in
- * the optimizer in such a way that the results of the comparison will change
- * if signed integer overflow occurs.  Such comparisons are not permitted in
- * ANSI C90, however GCC isn't clever enough to work out that that do not occur
- * below in png_ascii_from_fp and png_muldiv, so it produces a warning with
- * -Wextra.  Unfortunately this is highly dependent on the optimizer and the
- * machine architecture so the warning comes and goes unpredictably and is
- * impossible to "fix", even were that a good idea.
- */
-#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
-#define GCC_STRICT_OVERFLOW 1
-#endif /* GNU 7.1.x */
-#endif /* GNU */
-#ifndef GCC_STRICT_OVERFLOW
-#define GCC_STRICT_OVERFLOW 0
-#endif
+typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -101,21 +81,21 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
 int PNGAPI
 png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
 {
-   png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
+   static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
 
    if (num_to_check > 8)
       num_to_check = 8;
 
    else if (num_to_check < 1)
-      return (-1);
+      return -1;
 
    if (start > 7)
-      return (-1);
+      return -1;
 
    if (start + num_to_check > 8)
       num_to_check = 8 - start;
 
-   return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check)));
+   return memcmp(&sig[start], &png_signature[start], num_to_check);
 }
 
 #endif /* READ */
@@ -475,7 +455,6 @@ png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
    memset(info_ptr, 0, (sizeof *info_ptr));
 }
 
-/* The following API is not called internally */
 void PNGAPI
 png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
     int freer, png_uint_32 mask)
@@ -714,9 +693,9 @@ png_voidp PNGAPI
 png_get_io_ptr(png_const_structrp png_ptr)
 {
    if (png_ptr == NULL)
-      return (NULL);
+      return NULL;
 
-   return (png_ptr->io_ptr);
+   return png_ptr->io_ptr;
 }
 
 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -780,7 +759,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
 
    {
       size_t pos = 0;
-      char number_buf[5]; /* enough for a four-digit year */
+      char number_buf[5] = {0, 0, 0, 0, 0}; /* enough for a four-digit year */
 
 #     define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
 #     define APPEND_NUMBER(format, value)\
@@ -843,8 +822,8 @@ png_get_copyright(png_const_structrp png_ptr)
    return PNG_STRING_COPYRIGHT
 #else
    return PNG_STRING_NEWLINE \
-      "libpng version 1.6.40" PNG_STRING_NEWLINE \
-      "Copyright (c) 2018-2023 Cosmin Truta" PNG_STRING_NEWLINE \
+      "libpng version 1.6.43" PNG_STRING_NEWLINE \
+      "Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
       PNG_STRING_NEWLINE \
       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
@@ -1005,7 +984,7 @@ png_reset_zstream(png_structrp png_ptr)
       return Z_STREAM_ERROR;
 
    /* WARNING: this resets the window bits to the maximum! */
-   return (inflateReset(&png_ptr->zstream));
+   return inflateReset(&png_ptr->zstream);
 }
 #endif /* READ */
 
@@ -1014,7 +993,7 @@ png_uint_32 PNGAPI
 png_access_version_number(void)
 {
    /* Version of *.c files used when building libpng */
-   return((png_uint_32)PNG_LIBPNG_VER);
+   return (png_uint_32)PNG_LIBPNG_VER;
 }
 
 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -1870,14 +1849,14 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
    }
 #  ifdef PNG_WARNINGS_SUPPORTED
    else
-      {
-         char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
+   {
+      char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
 
-         pos = png_safecat(message, (sizeof message), pos,
-             png_format_number(number, number+(sizeof number),
-             PNG_NUMBER_FORMAT_x, value));
-         pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
-      }
+      pos = png_safecat(message, (sizeof message), pos,
+          png_format_number(number, number+(sizeof number),
+          PNG_NUMBER_FORMAT_x, value));
+      pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
+   }
 #  endif
    /* The 'reason' is an arbitrary message, allow +79 maximum 195 */
    pos = png_safecat(message, (sizeof message), pos, reason);
@@ -2560,17 +2539,6 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
 
 #endif /* COLORSPACE */
 
-#ifdef __GNUC__
-/* This exists solely to work round a warning from GNU C. */
-static int /* PRIVATE */
-png_gt(size_t a, size_t b)
-{
-   return a > b;
-}
-#else
-#   define png_gt(a,b) ((a) > (b))
-#endif
-
 void /* PRIVATE */
 png_check_IHDR(png_const_structrp png_ptr,
     png_uint_32 width, png_uint_32 height, int bit_depth,
@@ -2592,8 +2560,16 @@ png_check_IHDR(png_const_structrp png_ptr,
       error = 1;
    }
 
-   if (png_gt(((width + 7) & (~7U)),
-       ((PNG_SIZE_MAX
+   /* The bit mask on the first line below must be at least as big as a
+    * png_uint_32.  "~7U" is not adequate on 16-bit systems because it will
+    * be an unsigned 16-bit value.  Casting to (png_alloc_size_t) makes the
+    * type of the result at least as bit (in bits) as the RHS of the > operator
+    * which also avoids a common warning on 64-bit systems that the comparison
+    * of (png_uint_32) against the constant value on the RHS will always be
+    * false.
+    */
+   if (((width + 7) & ~(png_alloc_size_t)7) >
+       (((PNG_SIZE_MAX
            - 48        /* big_row_buf hack */
            - 1)        /* filter byte */
            / 8)        /* 8-byte RGBA pixels */
@@ -2919,14 +2895,6 @@ png_pow10(int power)
 /* Function to format a floating point value in ASCII with a given
  * precision.
  */
-#if GCC_STRICT_OVERFLOW
-#pragma GCC diagnostic push
-/* The problem arises below with exp_b10, which can never overflow because it
- * comes, originally, from frexp and is therefore limited to a range which is
- * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
- */
-#pragma GCC diagnostic warning "-Wstrict-overflow=2"
-#endif /* GCC_STRICT_OVERFLOW */
 void /* PRIVATE */
 png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
     double fp, unsigned int precision)
@@ -3248,10 +3216,6 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
    /* Here on buffer too small. */
    png_error(png_ptr, "ASCII conversion buffer too small");
 }
-#if GCC_STRICT_OVERFLOW
-#pragma GCC diagnostic pop
-#endif /* GCC_STRICT_OVERFLOW */
-
 #  endif /* FLOATING_POINT */
 
 #  ifdef PNG_FIXED_POINT_SUPPORTED
@@ -3279,7 +3243,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
       if (num <= 0x80000000) /* else overflowed */
       {
          unsigned int ndigits = 0, first = 16 /* flag value */;
-         char digits[10];
+         char digits[10] = {0};
 
          while (num)
          {
@@ -3364,15 +3328,6 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
  * the nearest .00001).  Overflow and divide by zero are signalled in
  * the result, a boolean - true on success, false on overflow.
  */
-#if GCC_STRICT_OVERFLOW /* from above */
-/* It is not obvious which comparison below gets optimized in such a way that
- * signed overflow would change the result; looking through the code does not
- * reveal any tests which have the form GCC complains about, so presumably the
- * optimizer is moving an add or subtract into the 'if' somewhere.
- */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic warning "-Wstrict-overflow=2"
-#endif /* GCC_STRICT_OVERFLOW */
 int
 png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
     png_int_32 divisor)
@@ -3487,9 +3442,6 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
 
    return 0;
 }
-#if GCC_STRICT_OVERFLOW
-#pragma GCC diagnostic pop
-#endif /* GCC_STRICT_OVERFLOW */
 #endif /* READ_GAMMA || INCH_CONVERSIONS */
 
 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
index 578841c9580..9f61a773c1d 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.40
+ * libpng version 1.6.43
  *
- * Copyright (c) 2018-2023 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -43,7 +43,7 @@
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  *   libpng versions 0.97, January 1998, through 1.6.35, July 2018:
  *     Glenn Randers-Pehrson
- *   libpng versions 1.6.36, December 2018, through 1.6.40, June 2023:
+ *   libpng versions 1.6.36, December 2018, through 1.6.43, February 2024:
  *     Cosmin Truta
  *   See also "Contributing Authors", below.
  */
@@ -55,8 +55,8 @@
  * PNG Reference Library License version 2
  * ---------------------------------------
  *
- *  * Copyright (c) 1995-2023 The PNG Reference Library Authors.
- *  * Copyright (c) 2018-2023 Cosmin Truta.
+ *  * Copyright (c) 1995-2024 The PNG Reference Library Authors.
+ *  * Copyright (c) 2018-2024 Cosmin Truta.
  *  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
  *  * Copyright (c) 1996-1997 Andreas Dilger.
  *  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -267,7 +267,7 @@
  *    ...
  *    1.5.30                  15    10530  15.so.15.30[.0]
  *    ...
- *    1.6.40                  16    10640  16.so.16.40[.0]
+ *    1.6.43                  16    10643  16.so.16.43[.0]
  *
  *    Henceforth the source version will match the shared-library major and
  *    minor numbers; the shared-library major version number will be used for
@@ -283,9 +283,6 @@
  *    to the info_ptr or png_ptr members through png.h, and the compiled
  *    application is loaded with a different version of the library.
  *
- *    DLLNUM will change each time there are forward or backward changes
- *    in binary compatibility (e.g., when a new feature is added).
- *
  * See libpng.txt or libpng.3 for more information.  The PNG specification
  * is available as a W3C Recommendation and as an ISO/IEC Standard; see
  * 
@@ -306,19 +303,21 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.40"
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.40 - June 21, 2023\n"
+#define PNG_LIBPNG_VER_STRING "1.6.43"
+#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
 
-#define PNG_LIBPNG_VER_SONUM   16
-#define PNG_LIBPNG_VER_DLLNUM  16
+/* The versions of shared library builds should stay in sync, going forward */
+#define PNG_LIBPNG_VER_SHAREDLIB 16
+#define PNG_LIBPNG_VER_SONUM     PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
+#define PNG_LIBPNG_VER_DLLNUM    PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
 
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 40
+#define PNG_LIBPNG_VER_RELEASE 43
 
 /* This should be zero for a public release, or non-zero for a
- * development version.  [Deprecated]
+ * development version.
  */
 #define PNG_LIBPNG_VER_BUILD  0
 
@@ -346,7 +345,7 @@
  * From version 1.0.1 it is:
  * XXYYZZ, where XX=major, YY=minor, ZZ=release
  */
-#define PNG_LIBPNG_VER 10640 /* 1.6.40 */
+#define PNG_LIBPNG_VER 10643 /* 1.6.43 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -456,7 +455,7 @@ extern "C" {
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_40;
+typedef char* png_libpng_version_1_6_43;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
@@ -877,7 +876,7 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
 #define PNG_TRANSFORM_GRAY_TO_RGB   0x2000      /* read only */
 /* Added to libpng-1.5.4 */
 #define PNG_TRANSFORM_EXPAND_16     0x4000      /* read only */
-#if INT_MAX >= 0x8000 /* else this might break */
+#if ~0U > 0xffffU /* or else this might break on a 16-bit machine */
 #define PNG_TRANSFORM_SCALE_16      0x8000      /* read only */
 #endif
 
@@ -936,15 +935,15 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
  * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
  * signature, and non-zero otherwise.  Having num_to_check == 0 or
- * start > 7 will always fail (ie return non-zero).
+ * start > 7 will always fail (i.e. return non-zero).
  */
 PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
     size_t num_to_check));
 
 /* Simple signature checking function.  This is the same as calling
- * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
+ * png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0).
  */
-#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n))
+#define png_check_sig(sig, n) (png_sig_cmp((sig), 0, (n)) == 0) /* DEPRECATED */
 
 /* Allocate and initialize png_ptr struct for reading, and any other memory. */
 PNG_EXPORTA(4, png_structp, png_create_read_struct,
@@ -1758,12 +1757,9 @@ PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
 PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
     png_inforp info_ptr, png_uint_32 free_me, int num));
 
-/* Reassign responsibility for freeing existing data, whether allocated
+/* Reassign the responsibility for freeing existing data, whether allocated
  * by libpng or by the application; this works on the png_info structure passed
- * in, it does not change the state for other png_info structures.
- *
- * It is unlikely that this function works correctly as of 1.6.0 and using it
- * may result either in memory leaks or double free of allocated data.
+ * in, without changing the state for other png_info structures.
  */
 PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
     png_inforp info_ptr, int freer, png_uint_32 mask));
@@ -3235,11 +3231,18 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
 #ifdef PNG_MIPS_MSA_API_SUPPORTED
 #  define PNG_MIPS_MSA   6 /* HARDWARE: MIPS Msa SIMD instructions supported */
 #endif
-#define PNG_IGNORE_ADLER32 8
+#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
+#  define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */
+#endif
 #ifdef PNG_POWERPC_VSX_API_SUPPORTED
-#  define PNG_POWERPC_VSX   10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
+#  define PNG_POWERPC_VSX   10 /* HARDWARE: PowerPC VSX SIMD instructions
+                                * supported */
 #endif
-#define PNG_OPTION_NEXT  12 /* Next option - numbers must be even */
+#ifdef PNG_MIPS_MMI_API_SUPPORTED
+#  define PNG_MIPS_MMI   12 /* HARDWARE: MIPS MMI SIMD instructions supported */
+#endif
+
+#define PNG_OPTION_NEXT  14 /* Next option - numbers must be even */
 
 /* Return values: NOTE: there are four values and 'off' is *not* zero */
 #define PNG_OPTION_UNSET   0 /* Unset - defaults to off */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
index 41cbc91d398..b3b441b1122 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.40
+ * libpng version 1.6.43
  *
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
index 623735f06f1..ea8dd172197 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -283,7 +283,7 @@ void
 png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
     png_alloc_size_t value)
 {
-   char buffer[PNG_NUMBER_BUFFER_SIZE];
+   char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
    png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
 }
 
@@ -293,7 +293,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
 {
    png_alloc_size_t u;
    png_charp str;
-   char buffer[PNG_NUMBER_BUFFER_SIZE];
+   char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
 
    /* Avoid overflow by doing the negate in a png_alloc_size_t: */
    u = (png_alloc_size_t)value;
@@ -886,7 +886,7 @@ png_get_error_ptr(png_const_structrp png_ptr)
    if (png_ptr == NULL)
       return NULL;
 
-   return ((png_voidp)png_ptr->error_ptr);
+   return (png_voidp)png_ptr->error_ptr;
 }
 
 
@@ -961,31 +961,25 @@ png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
 #endif
 
 int /* PRIVATE */
-png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
+png_safe_execute(png_imagep image, int (*function)(png_voidp), png_voidp arg)
 {
-   volatile png_imagep image = image_in;
-   volatile int result;
-   volatile png_voidp saved_error_buf;
+   png_voidp saved_error_buf = image->opaque->error_buf;
    jmp_buf safe_jmpbuf;
+   int result;
 
-   /* Safely execute function(arg) with png_error returning to this function. */
-   saved_error_buf = image->opaque->error_buf;
-   result = setjmp(safe_jmpbuf) == 0;
-
-   if (result != 0)
+   /* Safely execute function(arg), with png_error returning back here. */
+   if (setjmp(safe_jmpbuf) == 0)
    {
-
       image->opaque->error_buf = safe_jmpbuf;
       result = function(arg);
+      image->opaque->error_buf = saved_error_buf;
+      return result;
    }
 
+   /* On png_error, return via longjmp, pop the jmpbuf, and free the image. */
    image->opaque->error_buf = saved_error_buf;
-
-   /* And do the cleanup prior to any failure return. */
-   if (result == 0)
-      png_image_free(image);
-
-   return result;
+   png_image_free(image);
+   return 0;
 }
 #endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
 #endif /* READ || WRITE */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
index 6e510b27327..41e0a5abc3a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2023 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -56,22 +56,22 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
        * valid tRNS chunk in this case.
        */
       if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
-         return(0);
+         return 0;
 #endif
 
-      return(info_ptr->valid & flag);
+      return info_ptr->valid & flag;
    }
 
-   return(0);
+   return 0;
 }
 
 size_t PNGAPI
 png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
    if (png_ptr != NULL && info_ptr != NULL)
-      return(info_ptr->rowbytes);
+      return info_ptr->rowbytes;
 
-   return(0);
+   return 0;
 }
 
 #ifdef PNG_INFO_IMAGE_SUPPORTED
@@ -79,9 +79,9 @@ png_bytepp PNGAPI
 png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
    if (png_ptr != NULL && info_ptr != NULL)
-      return(info_ptr->row_pointers);
+      return info_ptr->row_pointers;
 
-   return(0);
+   return 0;
 }
 #endif
 
@@ -93,7 +93,7 @@ png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->width;
 
-   return (0);
+   return 0;
 }
 
 png_uint_32 PNGAPI
@@ -102,7 +102,7 @@ png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->height;
 
-   return (0);
+   return 0;
 }
 
 png_byte PNGAPI
@@ -111,7 +111,7 @@ png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->bit_depth;
 
-   return (0);
+   return 0;
 }
 
 png_byte PNGAPI
@@ -120,7 +120,7 @@ png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->color_type;
 
-   return (0);
+   return 0;
 }
 
 png_byte PNGAPI
@@ -129,7 +129,7 @@ png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->filter_type;
 
-   return (0);
+   return 0;
 }
 
 png_byte PNGAPI
@@ -138,7 +138,7 @@ png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->interlace_type;
 
-   return (0);
+   return 0;
 }
 
 png_byte PNGAPI
@@ -147,7 +147,7 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return info_ptr->compression_type;
 
-   return (0);
+   return 0;
 }
 
 png_uint_32 PNGAPI
@@ -155,21 +155,20 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
    info_ptr)
 {
 #ifdef PNG_pHYs_SUPPORTED
+   png_debug(1, "in png_get_x_pixels_per_meter");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_pHYs) != 0)
-      {
-         png_debug1(1, "in %s retrieval function",
-             "png_get_x_pixels_per_meter");
-
-         if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
-            return (info_ptr->x_pixels_per_unit);
-      }
+   {
+      if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
+         return info_ptr->x_pixels_per_unit;
+   }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 png_uint_32 PNGAPI
@@ -177,42 +176,41 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
     info_ptr)
 {
 #ifdef PNG_pHYs_SUPPORTED
+   png_debug(1, "in png_get_y_pixels_per_meter");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_pHYs) != 0)
    {
-      png_debug1(1, "in %s retrieval function",
-          "png_get_y_pixels_per_meter");
-
       if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
-         return (info_ptr->y_pixels_per_unit);
+         return info_ptr->y_pixels_per_unit;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 png_uint_32 PNGAPI
 png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_pHYs_SUPPORTED
+   png_debug(1, "in png_get_pixels_per_meter");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_pHYs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
-
       if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
           info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
-         return (info_ptr->x_pixels_per_unit);
+         return info_ptr->x_pixels_per_unit;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 #ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -221,21 +219,21 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
    info_ptr)
 {
 #ifdef PNG_READ_pHYs_SUPPORTED
+   png_debug(1, "in png_get_pixel_aspect_ratio");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_pHYs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
-
       if (info_ptr->x_pixels_per_unit != 0)
-         return ((float)((float)info_ptr->y_pixels_per_unit
-             /(float)info_ptr->x_pixels_per_unit));
+         return (float)info_ptr->y_pixels_per_unit
+              / (float)info_ptr->x_pixels_per_unit;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return ((float)0.0);
+   return (float)0.0;
 }
 #endif
 
@@ -245,6 +243,8 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
     png_const_inforp info_ptr)
 {
 #ifdef PNG_READ_pHYs_SUPPORTED
+   png_debug(1, "in png_get_pixel_aspect_ratio_fixed");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_pHYs) != 0 &&
        info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
@@ -253,8 +253,6 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
    {
       png_fixed_point res;
 
-      png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed");
-
       /* The following casts work because a PNG 4 byte integer only has a valid
        * range of 0..2^31-1; otherwise the cast might overflow.
        */
@@ -275,80 +273,80 @@ png_int_32 PNGAPI
 png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
+   png_debug(1, "in png_get_x_offset_microns");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_oFFs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
-
       if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
-         return (info_ptr->x_offset);
+         return info_ptr->x_offset;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 png_int_32 PNGAPI
 png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
+   png_debug(1, "in png_get_y_offset_microns");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_oFFs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
-
       if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
-         return (info_ptr->y_offset);
+         return info_ptr->y_offset;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 png_int_32 PNGAPI
 png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
+   png_debug(1, "in png_get_x_offset_pixels");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_oFFs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
-
       if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
-         return (info_ptr->x_offset);
+         return info_ptr->x_offset;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 png_int_32 PNGAPI
 png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
+   png_debug(1, "in png_get_y_offset_pixels");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_oFFs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
-
       if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
-         return (info_ptr->y_offset);
+         return info_ptr->y_offset;
    }
 #else
    PNG_UNUSED(png_ptr)
    PNG_UNUSED(info_ptr)
 #endif
 
-   return (0);
+   return 0;
 }
 
 #ifdef PNG_INCH_CONVERSIONS_SUPPORTED
@@ -462,11 +460,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
 {
    png_uint_32 retval = 0;
 
+   png_debug1(1, "in %s retrieval function", "pHYs");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_pHYs) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "pHYs");
-
       if (res_x != NULL)
       {
          *res_x = info_ptr->x_pixels_per_unit;
@@ -492,7 +490,7 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
       }
    }
 
-   return (retval);
+   return retval;
 }
 #endif /* pHYs */
 #endif /* INCH_CONVERSIONS */
@@ -506,9 +504,9 @@ png_byte PNGAPI
 png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
    if (png_ptr != NULL && info_ptr != NULL)
-      return(info_ptr->channels);
+      return info_ptr->channels;
 
-   return (0);
+   return 0;
 }
 
 #ifdef PNG_READ_SUPPORTED
@@ -516,9 +514,9 @@ png_const_bytep PNGAPI
 png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
    if (png_ptr != NULL && info_ptr != NULL)
-      return(info_ptr->signature);
+      return info_ptr->signature;
 
-   return (NULL);
+   return NULL;
 }
 #endif
 
@@ -527,17 +525,17 @@ png_uint_32 PNGAPI
 png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
     png_color_16p *background)
 {
+   png_debug1(1, "in %s retrieval function", "bKGD");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_bKGD) != 0 &&
        background != NULL)
    {
-      png_debug1(1, "in %s retrieval function", "bKGD");
-
       *background = &(info_ptr->background);
-      return (PNG_INFO_bKGD);
+      return PNG_INFO_bKGD;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -552,6 +550,8 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
     double *white_x, double *white_y, double *red_x, double *red_y,
     double *green_x, double *green_y, double *blue_x, double *blue_y)
 {
+   png_debug1(1, "in %s retrieval function", "cHRM");
+
    /* Quiet API change: this code used to only return the end points if a cHRM
     * chunk was present, but the end points can also come from iCCP or sRGB
     * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
@@ -561,8 +561,6 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
    if (png_ptr != NULL && info_ptr != NULL &&
       (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "cHRM");
-
       if (white_x != NULL)
          *white_x = png_float(png_ptr,
              info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
@@ -587,10 +585,10 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
       if (blue_y != NULL)
          *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
              "cHRM blue Y");
-      return (PNG_INFO_cHRM);
+      return PNG_INFO_cHRM;
    }
 
-   return (0);
+   return 0;
 }
 
 png_uint_32 PNGAPI
@@ -599,11 +597,11 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
     double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
     double *blue_Z)
 {
+   png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
-
       if (red_X != NULL)
          *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
              "cHRM red X");
@@ -631,10 +629,10 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
       if (blue_Z != NULL)
          *blue_Z = png_float(png_ptr,
              info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
-      return (PNG_INFO_cHRM);
+      return PNG_INFO_cHRM;
    }
 
-   return (0);
+   return 0;
 }
 #  endif
 
@@ -647,11 +645,11 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
     png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
     png_fixed_point *int_blue_Z)
 {
+   png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
+
    if (png_ptr != NULL && info_ptr != NULL &&
       (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
-
       if (int_red_X != NULL)
          *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
       if (int_red_Y != NULL)
@@ -670,10 +668,10 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
          *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
       if (int_blue_Z != NULL)
          *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
-      return (PNG_INFO_cHRM);
+      return PNG_INFO_cHRM;
    }
 
-   return (0);
+   return 0;
 }
 
 png_uint_32 PNGAPI
@@ -703,10 +701,10 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
          *blue_x = info_ptr->colorspace.end_points_xy.bluex;
       if (blue_y != NULL)
          *blue_y = info_ptr->colorspace.end_points_xy.bluey;
-      return (PNG_INFO_cHRM);
+      return PNG_INFO_cHRM;
    }
 
-   return (0);
+   return 0;
 }
 #  endif
 #endif
@@ -724,10 +722,10 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
        file_gamma != NULL)
    {
       *file_gamma = info_ptr->colorspace.gamma;
-      return (PNG_INFO_gAMA);
+      return PNG_INFO_gAMA;
    }
 
-   return (0);
+   return 0;
 }
 #  endif
 
@@ -744,10 +742,10 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
    {
       *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
           "png_get_gAMA");
-      return (PNG_INFO_gAMA);
+      return PNG_INFO_gAMA;
    }
 
-   return (0);
+   return 0;
 }
 #  endif
 #endif
@@ -763,10 +761,10 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
       (info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
    {
       *file_srgb_intent = info_ptr->colorspace.rendering_intent;
-      return (PNG_INFO_sRGB);
+      return PNG_INFO_sRGB;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -790,10 +788,10 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
        */
       if (compression_type != NULL)
          *compression_type = PNG_COMPRESSION_TYPE_BASE;
-      return (PNG_INFO_iCCP);
+      return PNG_INFO_iCCP;
    }
 
-   return (0);
+   return 0;
 
 }
 #endif
@@ -803,13 +801,15 @@ int PNGAPI
 png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
     png_sPLT_tpp spalettes)
 {
+   png_debug1(1, "in %s retrieval function", "sPLT");
+
    if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
    {
       *spalettes = info_ptr->splt_palettes;
       return info_ptr->splt_palettes_num;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -835,10 +835,10 @@ png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
    {
       *num_exif = info_ptr->num_exif;
       *exif = info_ptr->exif;
-      return (PNG_INFO_eXIf);
+      return PNG_INFO_eXIf;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -853,10 +853,10 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
        (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
    {
       *hist = info_ptr->hist;
-      return (PNG_INFO_hIST);
+      return PNG_INFO_hIST;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -869,7 +869,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
    png_debug1(1, "in %s retrieval function", "IHDR");
 
    if (png_ptr == NULL || info_ptr == NULL)
-      return (0);
+      return 0;
 
    if (width != NULL)
        *width = info_ptr->width;
@@ -901,7 +901,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
        info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
        info_ptr->compression_type, info_ptr->filter_type);
 
-   return (1);
+   return 1;
 }
 
 #ifdef PNG_oFFs_SUPPORTED
@@ -918,10 +918,10 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
       *offset_x = info_ptr->x_offset;
       *offset_y = info_ptr->y_offset;
       *unit_type = (int)info_ptr->offset_unit_type;
-      return (PNG_INFO_oFFs);
+      return PNG_INFO_oFFs;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -945,10 +945,10 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
       *nparams = (int)info_ptr->pcal_nparams;
       *units = info_ptr->pcal_units;
       *params = info_ptr->pcal_params;
-      return (PNG_INFO_pCAL);
+      return PNG_INFO_pCAL;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -960,6 +960,8 @@ png_uint_32 PNGAPI
 png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
     int *unit, png_fixed_point *width, png_fixed_point *height)
 {
+   png_debug1(1, "in %s retrieval function", "sCAL");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_sCAL) != 0)
    {
@@ -971,10 +973,10 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
       *width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
       *height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
           "sCAL height");
-      return (PNG_INFO_sCAL);
+      return PNG_INFO_sCAL;
    }
 
-   return(0);
+   return 0;
 }
 #    endif /* FLOATING_ARITHMETIC */
 #  endif /* FIXED_POINT */
@@ -983,32 +985,36 @@ png_uint_32 PNGAPI
 png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
     int *unit, double *width, double *height)
 {
+   png_debug1(1, "in %s retrieval function", "sCAL(float)");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_sCAL) != 0)
    {
       *unit = info_ptr->scal_unit;
       *width = atof(info_ptr->scal_s_width);
       *height = atof(info_ptr->scal_s_height);
-      return (PNG_INFO_sCAL);
+      return PNG_INFO_sCAL;
    }
 
-   return(0);
+   return 0;
 }
 #  endif /* FLOATING POINT */
 png_uint_32 PNGAPI
 png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
     int *unit, png_charpp width, png_charpp height)
 {
+   png_debug1(1, "in %s retrieval function", "sCAL(str)");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_sCAL) != 0)
    {
       *unit = info_ptr->scal_unit;
       *width = info_ptr->scal_s_width;
       *height = info_ptr->scal_s_height;
-      return (PNG_INFO_sCAL);
+      return PNG_INFO_sCAL;
    }
 
-   return(0);
+   return 0;
 }
 #endif /* sCAL */
 
@@ -1043,7 +1049,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
       }
    }
 
-   return (retval);
+   return retval;
 }
 #endif /* pHYs */
 
@@ -1059,10 +1065,10 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
       *palette = info_ptr->palette;
       *num_palette = info_ptr->num_palette;
       png_debug1(3, "num_palette = %d", *num_palette);
-      return (PNG_INFO_PLTE);
+      return PNG_INFO_PLTE;
    }
 
-   return (0);
+   return 0;
 }
 
 #ifdef PNG_sBIT_SUPPORTED
@@ -1076,10 +1082,10 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
        (info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
    {
       *sig_bit = &(info_ptr->sig_bit);
-      return (PNG_INFO_sBIT);
+      return PNG_INFO_sBIT;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -1090,7 +1096,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
 {
    if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
    {
-      png_debug1(1, "in 0x%lx retrieval function",
+      png_debug1(1, "in text retrieval function, chunk typeid = 0x%lx",
          (unsigned long)png_ptr->chunk_name);
 
       if (text_ptr != NULL)
@@ -1105,7 +1111,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
    if (num_text != NULL)
       *num_text = 0;
 
-   return(0);
+   return 0;
 }
 #endif
 
@@ -1120,10 +1126,10 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
        (info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
    {
       *mod_time = &(info_ptr->mod_time);
-      return (PNG_INFO_tIME);
+      return PNG_INFO_tIME;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -1133,11 +1139,12 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
     png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
 {
    png_uint_32 retval = 0;
+
+   png_debug1(1, "in %s retrieval function", "tRNS");
+
    if (png_ptr != NULL && info_ptr != NULL &&
        (info_ptr->valid & PNG_INFO_tRNS) != 0)
    {
-      png_debug1(1, "in %s retrieval function", "tRNS");
-
       if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       {
          if (trans_alpha != NULL)
@@ -1169,7 +1176,7 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
       }
    }
 
-   return (retval);
+   return retval;
 }
 #endif
 
@@ -1184,7 +1191,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
       return info_ptr->unknown_chunks_num;
    }
 
-   return (0);
+   return 0;
 }
 #endif
 
@@ -1280,7 +1287,7 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
    if (png_ptr != NULL && info_ptr != NULL)
       return png_ptr->num_palette_max;
 
-   return (-1);
+   return -1;
 }
 #  endif
 #endif
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
index e98d49cf0cc..e238ccdb9a4 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
@@ -31,7 +31,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  */
-/* libpng version 1.6.40 */
+/* libpng version 1.6.43 */
 
 /* Copyright (c) 2018-2023 Cosmin Truta */
 /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
index a98b2013256..816631cae18 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -173,10 +173,10 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
        num_to_check);
    png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
 
-   if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
+   if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
    {
       if (num_checked < 4 &&
-          png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
+          png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
          png_error(png_ptr, "Not a PNG file");
 
       else
@@ -322,6 +322,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
       png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
    }
 
+#endif
+#ifdef PNG_READ_eXIf_SUPPORTED
+   else if (png_ptr->chunk_name == png_eXIf)
+   {
+      PNG_PUSH_SAVE_BUFFER_IF_FULL
+      png_handle_eXIf(png_ptr, info_ptr, png_ptr->push_length);
+   }
+
 #endif
 #ifdef PNG_READ_sRGB_SUPPORTED
    else if (chunk_name == png_sRGB)
@@ -1117,7 +1125,7 @@ png_voidp PNGAPI
 png_get_progressive_ptr(png_const_structrp png_ptr)
 {
    if (png_ptr == NULL)
-      return (NULL);
+      return NULL;
 
    return png_ptr->io_ptr;
 }
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
index 914d0b97b1d..18424542b00 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2023 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -64,7 +64,7 @@
  * still required (as of 2011-05-02.)
  */
 #ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+#  define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
 #endif
 
 #ifndef PNG_VERSION_INFO_ONLY
@@ -218,13 +218,27 @@
 #endif /* PNG_ARM_NEON_OPT > 0 */
 
 #ifndef PNG_MIPS_MSA_OPT
-#  if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
+#  if defined(__mips_msa) && (__mips_isa_rev >= 5) && \
+   defined(PNG_ALIGNED_MEMORY_SUPPORTED)
 #     define PNG_MIPS_MSA_OPT 2
 #  else
 #     define PNG_MIPS_MSA_OPT 0
 #  endif
 #endif
 
+#ifndef PNG_MIPS_MMI_OPT
+#  ifdef PNG_MIPS_MMI
+#    if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) && \
+     defined(PNG_ALIGNED_MEMORY_SUPPORTED)
+#       define PNG_MIPS_MMI_OPT 1
+#    else
+#       define PNG_MIPS_MMI_OPT 0
+#    endif
+#  else
+#    define PNG_MIPS_MMI_OPT 0
+#  endif
+#endif
+
 #ifndef PNG_POWERPC_VSX_OPT
 #  if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
 #     define PNG_POWERPC_VSX_OPT 2
@@ -233,13 +247,21 @@
 #  endif
 #endif
 
+#ifndef PNG_LOONGARCH_LSX_OPT
+#  if defined(__loongarch_sx)
+#     define PNG_LOONGARCH_LSX_OPT 1
+#  else
+#     define PNG_LOONGARCH_LSX_OPT 0
+#  endif
+#endif
+
 #ifndef PNG_INTEL_SSE_OPT
 #   ifdef PNG_INTEL_SSE
       /* Only check for SSE if the build configuration has been modified to
        * enable SSE optimizations.  This means that these optimizations will
        * be off by default.  See contrib/intel for more details.
        */
-#     if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
+#      if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
        defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
        (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
 #         define PNG_INTEL_SSE_OPT 1
@@ -276,7 +298,6 @@
 #endif
 
 #if PNG_MIPS_MSA_OPT > 0
-#  define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
 #  ifndef PNG_MIPS_MSA_IMPLEMENTATION
 #     if defined(__mips_msa)
 #        if defined(__clang__)
@@ -292,11 +313,28 @@
 
 #  ifndef PNG_MIPS_MSA_IMPLEMENTATION
 #     define PNG_MIPS_MSA_IMPLEMENTATION 1
+#     define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
 #  endif
 #else
 #  define PNG_MIPS_MSA_IMPLEMENTATION 0
 #endif /* PNG_MIPS_MSA_OPT > 0 */
 
+#if PNG_MIPS_MMI_OPT > 0
+#  ifndef PNG_MIPS_MMI_IMPLEMENTATION
+#     if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64)
+#        define PNG_MIPS_MMI_IMPLEMENTATION 2
+#     else /* !defined __mips_loongson_mmi  || _MIPS_SIM != _ABI64 */
+#        define PNG_MIPS_MMI_IMPLEMENTATION 0
+#     endif /* __mips_loongson_mmi  && _MIPS_SIM == _ABI64 */
+#  endif /* !PNG_MIPS_MMI_IMPLEMENTATION */
+
+#   if PNG_MIPS_MMI_IMPLEMENTATION > 0
+#      define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
+#   endif
+#else
+#   define PNG_MIPS_MMI_IMPLEMENTATION 0
+#endif /* PNG_MIPS_MMI_OPT > 0 */
+
 #if PNG_POWERPC_VSX_OPT > 0
 #  define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
 #  define PNG_POWERPC_VSX_IMPLEMENTATION 1
@@ -304,6 +342,12 @@
 #  define PNG_POWERPC_VSX_IMPLEMENTATION 0
 #endif
 
+#if PNG_LOONGARCH_LSX_OPT > 0
+#   define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_lsx
+#   define PNG_LOONGARCH_LSX_IMPLEMENTATION 1
+#else
+#   define PNG_LOONGARCH_LSX_IMPLEMENTATION 0
+#endif
 
 /* Is this a build of a DLL where compilation of the object modules requires
  * different preprocessor settings to those required for a simple library?  If
@@ -542,18 +586,8 @@
     */
 #  include 
 
-#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
-    defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
-   /* We need to check that  hasn't already been included earlier
-    * as it seems it doesn't agree with , yet we should really use
-    *  if possible.
-    */
-#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-#      include 
-#    endif
-#  else
-#    include 
-#  endif
+#  include 
+
 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
    /* Amiga SAS/C: We must include builtin FPU functions when compiling using
     * MATH=68881
@@ -1334,7 +1368,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
     row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
 #endif
 
-#if PNG_MIPS_MSA_OPT > 0
+#if PNG_MIPS_MSA_IMPLEMENTATION == 1
 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
     png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
@@ -1351,6 +1385,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
     row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
 #endif
 
+#if PNG_MIPS_MMI_IMPLEMENTATION > 0
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_mmi,(png_row_infop row_info,
+    png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_mmi,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_mmi,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_mmi,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_mmi,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_mmi,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_mmi,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+#endif
+
 #if PNG_POWERPC_VSX_OPT > 0
 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
     png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
@@ -1383,6 +1434,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
     row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
 #endif
 
+#if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop
+    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+#endif
+
 /* Choose the best filter to use and filter the row data */
 PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
     png_row_infop row_info),PNG_EMPTY);
@@ -2122,17 +2190,27 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
 #endif
 
-#if PNG_MIPS_MSA_OPT > 0
-PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
+#if PNG_MIPS_MSA_IMPLEMENTATION == 1
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
 #endif
 
+#  if PNG_MIPS_MMI_IMPLEMENTATION > 0
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
+   (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+#  endif
+
 #  if PNG_INTEL_SSE_IMPLEMENTATION > 0
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
 #  endif
 #endif
 
+#if PNG_LOONGARCH_LSX_OPT > 0
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx,
+    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+#endif
+
 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
    png_const_charp key, png_bytep new_key), PNG_EMPTY);
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
index 3631e60f36b..e9e94477545 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2019 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -596,7 +596,11 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
 #endif
 
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
-   if (png_ptr->transformations)
+   if (png_ptr->transformations
+#     ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
+         || png_ptr->num_palette_max >= 0
+#     endif
+      )
       png_do_read_transformations(png_ptr, &row_info);
 #endif
 
@@ -813,7 +817,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
 #ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
    /* Report invalid palette index; added at libng-1.5.10 */
    if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
-       png_ptr->num_palette_max > png_ptr->num_palette)
+       png_ptr->num_palette_max >= png_ptr->num_palette)
       png_benign_error(png_ptr, "Read palette index exceeding num_palette");
 #endif
 
@@ -1077,6 +1081,8 @@ void PNGAPI
 png_read_png(png_structrp png_ptr, png_inforp info_ptr,
     int transforms, voidp params)
 {
+   png_debug(1, "in png_read_png");
+
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
index 843eb5fff2a..a393de4b79d 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2019 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -318,21 +318,20 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
    int compose = 0;
    png_fixed_point file_gamma;
 
-   png_debug(1, "in png_set_alpha_mode");
+   png_debug(1, "in png_set_alpha_mode_fixed");
 
    if (png_rtran_ok(png_ptr, 0) == 0)
       return;
 
    output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
 
-   /* Validate the value to ensure it is in a reasonable range. The value
+   /* Validate the value to ensure it is in a reasonable range.  The value
     * is expected to be 1 or greater, but this range test allows for some
-    * viewing correction values.  The intent is to weed out users of this API
-    * who use the inverse of the gamma value accidentally!  Since some of these
-    * values are reasonable this may have to be changed:
+    * viewing correction values.  The intent is to weed out the API users
+    * who might use the inverse of the gamma value accidentally!
     *
-    * 1.6.x: changed from 0.07..3 to 0.01..100 (to accommodate the optimal 16-bit
-    * gamma of 36, and its reciprocal.)
+    * In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate
+    * the optimal 16-bit gamma of 36 and its reciprocal.
     */
    if (output_gamma < 1000 || output_gamma > 10000000)
       png_error(png_ptr, "output gamma out of expected range");
@@ -469,7 +468,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
       int i;
 
       png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
-          (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
+          (png_alloc_size_t)num_palette);
       for (i = 0; i < num_palette; i++)
          png_ptr->quantize_index[i] = (png_byte)i;
    }
@@ -486,7 +485,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
 
          /* Initialize an array to sort colors */
          png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
-             (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
+             (png_alloc_size_t)num_palette);
 
          /* Initialize the quantize_sort array */
          for (i = 0; i < num_palette; i++)
@@ -620,11 +619,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
 
          /* Initialize palette index arrays */
          png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
-             (png_alloc_size_t)((png_uint_32)num_palette *
-             (sizeof (png_byte))));
+             (png_alloc_size_t)num_palette);
          png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
-             (png_alloc_size_t)((png_uint_32)num_palette *
-             (sizeof (png_byte))));
+             (png_alloc_size_t)num_palette);
 
          /* Initialize the sort array */
          for (i = 0; i < num_palette; i++)
@@ -789,12 +786,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
       size_t num_entries = ((size_t)1 << total_bits);
 
       png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
-          (png_alloc_size_t)(num_entries * (sizeof (png_byte))));
+          (png_alloc_size_t)(num_entries));
 
-      distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
-          (sizeof (png_byte))));
+      distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)num_entries);
 
-      memset(distance, 0xff, num_entries * (sizeof (png_byte)));
+      memset(distance, 0xff, num_entries);
 
       for (i = 0; i < num_palette; i++)
       {
@@ -998,7 +994,7 @@ void PNGFAPI
 png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
     png_fixed_point red, png_fixed_point green)
 {
-   png_debug(1, "in png_set_rgb_to_gray");
+   png_debug(1, "in png_set_rgb_to_gray_fixed");
 
    /* Need the IHDR here because of the check on color_type below. */
    /* TODO: fix this */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
index 524297c5a10..5280140d12b 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2022 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -54,7 +54,7 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
    if (uval > PNG_UINT_31_MAX)
       png_error(png_ptr, "PNG unsigned integer out of range");
 
-   return (uval);
+   return uval;
 }
 
 #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
@@ -168,7 +168,7 @@ png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
    if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
    {
       if (num_checked < 4 &&
-          png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
+          png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
          png_error(png_ptr, "Not a PNG file");
       else
          png_error(png_ptr, "PNG file corrupted by ASCII conversion");
@@ -199,7 +199,7 @@ png_read_chunk_header(png_structrp png_ptr)
    /* Put the chunk name into png_ptr->chunk_name. */
    png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
 
-   png_debug2(0, "Reading %lx chunk, length = %lu",
+   png_debug2(0, "Reading chunk typeid = 0x%lx, length = %lu",
        (unsigned long)png_ptr->chunk_name, (unsigned long)length);
 
    /* Reset the crc and run it over the chunk name. */
@@ -266,10 +266,10 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
       else
          png_chunk_error(png_ptr, "CRC error");
 
-      return (1);
+      return 1;
    }
 
-   return (0);
+   return 0;
 }
 
 /* Compare the CRC stored in the PNG file with that calculated by libpng from
@@ -305,11 +305,11 @@ png_crc_error(png_structrp png_ptr)
    if (need_crc != 0)
    {
       crc = png_get_uint_32(crc_bytes);
-      return ((int)(crc != png_ptr->crc));
+      return crc != png_ptr->crc;
    }
 
    else
-      return (0);
+      return 0;
 }
 
 #if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
@@ -449,8 +449,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
             png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
       }
 
-#if ZLIB_VERNUM >= 0x1290 && \
-   defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
+#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
       if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
          /* Turn off validation of the ADLER32 checksum in IDAT chunks */
          ret = inflateValidate(&png_ptr->zstream, 0);
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
index 62612a02278..f53ab6fa1d1 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2023 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -791,11 +791,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
 {
    int i;
 
-   png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
-      (unsigned long)png_ptr->chunk_name);
+   png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
+      png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
 
    if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
-      return(0);
+      return 0;
 
    /* Make sure we have enough space in the "text" array in info_struct
     * to hold all of the incoming text_ptr objects.  This compare can't overflow
@@ -975,7 +975,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
       png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
    }
 
-   return(0);
+   return 0;
 }
 #endif
 
@@ -1091,6 +1091,8 @@ png_set_sPLT(png_const_structrp png_ptr,
 {
    png_sPLT_tp np;
 
+   png_debug1(1, "in %s storage function", "sPLT");
+
    if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
       return;
 
@@ -1565,7 +1567,7 @@ void PNGAPI
 png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
     png_bytepp row_pointers)
 {
-   png_debug1(1, "in %s storage function", "rows");
+   png_debug(1, "in png_set_rows");
 
    if (png_ptr == NULL || info_ptr == NULL)
       return;
@@ -1584,6 +1586,8 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
 void PNGAPI
 png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
 {
+   png_debug(1, "in png_set_compression_buffer_size");
+
    if (png_ptr == NULL)
       return;
 
@@ -1655,6 +1659,8 @@ void PNGAPI
 png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
     png_uint_32 user_height_max)
 {
+   png_debug(1, "in png_set_user_limits");
+
    /* Images with dimensions larger than these limits will be
     * rejected by png_set_IHDR().  To accept any PNG datastream
     * regardless of dimensions, set both limits to 0x7fffffff.
@@ -1670,6 +1676,8 @@ png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
 void PNGAPI
 png_set_chunk_cache_max(png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
 {
+   png_debug(1, "in png_set_chunk_cache_max");
+
    if (png_ptr != NULL)
       png_ptr->user_chunk_cache_max = user_chunk_cache_max;
 }
@@ -1679,6 +1687,8 @@ void PNGAPI
 png_set_chunk_malloc_max(png_structrp png_ptr,
     png_alloc_size_t user_chunk_malloc_max)
 {
+   png_debug(1, "in png_set_chunk_malloc_max");
+
    if (png_ptr != NULL)
       png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
 }
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c
index 89a62191b6f..2350057e70e 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018 Cosmin Truta
+ * Copyright (c) 2018-2024 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -131,10 +131,10 @@ png_set_interlace_handling(png_structrp png_ptr)
    if (png_ptr != 0 && png_ptr->interlaced != 0)
    {
       png_ptr->transformations |= PNG_INTERLACE;
-      return (7);
+      return 7;
    }
 
-   return (1);
+   return 1;
 }
 #endif
 
@@ -526,6 +526,8 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
    png_bytep dp = row; /* destination pointer */
    png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
 
+   png_debug(1, "in png_do_strip_channel");
+
    /* At the start sp will point to the first byte to copy and dp to where
     * it is copied to.  ep always points just beyond the end of the row, so
     * the loop simply copies (channels-1) channels until sp reaches ep.
@@ -726,6 +728,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
 void /* PRIVATE */
 png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
 {
+   png_debug(1, "in png_do_check_palette_indexes");
+
    if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
       png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
    {
@@ -736,7 +740,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
        * forms produced on either GCC or MSVC.
        */
       int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
-      png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
+      png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
 
       switch (row_info->bit_depth)
       {
@@ -861,7 +865,7 @@ png_voidp PNGAPI
 png_get_user_transform_ptr(png_const_structrp png_ptr)
 {
    if (png_ptr == NULL)
-      return (NULL);
+      return NULL;
 
    return png_ptr->user_transform_ptr;
 }

From d6087781bd2c09ef9028b705e55a0174885def1a Mon Sep 17 00:00:00 2001
From: Martin Doerr 
Date: Wed, 5 Jun 2024 08:39:12 +0000
Subject: [PATCH 040/329] 8326106: Write and clear stack trace table outside of
 safepoint

Backport-of: a776104e210db212c4e32894844d3c0cbaac53c3
---
 .../checkpoint/objectSampleCheckpoint.cpp        | 16 ++++++++--------
 .../jfr/recorder/service/jfrRecorderService.cpp  |  4 +---
 .../stacktrace/jfrStackTraceRepository.cpp       |  3 +--
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp
index 8e2a1060528..ed5144d4bfa 100644
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp
@@ -214,9 +214,6 @@ class StackTraceBlobInstaller {
   StackTraceBlobInstaller() : _cache(JfrOptionSet::old_object_queue_size()) {
     prepare_for_resolution();
   }
-  ~StackTraceBlobInstaller() {
-    JfrStackTraceRepository::clear_leak_profiler();
-  }
   void sample_do(ObjectSample* sample) {
     if (stack_trace_precondition(sample)) {
       install(sample);
@@ -270,11 +267,14 @@ void ObjectSampleCheckpoint::on_rotation(const ObjectSampler* sampler) {
   assert(LeakProfiler::is_running(), "invariant");
   JavaThread* const thread = JavaThread::current();
   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(thread);)
-  // can safepoint here
-  ThreadInVMfromNative transition(thread);
-  MutexLocker lock(ClassLoaderDataGraph_lock);
-  // the lock is needed to ensure the unload lists do not grow in the middle of inspection.
-  install_stack_traces(sampler);
+  {
+    // can safepoint here
+    ThreadInVMfromNative transition(thread);
+    MutexLocker lock(ClassLoaderDataGraph_lock);
+    // the lock is needed to ensure the unload lists do not grow in the middle of inspection.
+    install_stack_traces(sampler);
+  }
+  JfrStackTraceRepository::clear_leak_profiler();
 }
 
 static bool is_klass_unloaded(traceid klass_id) {
diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
index 0627593611c..657c5645ae7 100644
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
@@ -543,9 +543,7 @@ void JfrRecorderService::pre_safepoint_write() {
     ObjectSampleCheckpoint::on_rotation(ObjectSampler::acquire());
   }
   write_storage(_storage, _chunkwriter);
-  if (_stack_trace_repository.is_modified()) {
-    write_stacktrace(_stack_trace_repository, _chunkwriter, false);
-  }
+  write_stacktrace(_stack_trace_repository, _chunkwriter, true);
 }
 
 void JfrRecorderService::invoke_safepoint_write() {
diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
index 82f3362d6ee..1e940ef6f97 100644
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
@@ -98,11 +98,10 @@ bool JfrStackTraceRepository::is_modified() const {
 }
 
 size_t JfrStackTraceRepository::write(JfrChunkWriter& sw, bool clear) {
+  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
   if (_entries == 0) {
     return 0;
   }
-  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
-  assert(_entries > 0, "invariant");
   int count = 0;
   for (u4 i = 0; i < TABLE_SIZE; ++i) {
     JfrStackTrace* stacktrace = _table[i];

From d1e909fda898127923da088391fa82cc02543f34 Mon Sep 17 00:00:00 2001
From: Martin Doerr 
Date: Wed, 5 Jun 2024 08:39:25 +0000
Subject: [PATCH 041/329] 8324933: ConcurrentHashTable::statistics_calculate
 synchronization is expensive

Reviewed-by: phh
Backport-of: 0e2fdc95ae47c11e6a1e47cdc6190268e29a9d9c
---
 .../utilities/concurrentHashTable.inline.hpp  | 31 ++++++++++++-------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp
index 8e8d3a7f268..887cb5e09ee 100644
--- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp
+++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp
@@ -1197,23 +1197,30 @@ template 
 inline TableStatistics ConcurrentHashTable::
   statistics_calculate(Thread* thread, VALUE_SIZE_FUNC& vs_f)
 {
+  constexpr size_t batch_size = 128;
   NumberSeq summary;
   size_t literal_bytes = 0;
   InternalTable* table = get_table();
-  for (size_t bucket_it = 0; bucket_it < table->_size; bucket_it++) {
+  size_t num_batches = table->_size / batch_size;
+  for (size_t batch_start = 0; batch_start < _table->_size; batch_start += batch_size) {
+    // We batch the use of ScopedCS here as it has been found to be quite expensive to
+    // invoke it for every single bucket.
+    size_t batch_end = MIN2(batch_start + batch_size, _table->_size);
     ScopedCS cs(thread, this);
-    size_t count = 0;
-    Bucket* bucket = table->get_bucket(bucket_it);
-    if (bucket->have_redirect() || bucket->is_locked()) {
-      continue;
-    }
-    Node* current_node = bucket->first();
-    while (current_node != NULL) {
-      ++count;
-      literal_bytes += vs_f(current_node->value());
-      current_node = current_node->next();
+    for (size_t bucket_it = batch_start; bucket_it < batch_end; bucket_it++) {
+      size_t count = 0;
+      Bucket* bucket = table->get_bucket(bucket_it);
+      if (bucket->have_redirect() || bucket->is_locked()) {
+        continue;
+      }
+      Node* current_node = bucket->first();
+      while (current_node != nullptr) {
+        ++count;
+        literal_bytes += vs_f(current_node->value());
+        current_node = current_node->next();
+      }
+      summary.add((double)count);
     }
-    summary.add((double)count);
   }
 
   return TableStatistics(_stats_rate, summary, literal_bytes, sizeof(Bucket), sizeof(Node));

From ab84520d73a63601d75e45895663d8216ca20962 Mon Sep 17 00:00:00 2001
From: Martin Doerr 
Date: Wed, 5 Jun 2024 08:39:55 +0000
Subject: [PATCH 042/329] 8305825: getBounds API returns wrong value resulting
 in multiple Regression Test Failures on Ubuntu 23.04

Reviewed-by: mbaesken
Backport-of: 7723611d5d5f8959d69d1000fa117166e3d3c5fb
---
 .../unix/classes/sun/awt/X11/XWM.java         |  4 +++
 test/jdk/ProblemList.txt                      |  2 ++
 .../Modal/NestedModalDialogTest.java          | 25 +++++++++++--------
 .../OwnedWindowFocusIMECrashTest.java         |  3 ++-
 .../MultiResolutionSplashTest.java            |  4 ++-
 .../swing/JRootPane/DefaultButtonTest.java    |  5 +++-
 .../swing/JTree/8003400/Test8003400.java      |  6 ++++-
 7 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWM.java b/src/java.desktop/unix/classes/sun/awt/X11/XWM.java
index 409b12b1425..0365bffebcb 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWM.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XWM.java
@@ -1369,6 +1369,9 @@ Insets guessInsets(XDecoratedPeer window) {
               case UNITY_COMPIZ_WM:
                   res = new Insets(28, 1, 1, 1);
                   break;
+              case MUTTER_WM:
+                  res = new Insets(37, 0, 0, 0);
+                  break;
               case MOTIF_WM:
               case OPENLOOK_WM:
               default:
@@ -1380,6 +1383,7 @@ Insets guessInsets(XDecoratedPeer window) {
         }
         return res;
     }
+
     /*
      * Some buggy WMs ignore window gravity when processing
      * ConfigureRequest and position window as if the gravity is Static.
diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 45e41860542..9e7ed05a5aa 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -505,6 +505,7 @@ java/awt/MenuBar/TestNoScreenMenuBar.java 8265987 macosx-all
 java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-all
 java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all
 java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64
+java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all
 
 java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
 java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
@@ -682,6 +683,7 @@ javax/sound/midi/Sequencer/Looping.java 8136897 generic-all
 javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all
 
 javax/swing/JComponent/6683775/bug6683775.java 8172337 generic-all
+javax/swing/JFrame/MaximizeWindowTest.java 8321289 linux-all
 javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedTranslucentPerPixelTranslucentGradient.java 8233582 linux-all
 javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java 8233582 linux-all
 javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java 8194128 macosx-all
diff --git a/test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java b/test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java
index f5d85d8a2ad..c7ec4d66000 100644
--- a/test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java
+++ b/test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2023, 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
@@ -54,12 +54,11 @@
 import java.awt.event.KeyEvent;
 
 public class NestedModalDialogTest {
-    private static Frame frame;
+    private static StartFrame frame;
     private static IntermediateDialog interDiag;
     private static TextDialog txtDiag;
 
     // Global variables so the robot thread can locate things.
-    private static Button[] robot_button = new Button[2];
     private static TextField robot_text = null;
     private static Robot robot = null;
 
@@ -78,6 +77,9 @@ private static void blockTillDisplayed(Component comp) {
     }
 
     private static void clickOnComp(Component comp) {
+        robot.waitForIdle();
+        robot.delay(1000);
+
         Rectangle bounds = new Rectangle(comp.getLocationOnScreen(), comp.getSize());
         robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
         robot.waitForIdle();
@@ -94,11 +96,11 @@ public void testModalDialogs() throws Exception {
             // launch first frame with firstButton
             frame = new StartFrame();
             blockTillDisplayed(frame);
-            clickOnComp(robot_button[0]);
+            clickOnComp(frame.button);
 
             // Dialog must be created and onscreen before we proceed.
             blockTillDisplayed(interDiag);
-            clickOnComp(robot_button[1]);
+            clickOnComp(interDiag.button);
 
             // Again, the Dialog must be created and onscreen before we proceed.
             blockTillDisplayed(robot_text);
@@ -144,6 +146,8 @@ public void testModalDialogs() throws Exception {
      */
     class StartFrame extends Frame {
 
+        public volatile Button button;
+
         /**
          * Constructs a new instance.
          */
@@ -168,7 +172,7 @@ public void actionPerformed(ActionEvent e) {
             pan.add(but);
             add(pan);
             setVisible(true);
-            robot_button[0] = but;
+            button = but;
         }
     }
 
@@ -177,6 +181,7 @@ public void actionPerformed(ActionEvent e) {
     class IntermediateDialog extends Dialog {
 
         Dialog m_parent;
+        public volatile Button button;
 
         public IntermediateDialog(Frame parent) {
             super(parent, "Intermediate Modal", true /*Modal*/);
@@ -193,9 +198,7 @@ public void actionPerformed(ActionEvent e) {
             pan.add(but);
             add(pan);
             pack();
-
-            // The robot needs to know about us, so set global
-            robot_button[1] = but;
+            button = but;
         }
     }
 
@@ -215,12 +218,12 @@ public TextDialog(Dialog parent) {
         }
     }
 
-    public static void main(String[] args) throws RuntimeException, Exception {
+    public static void main(String[] args) throws Exception {
         try {
             new NestedModalDialogTest().testModalDialogs();
         } catch (Exception e) {
             throw new RuntimeException("NestedModalDialogTest object creation "
-                    + "failed");
+                    + "failed", e);
         }
     }
 }
diff --git a/test/jdk/java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java b/test/jdk/java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java
index 6fe6b6a1fa5..f81b25cb1d4 100644
--- a/test/jdk/java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java
+++ b/test/jdk/java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2023, 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,6 +64,7 @@ public void start() {
         window.setVisible(true);
 
         Util.waitForIdle(robot);
+        robot.delay(1000);
 
         test();
 
diff --git a/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java b/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
index 6018d044a61..1f2de081cce 100644
--- a/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
+++ b/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2023, 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
@@ -120,6 +120,7 @@ static void testSplash(ImageInfo test) throws Exception {
     static void testFocus() throws Exception {
 
         Robot robot = new Robot();
+        robot.setAutoWaitForIdle(true);
         robot.setAutoDelay(50);
 
         Frame frame = new Frame();
@@ -130,6 +131,7 @@ static void testFocus() throws Exception {
         frame.add(textField);
         frame.setVisible(true);
         robot.waitForIdle();
+        robot.delay(1000);
 
         robot.keyPress(KeyEvent.VK_A);
         robot.keyRelease(KeyEvent.VK_A);
diff --git a/test/jdk/javax/swing/JRootPane/DefaultButtonTest.java b/test/jdk/javax/swing/JRootPane/DefaultButtonTest.java
index 560c5d82331..784cd00c244 100644
--- a/test/jdk/javax/swing/JRootPane/DefaultButtonTest.java
+++ b/test/jdk/javax/swing/JRootPane/DefaultButtonTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023, 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
@@ -83,6 +83,7 @@ private void createUI() {
 
     public void runTest() throws Exception {
         Robot robot = new Robot();
+        robot.setAutoWaitForIdle(true);
         robot.setAutoDelay(100);
         for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
             try {
@@ -100,6 +101,8 @@ public void runTest() throws Exception {
                     createUI();
                 });
                 robot.waitForIdle();
+                robot.delay(1000);
+
                 robot.keyPress(KeyEvent.VK_ENTER);
                 robot.keyRelease(KeyEvent.VK_ENTER);
                 robot.waitForIdle();
diff --git a/test/jdk/javax/swing/JTree/8003400/Test8003400.java b/test/jdk/javax/swing/JTree/8003400/Test8003400.java
index 95f5e826aa9..dcc9b0fce6e 100644
--- a/test/jdk/javax/swing/JTree/8003400/Test8003400.java
+++ b/test/jdk/javax/swing/JTree/8003400/Test8003400.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2023, 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
@@ -109,6 +109,10 @@ public void run() {
 
                 Robot robot = new Robot();
                 robot.setAutoDelay(100);
+                robot.setAutoWaitForIdle(true);
+                robot.waitForIdle();
+                robot.delay(500);
+
                 SwingUtilities.invokeAndWait(() -> {
                     point = tree.getLocationOnScreen();
                     rect = tree.getBounds();

From 7d0d793ea51e7996ec716034841c88ec4d1cd6b3 Mon Sep 17 00:00:00 2001
From: Elif Aslan 
Date: Wed, 5 Jun 2024 16:59:21 +0000
Subject: [PATCH 043/329] 8233725: ProcessTools.startProcess() has output
 issues when using an OutputAnalyzer at the same time 8306946:
 jdk/test/lib/process/ProcessToolsStartProcessTest.java fails with "wrong
 number of lines in OutputAnalyzer output"

Reviewed-by: shade
Backport-of: 2e340e855b760e381793107f2a4d74095bd40199
---
 test/jdk/sun/tools/jstatd/JstatdTest.java     |   7 +-
 .../process/ProcessToolsStartProcessTest.java | 113 +++++++++++++++++
 .../jdk/test/lib/process/ProcessTools.java    | 116 ++++++++++++++++--
 3 files changed, 222 insertions(+), 14 deletions(-)
 create mode 100644 test/lib-test/jdk/test/lib/process/ProcessToolsStartProcessTest.java

diff --git a/test/jdk/sun/tools/jstatd/JstatdTest.java b/test/jdk/sun/tools/jstatd/JstatdTest.java
index c603ed1096c..bec5ee4582e 100644
--- a/test/jdk/sun/tools/jstatd/JstatdTest.java
+++ b/test/jdk/sun/tools/jstatd/JstatdTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2023, 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
@@ -356,7 +356,10 @@ private void runTest(boolean useShortSyntax) throws Throwable {
 
         // Verify output from jstatd
         OutputAnalyzer output = jstatdThread.getOutput();
-        output.shouldBeEmptyIgnoreVMWarnings();
+        List stdout = output.asLinesWithoutVMWarnings();
+        output.reportDiagnosticSummary();
+        assertEquals(stdout.size(), 1, "Output should contain one line");
+        assertTrue(stdout.get(0).startsWith("jstatd started"), "List should start with 'jstatd started'");
         assertNotEquals(output.getExitValue(), 0,
                 "jstatd process exited with unexpected exit code");
     }
diff --git a/test/lib-test/jdk/test/lib/process/ProcessToolsStartProcessTest.java b/test/lib-test/jdk/test/lib/process/ProcessToolsStartProcessTest.java
new file mode 100644
index 00000000000..02c10c61066
--- /dev/null
+++ b/test/lib-test/jdk/test/lib/process/ProcessToolsStartProcessTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2023, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Unit test for ProcessTools.startProcess()
+ * @library /test/lib
+ * @compile ProcessToolsStartProcessTest.java
+ * @run main ProcessToolsStartProcessTest
+ */
+
+import java.util.function.Consumer;
+import java.io.File;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class ProcessToolsStartProcessTest {
+    static String output = "";
+
+    private static Consumer outputConsumer = s -> {
+        output += s + "\n";
+    };
+
+    static boolean testStartProcess(int numOfLines, boolean withConsumer) throws Exception {
+        boolean success = true;
+        output = "";
+        Process p;
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+        launcher.addToolArg("-cp");
+        launcher.addToolArg(Utils.TEST_CLASSES);
+        launcher.addToolArg("ProcessToolsStartProcessTest");
+        launcher.addToolArg(Integer.toString(numOfLines));
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.command(launcher.getCommand());
+
+        System.out.println("DEBUG: Test with withConsumer=" + withConsumer);
+        System.out.println("DEBUG: about to start process.");
+        if (withConsumer) {
+            p = ProcessTools.startProcess("java", pb, outputConsumer);
+        } else {
+            p = ProcessTools.startProcess("java", pb);
+        }
+        OutputAnalyzer out = new OutputAnalyzer(p);
+
+        System.out.println("DEBUG: process started.");
+        p.waitFor();
+        if (p.exitValue() != 0) {
+            throw new RuntimeException("Bad exit value: " + p.exitValue());
+        }
+
+        if (withConsumer) {
+            int numLines = output.split("\n").length;
+            if (numLines != numOfLines) {
+                System.out.print("FAILED: wrong number of lines in Consumer output\n");
+                success = false;
+                System.out.print(output);
+            }
+        }
+
+        int numLinesOut = out.getStdout().split("\n").length;
+        if (numLinesOut != numOfLines) {
+            System.out.print("FAILED: wrong number of lines in OutputAnalyzer output\n");
+            System.out.print(out.getStdout());
+            success = false;
+        }
+
+        return success;
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (args.length > 0) {
+            int iter = Integer.parseInt(args[0]);
+            for (int i = 0; i < iter; i++) {
+                System.out.println("A line on stdout: " + i + " " + ".".repeat(i));
+            }
+        } else {
+            for (int i = 1; i < 5; i++) {
+                System.out.println("ITERATION " + i);
+                boolean test1Result = testStartProcess(i * 10 + i, false);
+                if (!test1Result) {
+                    throw new RuntimeException("First test (no consumer) failed. See output for details.");
+                }
+                boolean test2Result = testStartProcess(i * 10 + i, true);
+                if (!test2Result) {
+                    throw new RuntimeException("Second test (with consumer) failed. See output for details.");
+                }
+            }
+        }
+    }
+}
diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java
index 673d24066cd..fdfb81d834d 100644
--- a/test/lib/jdk/test/lib/process/ProcessTools.java
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java
@@ -27,6 +27,7 @@
 import jdk.test.lib.Platform;
 import jdk.test.lib.Utils;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -44,6 +45,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
@@ -68,14 +70,17 @@ protected void processLine(String line) {
             ps.println("[" + prefix + "] " + line);
         }
     }
-
     private ProcessTools() {
     }
 
     /**
      * 

Starts a process from its builder.

* The default redirects of STDOUT and STDERR are started - * + *

+ * Same as + * {@linkplain #startProcess(String, ProcessBuilder, Consumer, Predicate, long, TimeUnit) startProcess} + * {@code (name, processBuilder, null, null, -1, TimeUnit.NANOSECONDS)} + *

* @param name The process name * @param processBuilder The process builder * @return Returns the initialized process @@ -90,11 +95,15 @@ public static Process startProcess(String name, /** *

Starts a process from its builder.

* The default redirects of STDOUT and STDERR are started - *

It is possible to monitor the in-streams via the provided {@code consumer} + *

+ * Same as + * {@linkplain #startProcess(String, ProcessBuilder, Consumer, Predicate, long, TimeUnit) startProcess} + * {@code (name, processBuilder, consumer, null, -1, TimeUnit.NANOSECONDS)} + *

* * @param name The process name - * @param consumer {@linkplain Consumer} instance to process the in-streams * @param processBuilder The process builder + * @param consumer {@linkplain Consumer} instance to process the in-streams * @return Returns the initialized process * @throws IOException */ @@ -105,7 +114,7 @@ public static Process startProcess(String name, throws IOException { try { return startProcess(name, processBuilder, consumer, null, -1, TimeUnit.NANOSECONDS); - } catch (InterruptedException | TimeoutException e) { + } catch (InterruptedException | TimeoutException | CancellationException e) { // will never happen throw new RuntimeException(e); } @@ -115,8 +124,9 @@ public static Process startProcess(String name, *

Starts a process from its builder.

* The default redirects of STDOUT and STDERR are started *

- * It is possible to wait for the process to get to a warmed-up state - * via {@linkplain Predicate} condition on the STDOUT/STDERR + * Same as + * {@linkplain #startProcess(String, ProcessBuilder, Consumer, Predicate, long, TimeUnit) startProcess} + * {@code (name, processBuilder, null, linePredicate, timeout, unit)} *

* * @param name The process name @@ -141,6 +151,73 @@ public static Process startProcess(String name, return startProcess(name, processBuilder, null, linePredicate, timeout, unit); } + + /* + BufferOutputStream and BufferInputStream allow to re-use p.getInputStream() amd p.getOutputStream() of + processes started with ProcessTools.startProcess(...). + Implementation cashes ALL process output and allow to read it through InputStream. + The stream uses Future task from StreamPumper.process() to check if output is complete. + */ + private static class BufferOutputStream extends ByteArrayOutputStream { + private int current = 0; + final private Process p; + + private Future task; + + public BufferOutputStream(Process p) { + this.p = p; + } + + synchronized void setTask(Future task) { + this.task = task; + } + synchronized int readNext() { + if (current > count) { + throw new RuntimeException("Shouldn't ever happen. start: " + + current + " count: " + count + " buffer: " + this); + } + while (current == count) { + if (!p.isAlive() && (task != null)) { + try { + task.get(10, TimeUnit.MILLISECONDS); + if (current == count) { + return -1; + } + } catch (TimeoutException e) { + // continue execution, so wait() give a chance to write + } catch (InterruptedException | ExecutionException e) { + return -1; + } + } + try { + wait(1); + } catch (InterruptedException ie) { + return -1; + } + } + return this.buf[current++]; + } + } + + private static class BufferInputStream extends InputStream { + + private final BufferOutputStream buffer; + + public BufferInputStream(Process p) { + buffer = new BufferOutputStream(p); + } + + BufferOutputStream getOutputStream() { + return buffer; + } + + @Override + public int read() throws IOException { + return buffer.readNext(); + } + } + + /** *

Starts a process from its builder.

* The default redirects of STDOUT and STDERR are started @@ -178,6 +255,14 @@ public static Process startProcess(String name, stdout.addPump(new LineForwarder(name, System.out)); stderr.addPump(new LineForwarder(name, System.err)); + + + BufferInputStream stdOut = new BufferInputStream(p); + BufferInputStream stdErr = new BufferInputStream(p); + + stdout.addOutputStream(stdOut.getOutputStream()); + stderr.addOutputStream(stdErr.getOutputStream()); + if (lineConsumer != null) { StreamPumper.LinePump pump = new StreamPumper.LinePump() { @Override @@ -189,7 +274,6 @@ protected void processLine(String line) { stderr.addPump(pump); } - CountDownLatch latch = new CountDownLatch(1); if (linePredicate != null) { StreamPumper.LinePump pump = new StreamPumper.LinePump() { @@ -212,6 +296,9 @@ protected void processLine(String line) { final Future stdoutTask = stdout.process(); final Future stderrTask = stderr.process(); + stdOut.getOutputStream().setTask(stdoutTask); + stdErr.getOutputStream().setTask(stderrTask); + try { if (timeout > -1) { if (timeout == 0) { @@ -237,7 +324,7 @@ protected void processLine(String line) { throw e; } - return new ProcessImpl(p, stdoutTask, stderrTask); + return new ProcessImpl(p, stdoutTask, stderrTask, stdOut, stdErr); } /** @@ -615,14 +702,19 @@ private static Process privilegedStart(ProcessBuilder pb) throws IOException { private static class ProcessImpl extends Process { + private final InputStream stdOut; + private final InputStream stdErr; private final Process p; private final Future stdoutTask; private final Future stderrTask; - public ProcessImpl(Process p, Future stdoutTask, Future stderrTask) { + public ProcessImpl(Process p, Future stdoutTask, Future stderrTask, + InputStream stdOut, InputStream etdErr) { this.p = p; this.stdoutTask = stdoutTask; this.stderrTask = stderrTask; + this.stdOut = stdOut; + this.stdErr = etdErr; } @Override @@ -632,12 +724,12 @@ public OutputStream getOutputStream() { @Override public InputStream getInputStream() { - return p.getInputStream(); + return stdOut; } @Override public InputStream getErrorStream() { - return p.getErrorStream(); + return stdErr; } @Override From d117806dd0f4a651ac3264f81b8cf8d98db89b98 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Thu, 6 Jun 2024 08:16:31 +0000 Subject: [PATCH 044/329] 8279068: IGV: Update to work with JDK 16 and 17 Reviewed-by: andrew Backport-of: 7bcca7692b62a37f70c757694f6acff0295371cc --- .../IdealGraphVisualizer/Bytecodes/pom.xml | 6 ++++- .../IdealGraphVisualizer/ControlFlow/pom.xml | 6 ++++- .../IdealGraphVisualizer/Coordinator/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Data/pom.xml | 6 ++++- .../IdealGraphVisualizer/Difference/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Filter/pom.xml | 8 +++++-- .../IdealGraphVisualizer/FilterWindow/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Graal/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Graph/pom.xml | 6 ++++- .../HierarchicalLayout/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Layout/pom.xml | 6 ++++- .../NetworkConnection/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/README.md | 2 +- .../SelectionCoordinator/pom.xml | 6 ++++- .../ServerCompiler/pom.xml | 4 ++++ .../IdealGraphVisualizer/Settings/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Util/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/View/pom.xml | 6 ++++- .../IdealGraphVisualizer/application/pom.xml | 5 +++- .../main/resources/idealgraphvisualizer.conf | 24 +++++++++++++++++++ .../IdealGraphVisualizer/branding/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/pom.xml | 24 ++++++++++++++++++- 22 files changed, 142 insertions(+), 21 deletions(-) create mode 100644 src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf diff --git a/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml b/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml index 188537f81d6..e87ad7fb509 100644 --- a/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml +++ b/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml @@ -1,6 +1,6 @@ diff --git a/src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf b/src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf new file mode 100644 index 00000000000..500ed32f280 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf @@ -0,0 +1,24 @@ +# Copyright (c) 2022, 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. + +# Open/export modules still accessed by the NetBeans Platform. +# All options must be passed in a single line for multi-platform support. +default_options="-J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED -J--add-opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED" \ No newline at end of file diff --git a/src/utils/IdealGraphVisualizer/branding/pom.xml b/src/utils/IdealGraphVisualizer/branding/pom.xml index 67821ff4621..ed33298d3e4 100644 --- a/src/utils/IdealGraphVisualizer/branding/pom.xml +++ b/src/utils/IdealGraphVisualizer/branding/pom.xml @@ -1,6 +1,6 @@ - - - -When applet starts, you'll see a checkbox and a label with a titled border. -Turn on the checkbox to disable the label. -The test passes if the title of the border is disabled as well as the label. - - - - - diff --git a/test/jdk/javax/swing/border/Test4129681.java b/test/jdk/javax/swing/border/Test4129681.java index 330126d3f3f..c629f1ac951 100644 --- a/test/jdk/javax/swing/border/Test4129681.java +++ b/test/jdk/javax/swing/border/Test4129681.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, 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 @@ -21,39 +21,52 @@ * questions. */ -/* - * @test - * @bug 4129681 - * @summary Tests enabling/disabling of titled border's caption - * @author Sergey Malenkov - * @run applet/manual=yesno Test4129681.html - */ - -import java.awt.BorderLayout; import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import javax.swing.BorderFactory; -import javax.swing.JApplet; +import javax.swing.Box; import javax.swing.JCheckBox; +import javax.swing.JComponent; import javax.swing.JLabel; -public class Test4129681 extends JApplet implements ItemListener { - private JLabel label; - - @Override - public void init() { - JCheckBox check = new JCheckBox("disable"); - check.addItemListener(this); +/* + * @test + * @bug 4129681 + * @summary Tests disabling of titled border's caption + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual Test4129681 + */ - this.label = new JLabel("message"); - this.label.setBorder(BorderFactory.createTitledBorder("label")); - this.label.setEnabled(!check.isSelected()); +public class Test4129681 { + public static void main(String[] args) throws Exception { + String testInstructions = """ + Click the checkbox to disable the label. + The test passes if the title of the border + is disabled as well as the label. + """; - add(BorderLayout.NORTH, check); - add(BorderLayout.CENTER, this.label); + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(testInstructions) + .rows(4) + .columns(25) + .splitUI(Test4129681::init) + .build() + .awaitAndCheck(); } - public void itemStateChanged(ItemEvent event) { - this.label.setEnabled(ItemEvent.DESELECTED == event.getStateChange()); + public static JComponent init() { + JLabel label = new JLabel("message"); + JCheckBox check = new JCheckBox("Enable/Disable"); + check.addItemListener(event -> + label.setEnabled(ItemEvent.DESELECTED == event.getStateChange())); + label.setBorder(BorderFactory.createTitledBorder("label")); + label.setEnabled(!check.isSelected()); + + Box main = Box.createVerticalBox(); + main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); + main.add(check); + main.add(label); + return main; } } From d981bc4748e023f544851a5617f3b502654f7671 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Mon, 17 Jun 2024 10:15:15 +0000 Subject: [PATCH 082/329] 8269428: java/util/concurrent/ConcurrentHashMap/ToArray.java timed out Reviewed-by: mdoerr Backport-of: 570ad67204a55dd4b45e04e5a91671fed2cc18d0 --- .../concurrent/ConcurrentHashMap/ToArray.java | 101 ++++++++++-------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java b/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java index 0f154f307f8..340efc67f7f 100644 --- a/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java +++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,6 +31,8 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -45,57 +47,62 @@ public static void main(String[] args) throws Throwable { } static void executeTest() throws Throwable { - final ConcurrentHashMap m = new ConcurrentHashMap<>(); - final ThreadLocalRandom rnd = ThreadLocalRandom.current(); - final int nCPU = Runtime.getRuntime().availableProcessors(); - final int minWorkers = 2; - final int maxWorkers = Math.max(minWorkers, Math.min(32, nCPU)); - final int nWorkers = rnd.nextInt(minWorkers, maxWorkers + 1); - final int sizePerWorker = 1024; - final int maxSize = nWorkers * sizePerWorker; + ExecutorService executor = Executors.newCachedThreadPool(); + try { + final ConcurrentHashMap m = new ConcurrentHashMap<>(); + final ThreadLocalRandom rnd = ThreadLocalRandom.current(); + final int nCPU = Runtime.getRuntime().availableProcessors(); + final int minWorkers = 2; + final int maxWorkers = Math.max(minWorkers, Math.min(32, nCPU)); + final int nWorkers = rnd.nextInt(minWorkers, maxWorkers + 1); + final int sizePerWorker = 1024; + final int maxSize = nWorkers * sizePerWorker; - // The foreman busy-checks that the size of the arrays obtained - // from the keys and values views grows monotonically until it - // reaches the maximum size. + // The foreman busy-checks that the size of the arrays obtained + // from the keys and values views grows monotonically until it + // reaches the maximum size. - // NOTE: these size constraints are not specific to toArray and are - // applicable to any form of traversal of the collection views - CompletableFuture foreman = CompletableFuture.runAsync(new Runnable() { - private int prevSize = 0; + // NOTE: these size constraints are not specific to toArray and are + // applicable to any form of traversal of the collection views + CompletableFuture foreman = CompletableFuture.runAsync(new Runnable() { + private int prevSize = 0; - private boolean checkProgress(Object[] a) { - int size = a.length; - if (size < prevSize || size > maxSize) - throw new AssertionError( - String.format("prevSize=%d size=%d maxSize=%d", - prevSize, size, maxSize)); - prevSize = size; - return size == maxSize; - } + private boolean checkProgress(Object[] a) { + int size = a.length; + if (size < prevSize || size > maxSize) + throw new AssertionError( + String.format("prevSize=%d size=%d maxSize=%d", + prevSize, size, maxSize)); + prevSize = size; + return size == maxSize; + } - public void run() { - Integer[] empty = new Integer[0]; - for (;;) - if (checkProgress(m.values().toArray()) - & checkProgress(m.keySet().toArray()) - & checkProgress(m.values().toArray(empty)) - & checkProgress(m.keySet().toArray(empty))) - return; - } - }); + public void run() { + Integer[] empty = new Integer[0]; + for (; ; ) + if (checkProgress(m.values().toArray()) + & checkProgress(m.keySet().toArray()) + & checkProgress(m.values().toArray(empty)) + & checkProgress(m.keySet().toArray(empty))) + return; + } + }, executor); - // Each worker puts globally unique keys into the map - List> workers = - IntStream.range(0, nWorkers) - .mapToObj(w -> (Runnable) () -> { - for (int i = 0, o = w * sizePerWorker; i < sizePerWorker; i++) - m.put(o + i, i); - }) - .map(CompletableFuture::runAsync) - .collect(Collectors.toList()); + // Each worker puts globally unique keys into the map + List> workers = + IntStream.range(0, nWorkers) + .mapToObj(w -> (Runnable) () -> { + for (int i = 0, o = w * sizePerWorker; i < sizePerWorker; i++) + m.put(o + i, i); + }) + .map(r -> CompletableFuture.runAsync(r, executor)) + .collect(Collectors.toList()); - // Wait for workers and foreman to complete - workers.forEach(CompletableFuture::join); - foreman.join(); + // Wait for workers and foreman to complete + workers.forEach(CompletableFuture::join); + foreman.join(); + } finally { + executor.shutdown(); + } } } From 0fc9b025f4fe0dabfd889d28d51f5e3218d21fde Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Mon, 17 Jun 2024 10:15:40 +0000 Subject: [PATCH 083/329] 8317831: compiler/codecache/CheckLargePages.java fails on OL 8.8 with unexpected memory string Reviewed-by: mdoerr Backport-of: 86b27b784e20f7cdadd241f7feedd024482baa8f --- test/hotspot/jtreg/ProblemList.txt | 1 + test/hotspot/jtreg/compiler/codecache/CheckLargePages.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 029be404306..493b5f644fe 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -67,6 +67,7 @@ compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-x64 compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java 8277503 linux-aarch64 +compiler/codecache/CheckLargePages.java 8319795 linux-x64 ############################################################################# diff --git a/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java b/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java index 8e2db5067d8..152ccb33cf0 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java @@ -62,7 +62,7 @@ public static void main(String[] args) throws Exception { out.shouldMatch("Code cache size too small for \\S* pages\\. Reverting to smaller page size \\((\\S*)\\)\\."); out.shouldHaveExitValue(0); // Parse page sizes to find next biggest page - String sizes = out.firstMatch("Usable page sizes:(.*)", 1); + String sizes = out.firstMatch("Usable page sizes:([^.]+)", 1); List sizeList = Arrays.stream(sizes.trim().split("\\s*,\\s*")).map(CheckLargePages::parseMemoryString).sorted().toList(); final int smallerPageSizeIndex = sizeList.indexOf(largePageSize) - 1; Asserts.assertGreaterThanOrEqual(smallerPageSizeIndex, 0); From d056b73c382db5ec91e0f85e6cd4d6db1b9ae870 Mon Sep 17 00:00:00 2001 From: Chad Rakoczy Date: Mon, 17 Jun 2024 17:20:36 +0000 Subject: [PATCH 084/329] 8325621: Improve jspawnhelper version checks Reviewed-by: shade Backport-of: a232e8fb4e6e9e2e9a5285bf01c93b8d1d995f04 --- make/modules/java.base/Launcher.gmk | 3 +- make/modules/java.base/lib/CoreLibraries.gmk | 1 + .../unix/native/jspawnhelper/jspawnhelper.c | 28 +++++++++++++++---- .../unix/native/libjava/ProcessImpl_md.c | 14 +++++++--- .../ProcessBuilder/JspawnhelperWarnings.java | 21 +++++++++++++- 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/make/modules/java.base/Launcher.gmk b/make/modules/java.base/Launcher.gmk index 700ddefda49..1ab3846c143 100644 --- a/make/modules/java.base/Launcher.gmk +++ b/make/modules/java.base/Launcher.gmk @@ -78,7 +78,8 @@ ifeq ($(call isTargetOs, macosx aix linux), true) NAME := jspawnhelper, \ SRC := $(TOPDIR)/src/$(MODULE)/unix/native/jspawnhelper, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKEXE) -I$(TOPDIR)/src/$(MODULE)/unix/native/libjava, \ + CFLAGS := $(CFLAGS_JDKEXE) $(VERSION_CFLAGS) \ + -I$(TOPDIR)/src/$(MODULE)/unix/native/libjava, \ EXTRA_OBJECT_FILES := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o, \ LDFLAGS := $(LDFLAGS_JDKEXE), \ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \ diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index bb09d8cf8a2..b7676d56d72 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -92,6 +92,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \ CFLAGS := $(CFLAGS_JDKLIB) \ $(LIBJAVA_CFLAGS), \ jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \ + ProcessImpl_md.c_CFLAGS := $(VERSION_CFLAGS), \ EXTRA_HEADER_DIRS := libfdlibm, \ WARNINGS_AS_ERRORS_xlc := false, \ DISABLED_WARNINGS_gcc := unused-result unused-function, \ diff --git a/src/java.base/unix/native/jspawnhelper/jspawnhelper.c b/src/java.base/unix/native/jspawnhelper/jspawnhelper.c index cb660b320b7..5f2f04da52c 100644 --- a/src/java.base/unix/native/jspawnhelper/jspawnhelper.c +++ b/src/java.base/unix/native/jspawnhelper/jspawnhelper.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,10 @@ extern int errno; #define ERR_PIPE 2 #define ERR_ARGS 3 +#ifndef VERSION_STRING +#error VERSION_STRING must be defined +#endif + void error (int fd, int err) { if (write (fd, &err, sizeof(err)) != sizeof(err)) { /* Not sure what to do here. I have no one to speak to. */ @@ -58,6 +63,7 @@ void error (int fd, int err) { } void shutItDown() { + fprintf(stdout, "jspawnhelper version %s\n", VERSION_STRING); fprintf(stdout, "This command is not for general use and should "); fprintf(stdout, "only be run as the result of a call to\n"); fprintf(stdout, "ProcessBuilder.start() or Runtime.exec() in a java "); @@ -143,19 +149,29 @@ int main(int argc, char *argv[]) { /* argv[1] contains the fd number to read all the child info */ int r, fdinr, fdinw, fdout; - if (argc != 2) { - shutItDown(); - } - #ifdef DEBUG jtregSimulateCrash(0, 4); #endif - r = sscanf (argv[1], "%d:%d:%d", &fdinr, &fdinw, &fdout); + + if (argc != 3) { + fprintf(stdout, "Incorrect number of arguments: %d\n", argc); + shutItDown(); + } + + if (strcmp(argv[1], VERSION_STRING) != 0) { + fprintf(stdout, "Incorrect Java version: %s\n", argv[1]); + shutItDown(); + } + + r = sscanf (argv[2], "%d:%d:%d", &fdinr, &fdinw, &fdout); if (r == 3 && fcntl(fdinr, F_GETFD) != -1 && fcntl(fdinw, F_GETFD) != -1) { fstat(fdinr, &buf); - if (!S_ISFIFO(buf.st_mode)) + if (!S_ISFIFO(buf.st_mode)) { + fprintf(stdout, "Incorrect input pipe\n"); shutItDown(); + } } else { + fprintf(stdout, "Incorrect FD array data: %s\n", argv[2]); shutItDown(); } // Close the writing end of the pipe we use for reading from the parent. diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c index bb340a8f120..640f449d3f0 100644 --- a/src/java.base/unix/native/libjava/ProcessImpl_md.c +++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c @@ -300,6 +300,10 @@ Java_java_lang_ProcessImpl_init(JNIEnv *env, jclass clazz) #define WTERMSIG(status) ((status)&0x7F) #endif +#ifndef VERSION_STRING +#error VERSION_STRING must be defined +#endif + static const char * getBytes(JNIEnv *env, jbyteArray arr) { @@ -491,7 +495,7 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) jboolean isCopy; int i, offset, rval, bufsize, magic; char *buf, buf1[(3 * 11) + 3]; // "%d:%d:%d\0" - char *hlpargs[3]; + char *hlpargs[4]; SpawnInfo sp; /* need to tell helper which fd is for receiving the childstuff @@ -500,11 +504,13 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) snprintf(buf1, sizeof(buf1), "%d:%d:%d", c->childenv[0], c->childenv[1], c->fail[1]); /* NULL-terminated argv array. * argv[0] contains path to jspawnhelper, to follow conventions. - * argv[1] contains the fd string as argument to jspawnhelper + * argv[1] contains the version string as argument to jspawnhelper + * argv[2] contains the fd string as argument to jspawnhelper */ hlpargs[0] = (char*)helperpath; - hlpargs[1] = buf1; - hlpargs[2] = NULL; + hlpargs[1] = VERSION_STRING; + hlpargs[2] = buf1; + hlpargs[3] = NULL; /* Following items are sent down the pipe to the helper * after it is spawned. diff --git a/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java b/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java index 0ff68186502..daffb4b8c84 100644 --- a/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java +++ b/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java @@ -25,7 +25,7 @@ /* * @test - * @bug 8325567 + * @bug 8325567 8325621 * @requires (os.family == "linux") | (os.family == "aix") | (os.family == "mac") * @library /test/lib * @run driver JspawnhelperWarnings @@ -47,11 +47,30 @@ private static void tryWithNArgs(int nArgs) throws Exception { OutputAnalyzer oa = new OutputAnalyzer(p); oa.shouldHaveExitValue(1); oa.shouldContain("This command is not for general use"); + if (nArgs != 2) { + oa.shouldContain("Incorrect number of arguments"); + } else { + oa.shouldContain("Incorrect Java version"); + } + } + + private static void testVersion() throws Exception { + String[] args = new String[3]; + args[0] = Paths.get(System.getProperty("java.home"), "lib", "jspawnhelper").toString(); + args[1] = "wrongVersion"; + args[2] = "1:1:1"; + Process p = ProcessTools.startProcess("jspawnhelper", new ProcessBuilder(args)); + OutputAnalyzer oa = new OutputAnalyzer(p); + oa.shouldHaveExitValue(1); + oa.shouldContain("This command is not for general use"); + oa.shouldContain("Incorrect Java version: wrongVersion"); } public static void main(String[] args) throws Exception { for (int nArgs = 0; nArgs < 10; nArgs++) { tryWithNArgs(nArgs); } + + testVersion(); } } From ed56f5b22f442579556466f1da7f7de88117a9a6 Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Tue, 18 Jun 2024 07:58:40 +0000 Subject: [PATCH 085/329] 8324577: [REDO] - [IMPROVE] OPEN_MAX is no longer the max limit on macOS >= 10.6 for RLIMIT_NOFILE Backport-of: f1d0e715b67e2ca47b525069d8153abbb33f75b9 --- src/hotspot/os/bsd/os_bsd.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 071045c6a6e..d10577b4496 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -2090,16 +2090,25 @@ jint os::init_2(void) { if (status != 0) { log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno)); } else { - nbr_files.rlim_cur = nbr_files.rlim_max; - -#ifdef __APPLE__ - // Darwin returns RLIM_INFINITY for rlim_max, but fails with EINVAL if - // you attempt to use RLIM_INFINITY. As per setrlimit(2), OPEN_MAX must - // be used instead - nbr_files.rlim_cur = MIN(OPEN_MAX, nbr_files.rlim_cur); -#endif + rlim_t rlim_original = nbr_files.rlim_cur; + + // On macOS according to setrlimit(2), OPEN_MAX must be used instead + // of RLIM_INFINITY, but testing on macOS >= 10.6, reveals that + // we can, in fact, use even RLIM_INFINITY, so try the max value + // that the system claims can be used first, same as other BSD OSes. + // However, some terminals (ksh) will internally use "int" type + // to store this value and since RLIM_INFINITY overflows an "int" + // we might end up with a negative value, so cap the system limit max + // at INT_MAX instead, just in case, for everyone. + nbr_files.rlim_cur = MIN(INT_MAX, nbr_files.rlim_max); status = setrlimit(RLIMIT_NOFILE, &nbr_files); + if (status != 0) { + // If that fails then try lowering the limit to either OPEN_MAX + // (which is safe) or the original limit, whichever was greater. + nbr_files.rlim_cur = MAX(OPEN_MAX, rlim_original); + status = setrlimit(RLIMIT_NOFILE, &nbr_files); + } if (status != 0) { log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno)); } From 5c3fc1d795a760e4cce55045cbcd2384d9007356 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Tue, 18 Jun 2024 12:25:02 +0000 Subject: [PATCH 086/329] 8334335: [TESTBUG] Backport of 8279164 to 11u & 17u includes elements of JDK-8163327 Reviewed-by: mdoerr --- test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java b/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java index f4c67a9bd30..855e34b57f0 100644 --- a/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java +++ b/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java @@ -60,7 +60,7 @@ public class DisabledAlgorithms { System.getProperty("test.src", "./") + "/" + pathToStores + "/" + trustStoreFile; - // disabled 3DES, DES, RC4, NULL, anon, and ECDH cipher suites + // disabled RC4, NULL, anon, and ECDH cipher suites private static final String[] disabled_ciphersuites = new String[] { "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", @@ -95,7 +95,6 @@ public class DisabledAlgorithms { "TLS_ECDH_anon_WITH_AES_256_CBC_SHA", "TLS_ECDH_anon_WITH_NULL_SHA", "TLS_ECDH_anon_WITH_RC4_128_SHA", - "SSL_RSA_WITH_3DES_EDE_CBC_SHA", "TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256", From 5fc41c8da849bcce6be9e73382f6488ad0cfd1df Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 18 Jun 2024 13:42:47 +0000 Subject: [PATCH 087/329] 8330524: Linux ppc64le compile warning with clang in os_linux_ppc.cpp Reviewed-by: mdoerr Backport-of: e3a9226e0d481ea1ad9747ec9d40f40bbcb650f3 --- src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp index f8e6787505b..f3b80be3c02 100644 --- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2021 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. 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 @@ -253,7 +253,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, stub = SharedRuntime::get_handle_wrong_method_stub(); } - else if ((sig == USE_POLL_BIT_ONLY ? SIGTRAP : SIGSEGV) && + else if ((sig == (USE_POLL_BIT_ONLY ? SIGTRAP : SIGSEGV)) && // A linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults // in 64bit mode (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6), // especially when we try to read from the safepoint polling page. So the check From 8751acea2de9db2661b452ccabe08831a2365b9e Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 18 Jun 2024 13:46:33 +0000 Subject: [PATCH 088/329] 8330615: avoid signed integer overflows in zip_util.c readCen / hashN Backport-of: 5af6b45eefd227e3e046ca22a404ae8a23174160 --- src/java.base/share/native/libzip/zip_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.base/share/native/libzip/zip_util.c b/src/java.base/share/native/libzip/zip_util.c index fbbd9d850fc..68fd756ada3 100644 --- a/src/java.base/share/native/libzip/zip_util.c +++ b/src/java.base/share/native/libzip/zip_util.c @@ -442,7 +442,7 @@ hash(const char *s) static unsigned int hashN(const char *s, int length) { - int h = 0; + unsigned int h = 0; while (length-- > 0) h = 31*h + *s++; return h; From 978b7931f04aab84182a4a2f2a7681ffd3228966 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 19 Jun 2024 02:02:58 +0000 Subject: [PATCH 089/329] 8327137: Add test for ConcurrentModificationException in BasicDirectoryModel Backport-of: 9731b1c8b02d957985f4fb40acd93fb67747a9f0 --- .../ConcurrentModification.java | 273 ++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 test/jdk/javax/swing/plaf/basic/BasicDirectoryModel/ConcurrentModification.java diff --git a/test/jdk/javax/swing/plaf/basic/BasicDirectoryModel/ConcurrentModification.java b/test/jdk/javax/swing/plaf/basic/BasicDirectoryModel/ConcurrentModification.java new file mode 100644 index 00000000000..0c23ee23b5b --- /dev/null +++ b/test/jdk/javax/swing/plaf/basic/BasicDirectoryModel/ConcurrentModification.java @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +import javax.swing.JFileChooser; + +/* + * @test + * @bug 8323670 8307091 8240690 + * @requires os.family == "mac" | os.family == "linux" + * @summary Verifies thread-safety of BasicDirectoryModel (JFileChooser) + * @run main/othervm -Djava.awt.headless=true ConcurrentModification + */ +public final class ConcurrentModification extends ThreadGroup { + /** Initial number of files. */ + private static final long NUMBER_OF_FILES = 50; + /** Maximum number of files created on a timer tick. */ + private static final long LIMIT_FILES = 10; + + /** Timer period (delay) for creating new files. */ + private static final long TIMER_PERIOD = 250; + + /** + * Number of threads running {@code fileChooser.rescanCurrentDirectory()}. + */ + private static final int NUMBER_OF_THREADS = 5; + /** Number of repeated calls to {@code rescanCurrentDirectory}. */ + private static final int NUMBER_OF_REPEATS = 2_000; + /** Maximum amount a thread waits before initiating rescan. */ + private static final long LIMIT_SLEEP = 100; + + + /** The barrier to start all the scanner threads simultaneously. */ + private static final CyclicBarrier start = new CyclicBarrier(NUMBER_OF_THREADS); + /** The barrier to wait for all the scanner threads to complete, plus main thread. */ + private static final CyclicBarrier end = new CyclicBarrier(NUMBER_OF_THREADS + 1); + + /** List of scanner threads. */ + private static final List threads = new ArrayList<>(NUMBER_OF_THREADS); + + /** + * Stores an exception caught by any of the threads. + * If more exceptions are caught, they're added as suppressed exceptions. + */ + private static final AtomicReference exception = + new AtomicReference<>(); + + /** + * Stores an {@code IOException} thrown while removing the files. + */ + private static final AtomicReference ioException = + new AtomicReference<>(); + + + public static void main(String[] args) throws Throwable { + try { + // Start the test in its own thread group to catch and handle + // all thrown exceptions, in particular in + // BasicDirectoryModel.FilesLoader which is created by Swing. + ThreadGroup threadGroup = new ConcurrentModification(); + Thread runner = new Thread(threadGroup, + ConcurrentModification::wrapper, + "Test Runner"); + runner.start(); + runner.join(); + } catch (Throwable throwable) { + handleException(throwable); + } + + if (ioException.get() != null) { + System.err.println("An error occurred while removing files:"); + ioException.get().printStackTrace(); + } + + if (exception.get() != null) { + throw exception.get(); + } + } + + private static void wrapper() { + final long timeStart = System.currentTimeMillis(); + try { + runTest(timeStart); + } catch (Throwable throwable) { + handleException(throwable); + } finally { + System.out.printf("Duration: %,d\n", + (System.currentTimeMillis() - timeStart)); + } + } + + private static void runTest(final long timeStart) throws Throwable { + final Path temp = Files.createDirectory(Paths.get("fileChooser-concurrency-" + timeStart)); + + final Timer timer = new Timer("File creator"); + + try { + createFiles(temp); + + final JFileChooser fc = new JFileChooser(temp.toFile()); + + IntStream.range(0, NUMBER_OF_THREADS) + .forEach(i -> { + Thread thread = new Thread(new Scanner(fc)); + threads.add(thread); + thread.start(); + }); + + timer.scheduleAtFixedRate(new CreateFilesTimerTask(temp), + 0, TIMER_PERIOD); + + end.await(); + } catch (Throwable e) { + threads.forEach(Thread::interrupt); + throw e; + } finally { + timer.cancel(); + + deleteFiles(temp); + deleteFile(temp); + } + } + + + private ConcurrentModification() { + super("bdmConcurrency"); + } + + @Override + public void uncaughtException(Thread t, Throwable e) { + handleException(t, e); + } + + private static void handleException(Throwable throwable) { + handleException(Thread.currentThread(), throwable); + } + + private static void handleException(final Thread thread, + final Throwable throwable) { + System.err.println("Exception in " + thread.getName() + ": " + + throwable.getClass() + + (throwable.getMessage() != null + ? ": " + throwable.getMessage() + : "")); + if (!exception.compareAndSet(null, throwable)) { + exception.get().addSuppressed(throwable); + } + threads.stream() + .filter(t -> t != thread) + .forEach(Thread::interrupt); + } + + + private record Scanner(JFileChooser fileChooser) + implements Runnable { + + @Override + public void run() { + try { + start.await(); + + int counter = 0; + try { + do { + fileChooser.rescanCurrentDirectory(); + Thread.sleep((long) (Math.random() * LIMIT_SLEEP)); + } while (++counter < NUMBER_OF_REPEATS + && !Thread.interrupted()); + } catch (InterruptedException e) { + // Just exit the loop + } + } catch (Throwable throwable) { + handleException(throwable); + } finally { + try { + end.await(); + } catch (InterruptedException | BrokenBarrierException e) { + handleException(e); + } + } + } + } + + private static void createFiles(final Path parent) { + createFiles(parent, 0, NUMBER_OF_FILES); + } + + private static void createFiles(final Path parent, + final long start, + final long end) { + LongStream.range(start, end) + .forEach(n -> createFile(parent.resolve(n + ".file"))); + } + + private static void createFile(final Path file) { + try { + Files.createFile(file); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static void deleteFiles(final Path parent) throws IOException { + try (var stream = Files.walk(parent)) { + stream.filter(p -> p != parent) + .forEach(ConcurrentModification::deleteFile); + } + } + + private static void deleteFile(final Path file) { + try { + Files.delete(file); + } catch (IOException e) { + if (!ioException.compareAndSet(null, e)) { + ioException.get().addSuppressed(e); + } + } + } + + private static final class CreateFilesTimerTask extends TimerTask { + private final Path temp; + private long no; + + public CreateFilesTimerTask(Path temp) { + this.temp = temp; + no = NUMBER_OF_FILES; + } + + @Override + public void run() { + try { + long count = (long) (Math.random() * LIMIT_FILES); + createFiles(temp, no, no + count); + no += count; + } catch (Throwable t) { + handleException(t); + } + } + } +} From 4621d59e39efec37ab42813ceb7892f3b5d083a9 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 19 Jun 2024 02:04:10 +0000 Subject: [PATCH 090/329] 8328115: Convert java/awt/font/TextLayout/TestJustification.html applet test to main Backport-of: 0204aacb0305e94a7d6d5299a5ae835f3f71b030 --- test/jdk/ProblemList.txt | 2 +- .../font/TextLayout/TestJustification.html | 52 --- .../font/TextLayout/TestJustification.java | 396 +++++++++--------- 3 files changed, 205 insertions(+), 245 deletions(-) delete mode 100644 test/jdk/java/awt/font/TextLayout/TestJustification.html diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 6702a9f8a06..59a2aac41b9 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -827,7 +827,7 @@ java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html 8203867 m java/awt/Frame/FrameStateTest/FrameStateTest.html 8203920 macosx-all,linux-all javax/swing/SwingUtilities/TestTextPosInPrint.java 8227025 windows-all java/awt/print/PrinterJob/ScaledText/ScaledText.java 8231226 macosx-all -java/awt/font/TextLayout/TestJustification.html 8250791 macosx-all +java/awt/font/TextLayout/TestJustification.java 8250791 macosx-all java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html 7187728 macosx-all,linux-all diff --git a/test/jdk/java/awt/font/TextLayout/TestJustification.html b/test/jdk/java/awt/font/TextLayout/TestJustification.html deleted file mode 100644 index c9e79f44cb2..00000000000 --- a/test/jdk/java/awt/font/TextLayout/TestJustification.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - -Test Justification - - - -

Test Justification

-
-

Five lines of text should appear, all justified to the same width, -followed by a sixth line containing only roman characters and no spaces -which is not justified, and instead is centered. -Carets should appear between all characters. Pass the test if this is -true. -

- -alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." -Your browser is completely ignoring the <APPLET> tag! - - - - diff --git a/test/jdk/java/awt/font/TextLayout/TestJustification.java b/test/jdk/java/awt/font/TextLayout/TestJustification.java index 417ddd5adfc..62377531e9d 100644 --- a/test/jdk/java/awt/font/TextLayout/TestJustification.java +++ b/test/jdk/java/awt/font/TextLayout/TestJustification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -21,229 +21,241 @@ * questions. */ +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.font.FontRenderContext; +import java.awt.font.LineBreakMeasurer; +import java.awt.font.TextAttribute; +import java.awt.font.TextLayout; +import java.awt.geom.Rectangle2D; +import java.text.AttributedCharacterIterator; +import java.text.AttributedString; + /* - * - * See TestJustification.html for main test. + * @test + * @bug 4211728 4178140 8145542 + * @summary Justify several lines of text and verify that the lines are the same + length and cursor positions are correct. + Bug 4211728: TextLayout.draw() draws characters at wrong position. + Bug 4178140: TextLayout does not justify. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestJustification */ -import java.applet.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.font.*; -import java.awt.geom.*; -import java.text.*; - -public class TestJustification extends Applet { - JustificationPanel panel; - - public void init() { - setLayout(new BorderLayout()); - panel = new JustificationPanel("Bitstream Cyberbit"); - add("Center", panel); - } - - public void destroy() { - remove(panel); - } - - // calls system.exit, not for use in tests. - public static void main(String args[]) { - TestJustification justificationTest = new TestJustification(); - justificationTest.init(); - justificationTest.start(); - - Frame f = new Frame("Test Justification"); - f.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - System.exit(0); - } - }); - - f.add("Center", justificationTest); - f.setSize(500, 500); - f.show(); - } - - public String getAppletInfo() { - return "Test TextLayout.getJustifiedLayout()"; - } - - static class JustificationPanel extends Panel { - TextLayout[] layouts; - String fontname; - float height; - float oldfsize; - - AttributedCharacterIterator lineText; - TextLayout[] lines; - int linecount; - float oldwidth; - - JustificationPanel(String fontname) { - this.fontname = fontname; +public class TestJustification { + private static final String INSTRUCTIONS = """ + Five lines of text should appear, all justified to the same width, + followed by a sixth line containing only roman characters and + no spaces which is not justified, and instead is centered. + Carets should appear between all characters. + + PASS the test if this is true, else press FAIL. + """; + + public static void main(String[] args) throws Exception { + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(TestJustification::createUI) + .build() + .awaitAndCheck(); } - private static final String[] texts = { - "This is an english Highlighting demo.", "Highlighting", - "This is an arabic \u0627\u0628\u062a\u062c \u062e\u0644\u0627\u062e demo.", "arabic \u0627\u0628\u062a\u062c", - "This is a hebrew \u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5 demo.", "hebrew \u05d0\u05d1\u05d2", - "This is a cjk \u4e00\u4e01\u4e02\uac00\uac01\uc4fa\uf900\uf901\uf902 demo.", "cjk", - "NoSpaceCJK:\u4e00\u4e01\u4e02and\uac00\uac01\uc4faand\uf900\uf901\uf902", "No", - "NoSpaceRoman", "Space" - }; + private static Frame createUI() { + Frame frame= new Frame("Test Text Justification"); + JustificationPanel panel = new JustificationPanel("Bitstream Cyberbit"); + frame.add(panel); + frame.add("Center", panel); + frame.setSize(500, 450); + return frame; + } - public void paint(Graphics g) { - Graphics2D g2d = (Graphics2D)g; + static class JustificationPanel extends Panel { + TextLayout[] layouts; + String fontname; + float height; + float oldfsize; - Dimension d = getSize(); - Insets insets = getInsets(); + AttributedCharacterIterator lineText; + TextLayout[] lines; + int linecount; + float oldwidth; - float w = d.width - insets.left - insets.right; - float h = d.height - insets.top - insets.bottom; - int fsize = (int)w/25; + JustificationPanel(String fontname) { + this.fontname = fontname; + } - FontRenderContext frc = g2d.getFontRenderContext(); + private static final String[] texts = { + "This is an english Highlighting demo.", "Highlighting", + "This is an arabic \u0627\u0628\u062a\u062c \u062e\u0644\u0627\u062e demo.", "arabic \u0627\u0628\u062a\u062c", + "This is a hebrew \u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5 demo.", "hebrew \u05d0\u05d1\u05d2", + "This is a cjk \u4e00\u4e01\u4e02\uac00\uac01\uc4fa\uf900\uf901\uf902 demo.", "cjk", + "NoSpaceCJK:\u4e00\u4e01\u4e02and\uac00\uac01\uc4faand\uf900\uf901\uf902", "No", + "NoSpaceRoman", "Space" + }; - if (layouts == null || fsize != oldfsize) { - oldfsize = fsize; + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; - Font f0 = new Font(fontname, Font.PLAIN, fsize); - Font f1 = new Font(fontname, Font.ITALIC, (int)(fsize * 1.5)); + Dimension d = getSize(); + Insets insets = getInsets(); - if (layouts == null) { - layouts = new TextLayout[texts.length / 2]; - } + float w = d.width - insets.left - insets.right; + float h = d.height - insets.top - insets.bottom; + int fsize = (int)w/25; - height = 0; - for (int i = 0; i < layouts.length; ++i) { - String text = texts[i*2]; - String target = texts[i*2+1]; + FontRenderContext frc = g2d.getFontRenderContext(); - AttributedString astr = new AttributedString(text); - astr.addAttribute(TextAttribute.FONT, f0, 0, text.length()); + if (layouts == null || fsize != oldfsize) { + oldfsize = fsize; - int start = text.indexOf(target); - int limit = start + target.length(); - astr.addAttribute(TextAttribute.FONT, f1, start, limit); + Font f0 = new Font(fontname, Font.PLAIN, fsize); + Font f1 = new Font(fontname, Font.ITALIC, (int)(fsize * 1.5)); - TextLayout layout = new TextLayout(astr.getIterator(), frc); + if (layouts == null) { + layouts = new TextLayout[texts.length / 2]; + } - layout = layout.getJustifiedLayout(w - 20); + height = 0; + for (int i = 0; i < layouts.length; ++i) { + String text = texts[i*2]; + String target = texts[i*2+1]; - layouts[i] = layout; + AttributedString astr = new AttributedString(text); + astr.addAttribute(TextAttribute.FONT, f0, 0, text.length()); + + int start = text.indexOf(target); + int limit = start + target.length(); + astr.addAttribute(TextAttribute.FONT, f1, start, limit); + + TextLayout layout = new TextLayout(astr.getIterator(), frc); - height += layout.getAscent() + layout.getDescent() + layout.getLeading(); - } - } + layout = layout.getJustifiedLayout(w - 20); + + layouts[i] = layout; - g2d.setColor(Color.white); - g2d.fill(new Rectangle.Float(insets.left, insets.top, w, h)); + height += layout.getAscent() + layout.getDescent() + layout.getLeading(); + } + } - float basey = 20; + g2d.setColor(Color.white); + g2d.fill(new Rectangle.Float(insets.left, insets.top, w, h)); - for (int i = 0; i < layouts.length; ++i) { - TextLayout layout = layouts[i]; + float basey = 20; - float la = layout.getAscent(); - float ld = layout.getDescent(); - float ll = layout.getLeading(); - float lw = layout.getAdvance(); - float lh = la + ld + ll; - float lx = (w - lw) / 2f; - float ly = basey + layout.getAscent(); + for (TextLayout layout : layouts) { + float la = layout.getAscent(); + float ld = layout.getDescent(); + float ll = layout.getLeading(); + float lw = layout.getAdvance(); + float lh = la + ld + ll; + float lx = (w - lw) / 2f; + float ly = basey + layout.getAscent(); - g2d.setColor(Color.black); - g2d.translate(insets.left + lx, insets.top + ly); + g2d.setColor(Color.black); + g2d.translate(insets.left + lx, insets.top + ly); - Rectangle2D bounds = new Rectangle2D.Float(0, -la, lw, lh); - g2d.draw(bounds); + Rectangle2D bounds = new Rectangle2D.Float(0, -la, lw, lh); + g2d.draw(bounds); - layout.draw(g2d, 0, 0); + layout.draw(g2d, 0, 0); - g2d.setColor(Color.red); - for (int j = 0, e = layout.getCharacterCount(); j <= e; ++j) { - Shape[] carets = layout.getCaretShapes(j, bounds); - g2d.draw(carets[0]); - } + g2d.setColor(Color.red); + for (int j = 0, e = layout.getCharacterCount(); j <= e; ++j) { + Shape[] carets = layout.getCaretShapes(j, bounds); + g2d.draw(carets[0]); + } - g2d.translate(-insets.left - lx, -insets.top - ly); - basey += layout.getAscent() + layout.getDescent() + layout.getLeading(); - } - - // add LineBreakMeasurer-generated layouts - - if (lineText == null) { - String text = "This is a long line of text that should be broken across multiple " - + "lines and then justified to fit the break width. This test should pass if " - + "these lines are justified to the same width, and fail otherwise. It should " - + "also format the hebrew (\u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5) and arabic " - + "(\u0627\u0628\u062a\u062c \u062e\u0644\u0627\u062e) and CJK " - + "(\u4e00\u4e01\u4e02\uac00\uac01\uc4fa\u67b1\u67b2\u67b3\u67b4\u67b5\u67b6\u67b7" - + "\u67b8\u67b9) text correctly."; - - Float regular = new Float(16.0); - Float big = new Float(24.0); - AttributedString astr = new AttributedString(text); - astr.addAttribute(TextAttribute.SIZE, regular, 0, text.length()); - astr.addAttribute(TextAttribute.FAMILY, fontname, 0, text.length()); - - int ix = text.indexOf("broken"); - astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6); - ix = text.indexOf("hebrew"); - astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6); - ix = text.indexOf("arabic"); - astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6); - ix = text.indexOf("CJK"); - astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 3); - - lineText = astr.getIterator(); - } - - float width = w - 20; - if (lines == null || width != oldwidth) { - oldwidth = width; - - lines = new TextLayout[10]; - linecount = 0; - - LineBreakMeasurer measurer = new LineBreakMeasurer(lineText, frc); - - for (;;) { - TextLayout layout = measurer.nextLayout(width); - if (layout == null) { - break; - } - - // justify all but last line - if (linecount > 0) { - lines[linecount - 1] = lines[linecount - 1].getJustifiedLayout(width); - } - - if (linecount == lines.length) { - TextLayout[] nlines = new TextLayout[lines.length * 2]; - System.arraycopy(lines, 0, nlines, 0, lines.length); - lines = nlines; - } - - lines[linecount++] = layout; - } - } + g2d.translate(-insets.left - lx, -insets.top - ly); + basey += layout.getAscent() + layout.getDescent() + layout.getLeading(); + } - float basex = insets.left + 10; - basey += 10; - g2d.setColor(Color.black); + // add LineBreakMeasurer-generated layouts - for (int i = 0; i < linecount; ++i) { - TextLayout layout = lines[i]; + if (lineText == null) { + String text = "This is a long line of text that should be broken across multiple " + + "lines and then justified to fit the break width. This test should pass if " + + "these lines are justified to the same width, and fail otherwise. It should " + + "also format the hebrew (\u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5) and arabic " + + "(\u0627\u0628\u062a\u062c \u062e\u0644\u0627\u062e) and CJK " + + "(\u4e00\u4e01\u4e02\uac00\uac01\uc4fa\u67b1\u67b2\u67b3\u67b4\u67b5\u67b6\u67b7" + + "\u67b8\u67b9) text correctly."; - basey += layout.getAscent(); - float adv = layout.getAdvance(); - float dx = layout.isLeftToRight() ? 0 : width - adv; + Float regular = 16.0F; + Float big = 24.0F; + AttributedString astr = new AttributedString(text); + astr.addAttribute(TextAttribute.SIZE, regular, 0, text.length()); + astr.addAttribute(TextAttribute.FAMILY, fontname, 0, text.length()); - layout.draw(g2d, basex + dx, basey); + int ix = text.indexOf("broken"); + astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6); + ix = text.indexOf("hebrew"); + astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6); + ix = text.indexOf("arabic"); + astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6); + ix = text.indexOf("CJK"); + astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 3); - basey += layout.getDescent() + layout.getLeading(); - } + lineText = astr.getIterator(); + } + + float width = w - 20; + if (lines == null || width != oldwidth) { + oldwidth = width; + + lines = new TextLayout[10]; + linecount = 0; + + LineBreakMeasurer measurer = new LineBreakMeasurer(lineText, frc); + + for (;;) { + TextLayout layout = measurer.nextLayout(width); + if (layout == null) { + break; + } + + // justify all but last line + if (linecount > 0) { + lines[linecount - 1] = lines[linecount - 1].getJustifiedLayout(width); + } + + if (linecount == lines.length) { + TextLayout[] nlines = new TextLayout[lines.length * 2]; + System.arraycopy(lines, 0, nlines, 0, lines.length); + lines = nlines; + } + + lines[linecount++] = layout; + } + } + + float basex = insets.left + 10; + basey += 10; + g2d.setColor(Color.black); + + for (int i = 0; i < linecount; ++i) { + TextLayout layout = lines[i]; + + basey += layout.getAscent(); + float adv = layout.getAdvance(); + float dx = layout.isLeftToRight() ? 0 : width - adv; + + layout.draw(g2d, basex + dx, basey); + + basey += layout.getDescent() + layout.getLeading(); + } + } } - } } From 544ab78285179d9c92c5410e024060e30c5c9331 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 19 Jun 2024 02:04:24 +0000 Subject: [PATCH 091/329] 8327650: Test java/nio/channels/DatagramChannel/StressNativeSignal.java timed out Backport-of: 7acfba288ff4d1f43cc36506b2bd2d32107b00c2 --- .../DatagramChannel/StressNativeSignal.java | 136 +++++++++++++----- 1 file changed, 100 insertions(+), 36 deletions(-) diff --git a/test/jdk/java/nio/channels/DatagramChannel/StressNativeSignal.java b/test/jdk/java/nio/channels/DatagramChannel/StressNativeSignal.java index b21d68ab1a9..d6d2f083eca 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/StressNativeSignal.java +++ b/test/jdk/java/nio/channels/DatagramChannel/StressNativeSignal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -26,68 +26,111 @@ * @summary Attempt to provoke error 316 on OS X in NativeSignal.signal() */ -import java.io.*; -import java.net.*; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.StandardSocketOptions; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; +import java.util.concurrent.CountDownLatch; public class StressNativeSignal { private UDPThread udpThread; private ServerSocketThread serverSocketThread; StressNativeSignal() { - try { - serverSocketThread = new ServerSocketThread(); + serverSocketThread = initServerSocketThread(); + if (serverSocketThread != null) { serverSocketThread.start(); + } - udpThread = new UDPThread(); + udpThread = initUDPThread(); + if (udpThread != null) { udpThread.start(); + } + } + + private UDPThread initUDPThread() { + UDPThread aUDPThread = null; + try { + aUDPThread = new UDPThread(); } catch (Exception z) { + System.err.println("failed to create and start a UDPThread"); z.printStackTrace(); } + return aUDPThread; } - public static void main(String[] args) throws Throwable { - StressNativeSignal test = new StressNativeSignal(); + private ServerSocketThread initServerSocketThread() { + ServerSocketThread aServerSocketThread = null; try { - Thread.sleep(3000); + aServerSocketThread = new ServerSocketThread(); + } catch (Exception z) { - z.printStackTrace(System.err); + System.err.println("failed to create and start a ServerSocketThread"); + z.printStackTrace(); } + return aServerSocketThread; + } + public static void main(String[] args) throws Throwable { + StressNativeSignal test = new StressNativeSignal(); + test.waitForTestThreadsToStart(); test.shutdown(); } public void shutdown() { - udpThread.terminate(); - try { - udpThread.join(); - } catch (Exception z) { - z.printStackTrace(System.err); + if ((udpThread != null) && udpThread.isAlive()) { + udpThread.terminate(); + try { + udpThread.join(); + } catch (Exception z) { + z.printStackTrace(System.err); + } + } else { + System.out.println("UDPThread test scenario was not run"); } - serverSocketThread.terminate(); - try { - serverSocketThread.join(); - } catch (Exception z) { - z.printStackTrace(System.err); + if ((serverSocketThread != null) && (serverSocketThread.isAlive())) { + serverSocketThread.terminate(); + try { + serverSocketThread.join(); + } catch (Exception z) { + z.printStackTrace(System.err); + } + } else { + System.out.println("ServerSocketThread test scenario was not run"); + } + } + + public void waitForTestThreadsToStart() { + if ((udpThread != null) && udpThread.isAlive()) { + udpThread.waitTestThreadStart(); + } + if ((serverSocketThread != null) && (serverSocketThread.isAlive())) { + serverSocketThread.waitTestThreadStart(); } } public class ServerSocketThread extends Thread { private volatile boolean shouldTerminate; private ServerSocket socket; + private final CountDownLatch threadStarted = new CountDownLatch(1); + + public ServerSocketThread () throws Exception { + socket = new ServerSocket(1122); + } public void run() { + try { - socket = new ServerSocket(1122); + threadStarted.countDown(); Socket client = socket.accept(); - BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream())); - shouldTerminate = false; - while (!shouldTerminate) { - String msg = reader.readLine(); - } + client.close(); + throw new RuntimeException("Unexpected return from accept call"); } catch (Exception z) { + System.err.println("ServerSocketThread: caught exception " + z.getClass().getName()); if (!shouldTerminate) { z.printStackTrace(System.err); } @@ -103,40 +146,61 @@ public void terminate() { // ignore } } + + public void waitTestThreadStart() { + try { + threadStarted.await(); + } catch (Exception z) { + z.printStackTrace(System.err); + // ignore + } + } } public class UDPThread extends Thread { private DatagramChannel channel; private volatile boolean shouldTerminate; + private final CountDownLatch threadStarted = new CountDownLatch(1); + + public UDPThread () throws Exception { + + channel = DatagramChannel.open(); + channel.setOption(StandardSocketOptions.SO_RCVBUF, 6553600); + channel.bind(new InetSocketAddress(19870)); + } @Override public void run() { - try { - channel = DatagramChannel.open(); - channel.setOption(StandardSocketOptions.SO_RCVBUF, 6553600); - channel.bind(new InetSocketAddress(19870)); - } catch (IOException z) { - z.printStackTrace(System.err); - } ByteBuffer buf = ByteBuffer.allocate(6553600); - shouldTerminate = false; - while (!shouldTerminate) { + threadStarted.countDown(); + do { try { buf.rewind(); channel.receive(buf); } catch (IOException z) { + System.err.println("UDPThread: caught exception " + z.getClass().getName()); if (!shouldTerminate) { z.printStackTrace(System.err); } } - } + } while (!shouldTerminate); } public void terminate() { shouldTerminate = true; try { channel.close(); + } catch (Exception z) { + System.err.println("UDPThread: caught exception " + z.getClass().getName()); + z.printStackTrace(System.err); + // ignore + } + } + + public void waitTestThreadStart() { + try { + threadStarted.await(); } catch (Exception z) { z.printStackTrace(System.err); // ignore From d41ad82987a10c1eb3928ae69a8aa0362266a7a2 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Wed, 19 Jun 2024 02:04:41 +0000 Subject: [PATCH 092/329] 8328011: Convert java/awt/Frame/GetBoundsResizeTest/GetBoundsResizeTest.java applet test to main Backport-of: df909e2f9c83d6de119ae20edf57e604644e0441 --- .../java/awt/Frame/GetBoundsResizeTest.java | 97 ++++++++++ .../GetBoundsResizeTest.java | 168 ------------------ 2 files changed, 97 insertions(+), 168 deletions(-) create mode 100644 test/jdk/java/awt/Frame/GetBoundsResizeTest.java delete mode 100644 test/jdk/java/awt/Frame/GetBoundsResizeTest/GetBoundsResizeTest.java diff --git a/test/jdk/java/awt/Frame/GetBoundsResizeTest.java b/test/jdk/java/awt/Frame/GetBoundsResizeTest.java new file mode 100644 index 00000000000..d3c2ffb0bad --- /dev/null +++ b/test/jdk/java/awt/Frame/GetBoundsResizeTest.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1998, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.EventQueue; +import java.awt.Robot; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +/* + * @test + * @bug 4103095 + * @summary Test for getBounds() after a Frame resize. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual GetBoundsResizeTest +*/ + +public class GetBoundsResizeTest { + private static final String INSTRUCTIONS = """ + 0. There is a test window with a "Press" button, + Its original bounds should be printed in the text area below. + 1. Resize the test window using the upper left corner. + 2. Press the button to print the result of getBounds() to the text area. + 3. Previously, a window could report an incorrect position on the + screen after resizing the window in this way. + If getBounds() prints the appropriate values for the window, + click Pass, otherwise click Fail. + """; + + private static JTextArea textArea; + private static Frame frame; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + PassFailJFrame passFailJFrame = PassFailJFrame + .builder() + .title("GetBoundsResizeTest Instructions") + .instructions(INSTRUCTIONS) + .splitUIBottom(() -> { + textArea = new JTextArea("", 8, 55); + textArea.setEditable(false); + return new JScrollPane(textArea); + }) + .testUI(GetBoundsResizeTest::getFrame) + .rows((int) (INSTRUCTIONS.lines().count() + 2)) + .columns(40) + .build(); + + robot.waitForIdle(); + robot.delay(500); + + EventQueue.invokeAndWait(() -> + logFrameBounds("Original Frame.getBounds() = %s\n")); + + passFailJFrame.awaitAndCheck(); + } + + private static Frame getFrame() { + frame = new Frame("GetBoundsResizeTest"); + + Button button = new Button("Press"); + button.addActionListener((e) -> + logFrameBounds("Current Frame.getBounds() = %s\n")); + + frame.add(button); + frame.setSize(200, 100); + + return frame; + } + + private static void logFrameBounds(String format) { + textArea.append(format.formatted(frame.getBounds())); + } +} diff --git a/test/jdk/java/awt/Frame/GetBoundsResizeTest/GetBoundsResizeTest.java b/test/jdk/java/awt/Frame/GetBoundsResizeTest/GetBoundsResizeTest.java deleted file mode 100644 index 9dad65ddd2c..00000000000 --- a/test/jdk/java/awt/Frame/GetBoundsResizeTest/GetBoundsResizeTest.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1998, 2014, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @test - @bug 4103095 - @summary Test for getBounds() after a Frame resize. - @author andrei.dmitriev : area=awt.toplevel - @run main/manual GetBoundsResizeTest -*/ - -import java.applet.Applet; -import java.lang.*; -import java.awt.*; -import java.awt.event.*; - -class Globals { - static boolean testPassed=false; - static Thread mainThread=null; -} - -public class GetBoundsResizeTest extends Applet { - - public static void main(String args[]) throws Exception { - GetBoundsResizeTest app = new GetBoundsResizeTest(); - app.start(); - Globals.mainThread = Thread.currentThread(); - try { - Thread.sleep(300000); - } catch (InterruptedException e) { - if (!Globals.testPassed) - throw new Exception("GetBoundsResizeTest failed."); - } - } - - public void start() - { - String[] message = { - "Resize the window using the upper left corner.", - "Press the button to print the result of getBounds() to the terminal.", - "If getBounds() prints the correct values for the window", - "then click Pass, else click Fail." - }; - new TestDialog(new Frame(), "GetBoundsResizeTest", message).start(); - new GetBoundsResizeTester("GetBoundsResizeTester").start(); - } -} - -//////////////////////////////////////////////////////////////////////// -// Test Dialog -//////////////////////////////////////////////////////////////////////// - -class TestDialog extends Dialog - implements ActionListener { - - static TextArea output; - Button passButton; - Button failButton; - String name; - - public TestDialog(Frame frame, String name, String[] message) - { - super(frame, name + " Pass/Fail Dialog"); - this.name = name; - int maxStringLength = 0; - for (int i=0; i Date: Thu, 20 Jun 2024 10:07:21 +0000 Subject: [PATCH 093/329] 8301686: TLS 1.3 handshake fails if server_name doesn't match resuming session Backport-of: 0259da92831087e918d00b8a83e04c96a6877f41 --- .../sun/security/ssl/ServerNameExtension.java | 7 +- ...erverNameRejectedTLSSessionResumption.java | 247 ++++++++++++++++++ 2 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 test/jdk/javax/net/ssl/SSLSession/ServerNameRejectedTLSSessionResumption.java diff --git a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java index 74f38bf5b56..18d05ca3585 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -42,6 +42,7 @@ import static sun.security.ssl.SSLExtension.CH_SERVER_NAME; import static sun.security.ssl.SSLExtension.EE_SERVER_NAME; import sun.security.ssl.SSLExtension.ExtensionConsumer; +import static sun.security.ssl.SSLExtension.SH_PRE_SHARED_KEY; import static sun.security.ssl.SSLExtension.SH_SERVER_NAME; import sun.security.ssl.SSLExtension.SSLExtensionSpec; import sun.security.ssl.SSLHandshake.HandshakeMessage; @@ -344,6 +345,10 @@ public void consume(ConnectionContext context, sni, shc.resumingSession.serverNameIndication)) { shc.isResumption = false; shc.resumingSession = null; + // this server is disallowing this session resumption, + // so don't include the pre-shared key in the + // ServerHello handshake message + shc.handshakeExtensions.remove(SH_PRE_SHARED_KEY); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine( "abort session resumption, " + diff --git a/test/jdk/javax/net/ssl/SSLSession/ServerNameRejectedTLSSessionResumption.java b/test/jdk/javax/net/ssl/SSLSession/ServerNameRejectedTLSSessionResumption.java new file mode 100644 index 00000000000..f80f3402c7e --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLSession/ServerNameRejectedTLSSessionResumption.java @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.nio.ByteBuffer; +import java.util.List; +import java.util.Objects; + +import javax.net.ssl.SNIHostName; +import javax.net.ssl.SNIMatcher; +import javax.net.ssl.SNIServerName; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLEngineResult; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.StandardConstants; + +/* + * @test + * @bug 8301686 + * @summary verifies that if the server rejects session resumption due to SNI + * mismatch, during TLS handshake, then the subsequent communication + * between the server and the client happens correctly without any + * errors + * @library /javax/net/ssl/templates + * @run main/othervm -Djavax.net.debug=all + * ServerNameRejectedTLSSessionResumption + */ +public class ServerNameRejectedTLSSessionResumption + extends SSLContextTemplate { + + private static final String CLIENT_REQUESTED_SNI = "client.local"; + // dummy host, no connection is attempted in this test + private static final String PEER_HOST = "foobar"; + // dummy port, no connection is attempted in this test + private static final int PEER_PORT = 12345; + + public static void main(final String[] args) throws Exception { + new ServerNameRejectedTLSSessionResumption().runTest(); + } + + private void runTest() throws Exception { + final SSLContext clientSSLContext = createClientSSLContext(); + final SSLContext serverSSLContext = createServerSSLContext(); + // create client and server SSLEngine(s) + final SSLEngine clientEngine = createClientSSLEngine(clientSSLContext); + // use a SNIMatcher on the server's SSLEngine which accepts the + // SNI name presented by the client SSLEngine + final SSLEngine serverEngine = createServerSSLEngine(serverSSLContext, + new TestSNIMatcher(CLIENT_REQUESTED_SNI)); + // establish communication, which involves TLS handshake, between the + // client and server engines. this communication expected to be + // successful. + communicate(clientEngine, serverEngine); + // now that the communication has been successful, we expect the client + // SSLContext's (internal) cache to have created and cached a + // SSLSession against the peer host:port + + // now create the SSLEngine(s) again with the same SSLContext + // instances as before, so that the SSLContext instance attempts + // to reuse the cached SSLSession against the peer host:port + final SSLEngine secondClientEngine = + createClientSSLEngine(clientSSLContext); + // the newly created SSLEngine for the server will not use any + // SNIMatcher so as to reject the session resumption (of the + // cached SSLSession) + final SSLEngine secondServerEngine = + createServerSSLEngine(serverSSLContext, null); + // attempt communication, which again involves TLS handshake + // since these are new engine instances. The session resumption + // should be rejected and a fresh session should get created and + // communication should succeed without any errors + communicate(secondClientEngine, secondServerEngine); + } + + private static void communicate(final SSLEngine clientEngine, + final SSLEngine serverEngine) + throws Exception { + + final ByteBuffer msgFromClient = + ByteBuffer.wrap("Hi Server, I'm Client".getBytes()); + final ByteBuffer msgFromServer = + ByteBuffer.wrap("Hello Client, I'm Server".getBytes()); + final ByteBuffer clientBuffer = ByteBuffer.allocate(1 << 15); + final ByteBuffer serverBuffer = ByteBuffer.allocate(1 << 15); + /* + * For data transport, this test uses local ByteBuffers + */ + final ByteBuffer clientToServerTransport = + ByteBuffer.allocateDirect(1 << 16); + final ByteBuffer serverToClientTransport = + ByteBuffer.allocateDirect(1 << 16); + boolean isClientToServer = true; + while (true) { + if (isClientToServer) { + // send client's message over the transport, will initiate a + // TLS handshake if necessary + SSLEngineResult result = clientEngine.wrap(msgFromClient, + clientToServerTransport); + // run any delegated tasks + final HandshakeStatus hsStatus = checkAndRunTasks(clientEngine, + result.getHandshakeStatus()); + clientToServerTransport.flip(); // will now contain the + // network data from + // client to server + + // read from the client generated network data into + // server's buffer + result = serverEngine.unwrap(clientToServerTransport, + serverBuffer); + checkAndRunTasks(serverEngine, result.getHandshakeStatus()); + clientToServerTransport.compact(); + + if (hsStatus == HandshakeStatus.NEED_UNWRAP) { + isClientToServer = false; + } else if (hsStatus == HandshakeStatus.FINISHED) { + break; + } else if (hsStatus != HandshakeStatus.NEED_WRAP) { + throw new Exception("Unexpected handshake result " + + result); + } + } else { + // send server's message over the transport + SSLEngineResult result = serverEngine.wrap(msgFromServer, + serverToClientTransport); + // run any delegated tasks on the server side + final HandshakeStatus hsStatus = checkAndRunTasks(serverEngine, + result.getHandshakeStatus()); + serverToClientTransport.flip(); // will now contain the + // network data from + // server to client + + // read from the server generated network data into + // client's buffer + result = clientEngine.unwrap(serverToClientTransport, + clientBuffer); + // run any delegated tasks on the client side + checkAndRunTasks(clientEngine, result.getHandshakeStatus()); + serverToClientTransport.compact(); + + if (hsStatus == HandshakeStatus.NEED_UNWRAP) { + isClientToServer = true; + } else if (hsStatus == HandshakeStatus.FINISHED) { + break; + } else if (hsStatus != HandshakeStatus.NEED_WRAP) { + throw new Exception("Unexpected handshake result " + + result); + } + } + } + serverEngine.wrap(msgFromServer, serverToClientTransport); + serverToClientTransport.flip(); + clientEngine.unwrap(serverToClientTransport, clientBuffer); + serverToClientTransport.compact(); + } + + private static SSLEngine createServerSSLEngine( + final SSLContext sslContext, final SNIMatcher sniMatcher) { + final SSLEngine serverEngine = sslContext.createSSLEngine(); + serverEngine.setUseClientMode(false); + if (sniMatcher != null) { + final SSLParameters sslParameters = + serverEngine.getSSLParameters(); // returns a copy + sslParameters.setSNIMatchers(List.of(sniMatcher)); + // use the updated params + serverEngine.setSSLParameters(sslParameters); + } + return serverEngine; + } + + private static SSLEngine createClientSSLEngine( + final SSLContext sslContext) { + final SSLEngine clientEngine = sslContext.createSSLEngine(PEER_HOST, + PEER_PORT); + clientEngine.setUseClientMode(true); + final SSLParameters params = + clientEngine.getSSLParameters(); // returns a copy + // setup SNI name that will be used by the client during TLS handshake + params.setServerNames(List.of(new SNIHostName(CLIENT_REQUESTED_SNI))); + clientEngine.setSSLParameters(params); // use the updated params + return clientEngine; + } + + private static HandshakeStatus checkAndRunTasks( + final SSLEngine engine, final HandshakeStatus handshakeStatus) { + if (handshakeStatus != HandshakeStatus.NEED_TASK) { + return handshakeStatus; + } + Runnable runnable; + while ((runnable = engine.getDelegatedTask()) != null) { + System.out.println("Running task " + runnable); + runnable.run(); + } + return engine.getHandshakeStatus(); + } + + private static final class TestSNIMatcher extends SNIMatcher { + + private final String recognizedSNIServerName; + + private TestSNIMatcher(final String recognizedSNIServerName) { + super(StandardConstants.SNI_HOST_NAME); + this.recognizedSNIServerName = recognizedSNIServerName; + } + + @Override + public boolean matches(final SNIServerName clientRequestedSNI) { + Objects.requireNonNull(clientRequestedSNI); + System.out.println("Attempting SNI match against client" + + " request SNI name: " + clientRequestedSNI + + " against server recognized SNI name " + + recognizedSNIServerName); + if (!SNIHostName.class.isInstance(clientRequestedSNI)) { + System.out.println("SNI match failed - client request" + + " SNI isn't a SNIHostName"); + // we only support SNIHostName type + return false; + } + final String requestedName = + ((SNIHostName) clientRequestedSNI).getAsciiName(); + final boolean matches = + recognizedSNIServerName.equals(requestedName); + System.out.println("SNI match " + (matches ? "passed" : "failed")); + return matches; + } + } +} From 20ee52e4e383d2d0408ed40afbe7cb7d0dc4ff9f Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Thu, 20 Jun 2024 23:20:27 +0000 Subject: [PATCH 094/329] 8331063: Some HttpClient tests don't report leaks Backport-of: e4ed7ced75c53cf5ff40c5dae4830b1ee2589802 --- .../net/httpclient/ForbiddenHeadTest.java | 30 +++++++++++-------- .../net/httpclient/ProxySelectorTest.java | 23 +++++++------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/test/jdk/java/net/httpclient/ForbiddenHeadTest.java b/test/jdk/java/net/httpclient/ForbiddenHeadTest.java index 0c39b44d7f5..4b651eb4813 100644 --- a/test/jdk/java/net/httpclient/ForbiddenHeadTest.java +++ b/test/jdk/java/net/httpclient/ForbiddenHeadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -205,18 +205,18 @@ static final void printFailedTests(ITestContext context) { @DataProvider(name = "all") public Object[][] allcases() { List result = new ArrayList<>(); - for (var client : List.of(authClient, noAuthClient)) { + for (boolean useAuth : List.of(true, false)) { for (boolean async : List.of(true, false)) { for (int code : List.of(UNAUTHORIZED, PROXY_UNAUTHORIZED)) { var srv = code == PROXY_UNAUTHORIZED ? "/proxy" : "/server"; for (var auth : List.of("/auth", "/noauth")) { var pcode = code; if (auth.equals("/noauth")) { - if (client == authClient) continue; + if (useAuth) continue; pcode = FORBIDDEN; } for (var uri : List.of(httpURI, httpsURI, http2URI, https2URI)) { - result.add(new Object[]{uri + srv + auth, pcode, async, client}); + result.add(new Object[]{uri + srv + auth, pcode, async, useAuth}); } } } @@ -237,12 +237,13 @@ protected PasswordAuthentication getPasswordAuthentication() { static final AtomicLong sleepCount = new AtomicLong(); @Test(dataProvider = "all") - void test(String uriString, int code, boolean async, HttpClient client) throws Throwable { + void test(String uriString, int code, boolean async, boolean useAuth) throws Throwable { checkSkip(); + HttpClient client = useAuth ? authClient : noAuthClient; var name = String.format("test(%s, %d, %s, %s)", uriString, code, async ? "async" : "sync", client.authenticator().isPresent() ? "authClient" : "noAuthClient"); out.printf("%n---- starting %s ----%n", name); - assert client.authenticator().isPresent() ? client == authClient : client == noAuthClient; + assert client.authenticator().isPresent() == useAuth; uriString = uriString + "/ForbiddenTest"; for (int i=0; i 1) out.printf("---- ITERATION %d%n",i); @@ -381,13 +382,16 @@ public void teardown() throws Exception { authClient = noAuthClient = null; Thread.sleep(100); AssertionError fail = TRACKER.check(500); - - proxy.stop(); - authproxy.stop(); - httpTestServer.stop(); - httpsTestServer.stop(); - http2TestServer.stop(); - https2TestServer.stop(); + try { + proxy.stop(); + authproxy.stop(); + httpTestServer.stop(); + httpsTestServer.stop(); + http2TestServer.stop(); + https2TestServer.stop(); + } finally { + if (fail != null) throw fail; + } } static class TestProxySelector extends ProxySelector { diff --git a/test/jdk/java/net/httpclient/ProxySelectorTest.java b/test/jdk/java/net/httpclient/ProxySelectorTest.java index bb3ddc84017..fd8f85fa6d7 100644 --- a/test/jdk/java/net/httpclient/ProxySelectorTest.java +++ b/test/jdk/java/net/httpclient/ProxySelectorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -377,15 +377,18 @@ public void teardown() throws Exception { client = null; Thread.sleep(100); AssertionError fail = TRACKER.check(500); - - proxy.stop(); - authproxy.stop(); - httpTestServer.stop(); - proxyHttpTestServer.stop(); - authProxyHttpTestServer.stop(); - httpsTestServer.stop(); - http2TestServer.stop(); - https2TestServer.stop(); + try { + proxy.stop(); + authproxy.stop(); + httpTestServer.stop(); + proxyHttpTestServer.stop(); + authProxyHttpTestServer.stop(); + httpsTestServer.stop(); + http2TestServer.stop(); + https2TestServer.stop(); + } finally { + if (fail != null) throw fail; + } } class TestProxySelector extends ProxySelector { From 04aa5f840caea905261819869b1b3011deb9719a Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Fri, 21 Jun 2024 02:13:50 +0000 Subject: [PATCH 095/329] 8332936: Test vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java fails with no GC's recorded Backport-of: 5ed0d52c8424dd2e7f1ac2404e9fabb40c8402b8 --- .../vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java | 1 + .../vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java | 1 + .../vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java | 1 + .../metaspace/gc/watermark_99_100/TestDescription.java | 1 + 4 files changed, 4 insertions(+) diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java index 077ad3d9c4e..12768372d50 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_0_1/TestDescription.java @@ -33,6 +33,7 @@ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "Z" + * @requires vm.compMode != "Xcomp" * @library /vmTestbase /test/lib * @run main/othervm * -Xmx1g diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java index badfb3a6b0a..a630ece929c 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_10_20/TestDescription.java @@ -33,6 +33,7 @@ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "Z" + * @requires vm.compMode != "Xcomp" * @library /vmTestbase /test/lib * @run main/othervm * -Xmx1g diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java index 48a65368141..1fcf766b2eb 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_70_80/TestDescription.java @@ -33,6 +33,7 @@ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "Z" + * @requires vm.compMode != "Xcomp" * @library /vmTestbase /test/lib * @run main/othervm * -Xmx1g diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java index 6f3467e996a..d2025c8dc0e 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/watermark_99_100/TestDescription.java @@ -33,6 +33,7 @@ * @requires vm.gc != null | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "G1" | !vm.opt.final.ClassUnloadingWithConcurrentMark * @requires vm.gc != "Z" + * @requires vm.compMode != "Xcomp" * @library /vmTestbase /test/lib * @run main/othervm * -Xmx1g From 3df08b2c34eb3fcb075f334fce8de63d52b9c6bf Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Fri, 21 Jun 2024 02:14:08 +0000 Subject: [PATCH 096/329] 8328560: java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java imports Applet Backport-of: e81374e0501a8201dac701824d2e29f2cedfcdff --- .../ClickDuringKeypress.java | 144 +++++++----------- 1 file changed, 56 insertions(+), 88 deletions(-) diff --git a/test/jdk/java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java b/test/jdk/java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java index 2f0affd5620..ae757bb7d4e 100644 --- a/test/jdk/java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java +++ b/test/jdk/java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, 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 @@ -21,116 +21,89 @@ * questions. */ +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + /* - @test 1.2 98/08/05 + @test @key headful @bug 4515763 @summary Tests that clicking mouse and pressing keys generates correct amount of click-counts - @author andrei.dmitriev: area=awt.mouse @run main ClickDuringKeypress */ -/** - * ClickDuringKeypress.java - * - * summary: - */ - -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; +public class ClickDuringKeypress implements MouseListener { -public class ClickDuringKeypress implements MouseListener - { - //Declare things used in the test, like buttons and labels here final static int CLICKCOUNT = 10; - final static int DOUBLE_CLICK_AUTO_DELAY = 10; - volatile int lastClickCount = 0; - volatile boolean clicked = false; - volatile boolean ready = false; - - Frame frame; - Robot robot; - - public void init() - { - //Create instructions for the user here, as well as set up - // the environment -- set the layout manager, add buttons, - // etc. - + final static int DOUBLE_CLICK_AUTO_DELAY = 20; + static volatile int lastClickCount = 0; + static volatile boolean clicked = false; + static volatile boolean ready = false; + + static volatile Frame frame; + static volatile Robot robot; + static final ClickDuringKeypress clicker = new ClickDuringKeypress(); + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(ClickDuringKeypress::createUI); + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.delay(2000); + robot.mouseMove(200, 200); + robot.delay(2000); + EventQueue.invokeAndWait(() -> frame.setVisible(true)); + doTest(); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } + + static void createUI() { frame = new Frame("ClickDuringKeypress"); - frame.addMouseListener(this); + frame.addMouseListener(clicker); frame.addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent e) { - synchronized(ClickDuringKeypress.this) { ready = true; - ClickDuringKeypress.this.notifyAll(); - } } }); frame.setBounds(0, 0, 400, 400); + } - start(); - - }//End init() - - public void start () - { - try { - robot = new Robot(); - } catch (AWTException e) { - System.out.println("Could not create Robot."); - throw new RuntimeException("Couldn't create Robot. Test fails"); - } - - robot.mouseMove(200, 200); - frame.show(); - - synchronized(this) { - try { - if (!ready) { - wait(10000); - } - } catch (InterruptedException ex) { - } - if (!ready) { - System.out.println("Not Activated. Test fails"); - throw new RuntimeException("Not Activated. Test fails"); - } + static void doTest() throws Exception { + robot.waitForIdle(); + robot.delay(1000); + if (!ready) { + System.out.println("Not Activated. Test fails"); + throw new RuntimeException("Not Activated. Test fails"); } - - doTest(); - - //What would normally go into main() will probably go here. - //Use System.out.println for diagnostic messages that you want - //to read after the test is done. - //Use Sysout.println for messages you want the tester to read. - - }// start() - - // Mouse should be over the Frame by this point - private void doTest() { + // Mouse should be over the Frame by this point robot.setAutoDelay(2000); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_B); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.delay(10); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); // Should trigger mouseClicked robot.keyRelease(KeyEvent.VK_B); robot.delay(1000); robot.setAutoDelay(DOUBLE_CLICK_AUTO_DELAY); for (int i = 0; i < CLICKCOUNT / 2; i++) { - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.delay(10); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.keyPress(KeyEvent.VK_B); - robot.delay(10); robot.keyRelease(KeyEvent.VK_B); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.delay(10); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); } robot.waitForIdle(); // check results @@ -156,9 +129,4 @@ public void mouseClicked(MouseEvent e) { clicked = true; lastClickCount = e.getClickCount(); } - - public static void main(String[] args) { - new ClickDuringKeypress().init(); - } - - }// class ClickDuringKeypress +} From e99613586755e43b8effb9967c0034a6e0c41b20 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Fri, 21 Jun 2024 02:15:45 +0000 Subject: [PATCH 097/329] 8320079: The ArabicBox.java test has no control buttons Backport-of: 792fc9d114977664da0b3bebf0f1d82360d375b6 --- .../java/awt/font/TextLayout/ArabicBox.java | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 test/jdk/java/awt/font/TextLayout/ArabicBox.java diff --git a/test/jdk/java/awt/font/TextLayout/ArabicBox.java b/test/jdk/java/awt/font/TextLayout/ArabicBox.java new file mode 100644 index 00000000000..e03c4cf918e --- /dev/null +++ b/test/jdk/java/awt/font/TextLayout/ArabicBox.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2001, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4427483 + * @summary Arabic text followed by newline should have no missing glyphs + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ArabicBox + */ +public final class ArabicBox { + + private static final String TEXT = + "\u0627\u0644\u0639\u0631\u0628\u064A\u0629\n"; + + private static final String FONT_NAME = Font.DIALOG; + + private static final String INSTRUCTIONS = """ + In the below panel, you should see the following text: + + """ + + TEXT + """ + (It's \u2018Arabic\u2019 in Arabic.) + + If there are no 'box glyphs' for missing glyphs, + press Pass; otherwise, press Fail."""; + + public static void main(String[] args) throws Exception { + final Font font = new Font(FONT_NAME, Font.PLAIN, 24); + System.out.println("asked for " + FONT_NAME + " and got: " + font.getFontName()); + + PassFailJFrame.builder() + .title("Arabic Box") + .instructions(INSTRUCTIONS) + .rows(7) + .columns(40) + .splitUIBottom(() -> createPanel(font)) + .build() + .awaitAndCheck(); + } + + private static JPanel createPanel(Font font) { + return new TextPanel(font); + } + + private static final class TextPanel extends JPanel { + private TextLayout layout; + + private TextPanel(Font font) { + setForeground(Color.black); + setBackground(Color.white); + setFont(font); + setPreferredSize(new Dimension(300, 150)); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D)g; + if (layout == null) { + Font font = g2d.getFont(); + FontRenderContext frc = g2d.getFontRenderContext(); + + layout = new TextLayout(TEXT, font, frc); + System.out.println(layout.getBounds()); + } + + layout.draw(g2d, 10, 50); + g2d.drawString(TEXT, 10, 100); + } + } +} From 33dbf71b8702bdae953bfca7aa6e5832c73d6445 Mon Sep 17 00:00:00 2001 From: Elif Aslan Date: Fri, 21 Jun 2024 02:39:19 +0000 Subject: [PATCH 098/329] 8293872: Make runtime/Thread/ThreadCountLimit.java more robust Backport-of: 36b61c5d7e7732924f494fa24c0e286e41279fc3 --- .../runtime/Thread/ThreadCountLimit.java | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java b/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java index db8a263be5d..418d05197b5 100644 --- a/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java +++ b/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 @@ -25,7 +25,7 @@ * @test * @summary Stress test that reaches the process limit for thread count, or time limit. * @key stress - * @run main ThreadCountLimit + * @run main/othervm -Xmx1g ThreadCountLimit */ import java.util.concurrent.CountDownLatch; @@ -36,36 +36,18 @@ public class ThreadCountLimit { static final int TIME_LIMIT_MS = 5000; // Create as many threads as possible in 5 sec static class Worker extends Thread { - private final int index; private final CountDownLatch startSignal; - Worker(int index, CountDownLatch startSignal) { - this.index = index; + Worker(CountDownLatch startSignal) { this.startSignal = startSignal; } @Override public void run() { - if ((index % 250) == 0) { - System.out.println("INFO: thread " + index + " waiting to start"); - } - try { startSignal.await(); } catch (InterruptedException e) { - throw new Error("Unexpected: " + e); - } - - setName(String.valueOf(index)); - - Thread.yield(); - - if (index != Integer.parseInt(getName())) { - throw new Error("setName/getName failed!"); - } - - if ((index % 250) == 0) { - System.out.println("INFO: thread " + getName() + " working"); + throw new Error("Unexpected", e); } } } @@ -74,27 +56,37 @@ public static void main(String[] args) { CountDownLatch startSignal = new CountDownLatch(1); ArrayList workers = new ArrayList(); + boolean reachedTimeLimit = false; + boolean reachedNativeOOM = false; + int countAtTimeLimit = -1; + int countAtNativeOOM = -1; + + // This is dangerous loop: it depletes system resources, + // so doing additional things there that may end up allocating + // Java/native memory risks failing the VM prematurely. + // Avoid doing unnecessary calls, printouts, etc. + int count = 1; long start = System.currentTimeMillis(); try { while (true) { - Worker w = new Worker(count, startSignal); + Worker w = new Worker(startSignal); w.start(); workers.add(w); count++; long end = System.currentTimeMillis(); if ((end - start) > TIME_LIMIT_MS) { - // Windows path or a system with very large ulimit - System.out.println("INFO: reached the time limit " + TIME_LIMIT_MS + " ms, with " + count + " threads created"); + reachedTimeLimit = true; + countAtTimeLimit = count; break; } } } catch (OutOfMemoryError e) { if (e.getMessage().contains("unable to create native thread")) { // Linux, macOS path - long end = System.currentTimeMillis(); - System.out.println("INFO: reached this process thread count limit at " + count + " [" + (end - start) + " ms]"); + reachedNativeOOM = true; + countAtNativeOOM = count; } else { throw e; } @@ -107,7 +99,18 @@ public static void main(String[] args) { w.join(); } } catch (InterruptedException e) { - throw new Error("Unexpected: " + e); + throw new Error("Unexpected", e); + } + + // Now that all threads have joined, we are away from dangerous + // VM state and have enough memory to perform any other things. + if (reachedTimeLimit) { + // Windows path or a system with very large ulimit + System.out.println("INFO: reached the time limit " + TIME_LIMIT_MS + + " ms, with " + countAtTimeLimit + " threads created"); + } else if (reachedNativeOOM) { + System.out.println("INFO: reached this process thread count limit with " + + countAtNativeOOM + " threads created"); } } } From 82e85fddcd1f29cee7c43be111109c9d53bc76b4 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 21 Jun 2024 20:03:00 +0000 Subject: [PATCH 099/329] 8327840: Automate javax/swing/border/Test4129681.java Backport-of: 177b8a241c11782b302607c0068b15b38112e67c --- test/jdk/javax/swing/border/Test4129681.java | 76 +++++++++++--------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/test/jdk/javax/swing/border/Test4129681.java b/test/jdk/javax/swing/border/Test4129681.java index c629f1ac951..993dc2d139c 100644 --- a/test/jdk/javax/swing/border/Test4129681.java +++ b/test/jdk/javax/swing/border/Test4129681.java @@ -21,52 +21,62 @@ * questions. */ -import java.awt.event.ItemEvent; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Point; import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.JCheckBox; -import javax.swing.JComponent; import javax.swing.JLabel; +import javax.swing.UIManager; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; /* * @test * @bug 4129681 * @summary Tests disabling of titled border's caption - * @library /java/awt/regtesthelpers - * @build PassFailJFrame - * @run main/manual Test4129681 + * @run main/othervm -Dsun.java2d.uiScale=1 Test4129681 */ public class Test4129681 { public static void main(String[] args) throws Exception { - String testInstructions = """ - Click the checkbox to disable the label. - The test passes if the title of the border - is disabled as well as the label. - """; + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + int correctColoredPixels = 0; + int totalPixels = 0; + int tolerance = 20; + JLabel label; + Color labelDisableColor = Color.RED; + Dimension SIZE = new Dimension(100, 40); + Point startPoint = new Point(8, 4); + Point endPoint = new Point(18, 14); - PassFailJFrame.builder() - .title("Test Instructions") - .instructions(testInstructions) - .rows(4) - .columns(25) - .splitUI(Test4129681::init) - .build() - .awaitAndCheck(); - } + label = new JLabel("Label"); + label.setBorder(BorderFactory.createTitledBorder("\u2588".repeat(5))); + UIManager.getDefaults().put("Label.disabledForeground", labelDisableColor); + label.setSize(SIZE); + label.setEnabled(false); + BufferedImage image = new BufferedImage(label.getWidth(), label.getHeight(), + BufferedImage.TYPE_INT_ARGB); + + Graphics2D g2d = image.createGraphics(); + label.paint(g2d); + g2d.dispose(); - public static JComponent init() { - JLabel label = new JLabel("message"); - JCheckBox check = new JCheckBox("Enable/Disable"); - check.addItemListener(event -> - label.setEnabled(ItemEvent.DESELECTED == event.getStateChange())); - label.setBorder(BorderFactory.createTitledBorder("label")); - label.setEnabled(!check.isSelected()); + for (int x = startPoint.x; x < endPoint.x; x++) { + for (int y = startPoint.y; y < endPoint.y; y++) { + if (image.getRGB(x, y) == labelDisableColor.getRGB()) { + correctColoredPixels++; + } + totalPixels++; + } + } - Box main = Box.createVerticalBox(); - main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); - main.add(check); - main.add(label); - return main; + if (((double) correctColoredPixels / totalPixels * 100) <= tolerance) { + ImageIO.write(image, "png", new File("failureImage.png")); + throw new RuntimeException("Label with border is not disabled"); + } + System.out.println("Test Passed"); } } From 46cefcaf5d0ae45f3f53f36642c2741a4073dd79 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:47:38 +0000 Subject: [PATCH 100/329] 8294994: Update Jarsigner and Keytool i18n tests to validate i18n compliance Reviewed-by: mdoerr Backport-of: ac1941425bdb1a25aa3364eef9eb1092ee716761 --- test/jdk/TEST.groups | 6 +- test/jdk/sun/security/tools/keytool/i18n.java | 341 +++++++++++++++++- test/lib/jdk/test/lib/UIBuilder.java | 160 ++++++++ 3 files changed, 495 insertions(+), 12 deletions(-) create mode 100644 test/lib/jdk/test/lib/UIBuilder.java diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 21793455ff9..278250146b4 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -586,12 +586,12 @@ jdk_core_manual_no_input_security = \ sun/security/smartcardio/TestMultiplePresent.java \ sun/security/smartcardio/TestPresent.java \ sun/security/smartcardio/TestTransmit.java \ - sun/security/tools/jarsigner/compatibility/Compatibility.java \ - sun/security/tools/keytool/i18n.java + sun/security/tools/jarsigner/compatibility/Compatibility.java jdk_core_manual_requires_human_input = \ com/sun/jndi/dns/Test6991580.java \ - java/util/TimeZone/DefaultTimeZoneTest.java + java/util/TimeZone/DefaultTimeZoneTest.java \ + sun/security/tools/keytool/i18n.java # Test sets for running inside container environment diff --git a/test/jdk/sun/security/tools/keytool/i18n.java b/test/jdk/sun/security/tools/keytool/i18n.java index 15895cb47aa..d7e01bab35e 100644 --- a/test/jdk/sun/security/tools/keytool/i18n.java +++ b/test/jdk/sun/security/tools/keytool/i18n.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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,17 +23,340 @@ /* * @test - * @bug 4348369 8076069 - * @summary keytool not i18n compliant + * @bug 4348369 8076069 8294994 + * @summary keytool i18n compliant * @author charlie lai - * @run main/manual i18n + * @modules java.base/sun.security.tools.keytool + * @library /test/lib + * @run main/manual/othervm -Duser.language=en i18n */ -import java.nio.file.Path; +/* + * @test + * @bug 4348369 8076069 8294994 + * @summary keytool i18n compliant + * @author charlie lai + * @modules java.base/sun.security.tools.keytool + * @library /test/lib + * @run main/manual/othervm -Duser.language=de i18n + */ + +/* + * @test + * @bug 4348369 8076069 8294994 + * @summary keytool i18n compliant + * @author charlie lai + * @modules java.base/sun.security.tools.keytool + * @library /test/lib + * @run main/manual/othervm -Duser.language=ja i18n + */ + +/* + * @test + * @bug 4348369 8076069 8294994 + * @summary keytool i18n compliant + * @author charlie lai + * @modules java.base/sun.security.tools.keytool + * @library /test/lib + * @run main/manual/othervm -Duser.language=zh -Duser.country=CN i18n + */ + +import jdk.test.lib.UIBuilder; + +import javax.swing.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Locale; + +public class i18n { + private static final String[][] TABLE = new String[][]{ + {"-help", "All the output in this test should be in ${LANG}. " + + "Otherwise, the test failed."}, + + {"-genkeypair -keyalg DSA -v -keysize 512 " + + "-dname cn=Name,ou=Java,o=Oracle,l=City,s=State,c=Country " + + "-storepass a " + + "-keypass a " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang.Exception: " + + "Keystore password must be at least 6 characters."}, + + {"-genkeypair -keyalg DSA -v -keysize 512 " + + "-dname cn=Name,ou=Java,o=Oracle,l=City,s=State,c=Country " + + "-storepass password " + + "-keypass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check: generated a 512 bit DSA key pair " + + "for CN=Name, OU=Java, O=Oracle, L=City, ST=State " + + "C=Country."}, + + {"-list -v -storepass password -keystore ./i18n.keystore", + "Output in ${LANG}. Check: contains 1 keystore entry with " + + "512-bit DSA key algorithm for CN=Name, OU=Java, " + + "O=Oracle, L=City, ST=State C=Country."}, + + {"-list -v -storepass a -keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error:java.io.IOException: " + + "keystore password was incorrect."}, + + {"-genkey -keyalg DSA -v -keysize 512 " + + "-storepass password " + + "-keypass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang.Exception: " + + "alias 'mykey' already exists."}, + + {"-genkeypair -keyalg DSA -v -keysize 512 " + + "-dname cn=Name,ou=Java,o=Oracle,l=City,s=State,c=Country " + + "-alias mykey2 " + + "-storepass password " + + "-keypass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check: generated a 512 bit DSA key pair " + + "for CN=Name, OU=Java, O=Oracle, L=City, ST=State " + + "C=Country."}, + + {"-list -v -storepass password -keystore ./i18n.keystore", + "Output in ${LANG}. Check: contains 2 keystore entries " + + "(alias name mykey & mykey2), both with 512-bit DSA" + + " key algorithm for CN=Name, OU=Java, O=Oracle, " + + "L=City, ST=State C=Country."}, + + {"-keypasswd -v " + + "-alias mykey2 " + + "-storepass password " + + "-keypass password " + + "-new a " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang.Exception: " + + "New password must be at least 6 characters."}, + + {"-keypasswd -v " + + "-alias mykey2 " + + "-storepass password " + + "-keypass password " + + "-new aaaaaa " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: -keypasswd " + + "commands not supported if -storetype is PKCS12."}, + + {"-genkeypair -keyalg DSA -v -keysize 512 " + + "-dname cn=Name,ou=Java,o=Oracle,l=City,s=State,c=Country " + + "-storepass password " + + "-keypass password " + + "-keystore ./i18n.jks " + + "-storetype JKS", + "Output in ${LANG}. Check: generated a 512 bit DSA key pair " + + "with a JKS warning."}, + + {"-keypasswd -v " + + "-storepass password " + + "-keypass password " + + "-new aaaaaa " + + "-keystore ./i18n.jks", + "Output in ${LANG}. Check: storing i18n.jks with a JKS warning."}, + + {"-selfcert -v -alias mykey " + + "-storepass password " + + "-keypass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check: generated a new certificate " + + "(self-signed)."}, + + {"-list -v -storepass password -keystore ./i18n.keystore", + "Output in ${LANG}. Check: contains 2 keystore entries " + + "(alias name mykey & mykey2), both with 512-bit DSA" + + " key algorithm for CN=Name, OU=Java, O=Oracle, " + + "L=City, ST=State C=Country."}, + + {"-export -v -alias mykey " + + "-file backup.keystore " + + "-storepass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check: certificate stored in file ."}, + + {"-import -v " + + "-file backup.keystore " + + "-storepass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: reply and certificate " + + "in keystore are identical."}, + + {"-printcert -file backup.keystore", + "Output in ${LANG}. Check: 512 bit DSA key pair for CN=Name," + + " OU=Java, O=Oracle, L=City, ST=State C=Country."}, + + {"-list -storepass password -keystore ./i18n.keystore " + + "-addprovider SUN", + "Output in ${LANG}. Check: contains 2 keystore entries " + + "(alias name mykey & mykey2)."}, + + {"-storepasswd " + + "-storepass password " + + "-new a " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang.Exception: " + + "New password must be at least 6 characters."}, + + {"-storepasswd " + + "-storetype PKCS11 " + + "-keystore NONE", + "Output in ${LANG}. Check keytool error: java.lang" + + ".UnsupportedOperationException: -storepasswd and " + + "-keypasswd commands not supported if -storetype is" + + " PKCS11."}, + + {"-keypasswd " + + "-storetype PKCS11 " + + "-keystore NONE", + "Output in ${LANG}. Check keytool error: java.lang" + + ".UnsupportedOperationException: -storepasswd and " + + "-keypasswd commands not supported if -storetype is" + + " PKCS11."}, + + {"-list -protected " + + "-storepass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang" + + ".IllegalArgumentException: if -protected is " + + "specified, then -storepass, -keypass, and -new " + + "must not be specified."}, + + {"-keypasswd -protected " + + "-storepass password " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang" + + ".IllegalArgumentException: if -protected is " + + "specified, then -storepass, -keypass, and -new " + + "must not be specified."}, + + {"-keypasswd -protected " + + "-storepass password " + + "-new aaaaaa " + + "-keystore ./i18n.keystore", + "Output in ${LANG}. Check keytool error: java.lang" + + ".IllegalArgumentException: if -protected is " + + "specified, then -storepass, -keypass, and -new " + + "must not be specified."}, + }; + private static String TEST_SRC = System.getProperty("test.src"); + private static int TIMEOUT_MS = 120000; + private volatile boolean failed = false; + private volatile boolean aborted = false; + private Thread currentThread = null; + + public static void executeKeytool(String command) throws Exception { + sun.security.tools.keytool.Main.main(command.split("\\s+")); + } + + public static void main(String[] args) { + final String lang = System.getProperty("user.language"); + final String country = System.getProperty("user.country"); + + if (lang != null) { + if (country != null) { + Locale.setDefault(new Locale(lang, country)); + } else { + Locale.setDefault(new Locale(lang)); + } + } + + final String displayName = Locale.getDefault().getDisplayName(); + + boolean testFailed = false; + i18n i18nTest = new i18n(); + + for (String[] entry : TABLE) { + String command = entry[0].replaceAll("\\$\\{TEST_SRC\\}", TEST_SRC); + String instruction = entry[1].replaceAll("\\$\\{LANG\\}", displayName); + + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + + doKeytool(command, new PrintStream(buffer, true)); + + testFailed |= i18nTest.validate(command, instruction, buffer.toString()); + } + + if (testFailed) { + throw new RuntimeException("One or more tests failed."); + } + } + + public static void doKeytool(String command, PrintStream dest) { + // Backups stdout and stderr. + PrintStream origStdOut = System.out; + PrintStream origErrOut = System.err; + + // Redirects the system output to a custom one. + System.setOut(dest); + System.setErr(dest); + + try { + executeKeytool("-debug " + command); + } catch (Exception e) { + // Do nothing. + } finally { + System.setOut(origStdOut); + System.setErr(origErrOut); + } + } + + public boolean validate(String command, String instruction, String message) { + failed = false; + currentThread = Thread.currentThread(); + JDialog dialog = new UIBuilder.DialogBuilder() + .setTitle("keytool " + command) + .setInstruction(instruction) + .setMessage(message) + .setPassAction(e -> pass()) + .setFailAction(e -> fail()) + .setCloseAction(() -> abort()) + .build(); + + SwingUtilities.invokeLater(() -> { + try { + dialog.setVisible(true); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + + try { + Thread.sleep(TIMEOUT_MS); + //Timed out, so fail the test + throw new RuntimeException( + "Timed out after " + TIMEOUT_MS / 1000 + " seconds"); + } catch (InterruptedException e) { + if (aborted) { + throw new RuntimeException("TEST ABORTED"); + } + + if (failed) { + System.out.println(command + ": TEST FAILED"); + System.out.println(message); + } else { + System.out.println(command + ": TEST PASSED"); + } + } finally { + dialog.dispose(); + } + + return failed; + } + + public void pass() { + failed = false; + currentThread.interrupt(); + } + + public void fail() { + failed = true; + currentThread.interrupt(); + } -public class i18n{ - public static void main(String[] args) throws Exception { - System.out.println("see i18n.html"); - System.out.println(Path.of(System.getProperty("test.jdk"), "bin", "keytool")); + public void abort() { + aborted = true; + currentThread.interrupt(); } } diff --git a/test/lib/jdk/test/lib/UIBuilder.java b/test/lib/jdk/test/lib/UIBuilder.java new file mode 100644 index 00000000000..c58f563ff52 --- /dev/null +++ b/test/lib/jdk/test/lib/UIBuilder.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2022, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.test.lib; + +import javax.swing.*; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/** + * This is a common library for building UI for testing purposes. + */ +public class UIBuilder { + + /** + * Creates a {@link javax.swing.JDialog} object with a fixed layout that contains + * an instructions {@link javax.swing.JTextArea} and a message + * {@link javax.swing.JTextArea} for displaying text contents. Text contents can + * be set by using {@code setInstruction} method and {@code setMessage} method. + * + * The {@link javax.swing.JDialog} object also a pass {@link javax.swing.JButton} + * and a fail {@link javax.swing.JButton} to indicate test result. Buttons' action + * can be bound by using {@code setPassAction} and {@code setFailAction}. + */ + public static class DialogBuilder { + private JDialog dialog; + private JTextArea instructionsText; + private JTextArea messageText; + private JButton pass; + private JButton fail; + + /** + * Construct a new DialogBuilder object. + */ + public DialogBuilder() { + dialog = new JDialog(new JFrame()); + dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); + instructionsText = new JTextArea("", 5, 100); + + dialog.add("North", new JScrollPane(instructionsText, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS)); + + messageText = new JTextArea("", 20, 100); + dialog.add("Center", new JScrollPane(messageText, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS)); + + JPanel buttons = new JPanel(); + pass = new JButton("pass"); + pass.setActionCommand("pass"); + buttons.add("East", pass); + + fail = new JButton("fail"); + fail.setActionCommand("fail"); + buttons.add("West", fail); + + dialog.add("South", buttons); + } + + /** + * Returns this {@code DialogBuilder} setting the dialog's title to a new value. + * @param title a string value + * @returns this DialogBuilder + */ + public DialogBuilder setTitle(String title) { + dialog.setTitle(title); + return this; + } + + /** + * Returns this {@code DialogBuilder} setting the instruction text to a new + * value. + * @param instruction a string value + * @returns this DialogBuilder + */ + public DialogBuilder setInstruction(String instruction) { + instructionsText.setText("Test instructions:\n" + instruction); + return this; + } + + /** + * Returns this {@code DialogBuilder} setting the message text to a new value. + * @param message a string value + * @returns this DialogBuilder + */ + public DialogBuilder setMessage(String message) { + messageText.setText(message); + return this; + } + + /** + * Returns this {@code DialogBuilder} setting pass button action to + * {@link java.awt.event.ActionListener}. + * @param action an action to perform on button click + * @returns this DialogBuilder + */ + public DialogBuilder setPassAction(ActionListener action) { + pass.addActionListener(action); + return this; + } + + /** + * Returns this {@code DialogBuilder} setting fail button action to + * {@link java.awt.event.ActionListener}. + * @param action an action to perform on button click + * @returns this DialogBuilder + */ + public DialogBuilder setFailAction(ActionListener action) { + fail.addActionListener(action); + return this; + } + + /** + * Returns this {@code DialogBuilder} setting window-closing action to + * {@link java.lang.Runnable}. + * @param action a runnerable action to perform on window close + * @returns this DialogBuilder + */ + public DialogBuilder setCloseAction(Runnable action) { + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + super.windowClosing(e); + action.run(); + } + }); + return this; + } + + /** + * Returns a {@link javax.swing.JDialog} window. + * @returns a JDialog + */ + public JDialog build() { + dialog.pack(); + return dialog; + } + } +} From c4d6967922c56c87cb7559f55183b4db73112f29 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:48:10 +0000 Subject: [PATCH 101/329] 8299779: Test tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java timed out Backport-of: 0a4d54f7ce2ac906a8012ed92c84ed8303cb4b90 --- .../jpackage/share/jdk/jpackage/tests/MainClassTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java index d7c581b6e99..2a14a4ea115 100644 --- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java +++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -55,7 +55,7 @@ * @build jdk.jpackage.test.* * @modules jdk.jpackage/jdk.jpackage.internal * @compile MainClassTest.java - * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main + * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=jdk.jpackage.tests.MainClassTest */ From 858416c50dece7150f34e6615ad16cc235b15595 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:48:36 +0000 Subject: [PATCH 102/329] 8277042: add test for 8276036 to compiler/codecache Backport-of: 17e68caad727b04f5e7efde59fce960c66558504 --- .../codecache/CodeCacheFullCountTest.java | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java diff --git a/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java b/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java new file mode 100644 index 00000000000..1fee39144ff --- /dev/null +++ b/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java @@ -0,0 +1,129 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.net.URL; +import java.net.URLClassLoader; +import java.lang.reflect.Field; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +/* + * @test + * @bug 8276036 8277213 8277441 + * @summary test for the value of full_count in the message of insufficient codecache + * @library /test/lib + */ +public class CodeCacheFullCountTest { + public static void main(String args[]) throws Throwable { + if (args.length == 1) { + wasteCodeCache(); + } else { + runTest(); + } + } + + public static void wasteCodeCache() throws Exception { + URL url = CodeCacheFullCountTest.class.getProtectionDomain().getCodeSource().getLocation(); + + for (int i = 0; i < 500; i++) { + ClassLoader cl = new MyClassLoader(url); + refClass(cl.loadClass("SomeClass")); + } + } + + public static void runTest() throws Throwable { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "CodeCacheFullCountTest", "WasteCodeCache"); + OutputAnalyzer oa = ProcessTools.executeProcess(pb); + oa.shouldHaveExitValue(0); + String stdout = oa.getStdout(); + + Pattern pattern = Pattern.compile("full_count=(\\d)"); + Matcher stdoutMatcher = pattern.matcher(stdout); + if (stdoutMatcher.find()) { + int fullCount = Integer.parseInt(stdoutMatcher.group(1)); + if (fullCount != 1) { + throw new RuntimeException("the value of full_count is wrong."); + } + } else { + throw new RuntimeException("codecache shortage did not occur."); + } + } + + private static void refClass(Class clazz) throws Exception { + Field name = clazz.getDeclaredField("NAME"); + name.setAccessible(true); + name.get(null); + } + + private static class MyClassLoader extends URLClassLoader { + public MyClassLoader(URL url) { + super(new URL[]{url}, null); + } + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + try { + return super.loadClass(name, resolve); + } catch (ClassNotFoundException e) { + return Class.forName(name, resolve, CodeCacheFullCountTest.class.getClassLoader()); + } + } + } +} + +abstract class Foo { + public abstract int foo(); +} + +class Foo1 extends Foo { + private int a; + public int foo() { return a; } +} + +class Foo2 extends Foo { + private int a; + public int foo() { return a; } +} + +class Foo3 extends Foo { + private int a; + public int foo() { return a; } +} + +class Foo4 extends Foo { + private int a; + public int foo() { return a; } +} + +class SomeClass { + static final String NAME = "name"; + + static { + int res =0; + Foo[] foos = new Foo[] { new Foo1(), new Foo2(), new Foo3(), new Foo4() }; + for (int i = 0; i < 100000; i++) { + res = foos[i % foos.length].foo(); + } + } +} From 5a40a4476dabc0969717789f751062637ce3414b Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:48:58 +0000 Subject: [PATCH 103/329] 8305079: Remove finalize() from compiler/c2/Test719030 Backport-of: 84df74ca3948c50d8e6f24694310860ed3888aba --- test/hotspot/jtreg/compiler/c2/Test7190310.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/Test7190310.java b/test/hotspot/jtreg/compiler/c2/Test7190310.java index b175f47e09a..ca3cd9bce19 100644 --- a/test/hotspot/jtreg/compiler/c2/Test7190310.java +++ b/test/hotspot/jtreg/compiler/c2/Test7190310.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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,17 +39,13 @@ import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.lang.ref.Cleaner; public class Test7190310 { private static Object str = new Object() { public String toString() { return "The Object"; } - - protected void finalize() throws Throwable { - System.out.println("The Object is being finalized"); - super.finalize(); - } }; private final static ReferenceQueue rq = new ReferenceQueue(); @@ -58,6 +54,7 @@ protected void finalize() throws Throwable { public static void main(String[] args) throws InterruptedException { + Cleaner.create().register(str, () -> System.out.println("The Object is being finalized")); Thread reader = new Thread() { public void run() { while (wr.get() != null) { From 01cb6483a819bbe20f1b86b45dc0a27993515786 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:49:12 +0000 Subject: [PATCH 104/329] 8305081: Remove finalize() from test/hotspot/jtreg/compiler/runtime/Test8168712 Backport-of: 39dc40fed4e1af3e77355fa9f4abb0c72279a140 --- .../jtreg/compiler/runtime/Test8168712.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/runtime/Test8168712.java b/test/hotspot/jtreg/compiler/runtime/Test8168712.java index e411dc21479..924b3e5b797 100644 --- a/test/hotspot/jtreg/compiler/runtime/Test8168712.java +++ b/test/hotspot/jtreg/compiler/runtime/Test8168712.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -48,20 +48,31 @@ */ package compiler.runtime; +import java.lang.ref.Cleaner; import java.util.*; public class Test8168712 { static HashSet m = new HashSet<>(); + + // One cleaner thread for cleaning all the instances. Otherwise, we get OOME. + static Cleaner cleaner = Cleaner.create(); + + public Test8168712() { + cleaner.register(this, () -> cleanup()); + } + public static void main(String args[]) { int i = 0; while (i++<15000) { test(); } } + static Test8168712 test() { return new Test8168712(); } - protected void finalize() { + + public void cleanup() { m.add(this); } } From 9a45e2db9d4294d99fe7b7db2f9a03131c841d28 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:49:35 +0000 Subject: [PATCH 105/329] 8272777: Clean up remaining AccessController warnings in test library Backport-of: 63a00a0df24b154ef459936dbd69bcd2f0626235 --- test/lib/jdk/test/lib/SA/SATestUtils.java | 1 + test/lib/jdk/test/lib/net/IPSupport.java | 1 + test/lib/jdk/test/lib/net/SimpleSSLContext.java | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/lib/jdk/test/lib/SA/SATestUtils.java b/test/lib/jdk/test/lib/SA/SATestUtils.java index d4daf5ef145..2f98cf99357 100644 --- a/test/lib/jdk/test/lib/SA/SATestUtils.java +++ b/test/lib/jdk/test/lib/SA/SATestUtils.java @@ -159,6 +159,7 @@ public static void addPrivilegesIfNeeded(ProcessBuilder pb) { * if we are root, so return true. Then return false for an expected denial * if "ptrace_scope" is 1, and true otherwise. */ + @SuppressWarnings("removal") private static boolean canPtraceAttachLinux() throws IOException { // SELinux deny_ptrace: var deny_ptrace = Paths.get("/sys/fs/selinux/booleans/deny_ptrace"); diff --git a/test/lib/jdk/test/lib/net/IPSupport.java b/test/lib/jdk/test/lib/net/IPSupport.java index c9873fa644a..d2e0becc0dd 100644 --- a/test/lib/jdk/test/lib/net/IPSupport.java +++ b/test/lib/jdk/test/lib/net/IPSupport.java @@ -87,6 +87,7 @@ private static boolean hasAddress(InetAddress address) { } } + @SuppressWarnings("removal") private static T runPrivilegedAction(Callable callable) { try { PrivilegedExceptionAction pa = () -> callable.call(); diff --git a/test/lib/jdk/test/lib/net/SimpleSSLContext.java b/test/lib/jdk/test/lib/net/SimpleSSLContext.java index 5660ed048aa..e8611fb007f 100644 --- a/test/lib/jdk/test/lib/net/SimpleSSLContext.java +++ b/test/lib/jdk/test/lib/net/SimpleSSLContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, 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 @@ -54,6 +54,7 @@ public SimpleSSLContext() throws IOException { this(() -> "TLS"); } + @SuppressWarnings("removal") private SimpleSSLContext(Supplier protocols) throws IOException { try { final String proto = protocols.get(); From aa47dc7ef79202c38b13fc8c55a9678878dd9cf1 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Sun, 23 Jun 2024 23:50:05 +0000 Subject: [PATCH 106/329] 8310070: Test: javax/net/ssl/DTLS/DTLSWontNegotiateV10.java timed out Backport-of: af7f95e24ad5981c5de4b5dbf37da6f4f5e42129 --- .../net/ssl/DTLS/DTLSWontNegotiateV10.java | 58 ++++++++++++++----- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/test/jdk/javax/net/ssl/DTLS/DTLSWontNegotiateV10.java b/test/jdk/javax/net/ssl/DTLS/DTLSWontNegotiateV10.java index 2532f524371..f67a02b3052 100644 --- a/test/jdk/javax/net/ssl/DTLS/DTLSWontNegotiateV10.java +++ b/test/jdk/javax/net/ssl/DTLS/DTLSWontNegotiateV10.java @@ -48,6 +48,8 @@ public class DTLSWontNegotiateV10 { private static final String DTLS = "DTLS"; private static final String DTLSV_1_2 = "DTLSv1.2"; + private static final int READ_TIMEOUT_SECS = Integer.getInteger("readtimeout", 30); + public static void main(String[] args) throws Exception { if (args[0].equals(DTLSV_1_0)) { SecurityUtils.removeFromDisabledTlsAlgs(DTLSV_1_0); @@ -63,20 +65,43 @@ public static void main(String[] args) throws Exception { } else { // server process // args: protocol - try (DTLSServer server = new DTLSServer(args[0])) { - List command = List.of( - Path.of(System.getProperty("java.home"), "bin", "java").toString(), - "DTLSWontNegotiateV10", - // if server is "DTLS" then the client should be v1.0 and vice versa - args[0].equals(DTLS) ? DTLSV_1_0 : DTLS, - Integer.toString(server.getListeningPortNumber()) - ); - - ProcessBuilder builder = new ProcessBuilder(command); - Process p = builder.inheritIO().start(); - server.run(); - p.destroy(); - System.out.println("Success: DTLSv1.0 connection was not established."); + final int totalAttempts = 5; + int tries; + for (tries = 0 ; tries < totalAttempts ; ++tries) { + try { + System.out.printf("Starting server %d/%d attempts%n", tries+1, totalAttempts); + runServer(args[0]); + break; + } catch (SocketTimeoutException exc) { + System.out.println("The server timed-out waiting for packets from the client."); + } + } + if (tries == totalAttempts) { + throw new RuntimeException("The server/client communications timed-out after " + totalAttempts + " tries."); + } + } + } + + private static void runServer(String protocol) throws Exception { + // args: protocol + Process clientProcess = null; + try (DTLSServer server = new DTLSServer(protocol)) { + List command = List.of( + Path.of(System.getProperty("java.home"), "bin", "java").toString(), + "DTLSWontNegotiateV10", + // if server is "DTLS" then the client should be v1.0 and vice versa + protocol.equals(DTLS) ? DTLSV_1_0 : DTLS, + Integer.toString(server.getListeningPortNumber()) + ); + + ProcessBuilder builder = new ProcessBuilder(command); + clientProcess = builder.inheritIO().start(); + server.run(); + System.out.println("Success: DTLSv1.0 connection was not established."); + + } finally { + if (clientProcess != null) { + clientProcess.destroy(); } } } @@ -89,6 +114,9 @@ private static class DTLSClient extends DTLSEndpoint { public DTLSClient(String protocol, int portNumber) throws Exception { super(true, protocol); remotePort = portNumber; + socket.setSoTimeout(READ_TIMEOUT_SECS * 1000); + log("Client listening on port " + socket.getLocalPort() + + ". Sending data to server port " + remotePort); log("Enabled protocols: " + String.join(" ", engine.getEnabledProtocols())); } @@ -287,6 +315,8 @@ private static class DTLSServer extends DTLSEndpoint implements AutoCloseable { public DTLSServer(String protocol) throws Exception { super(false, protocol); + socket.setSoTimeout(READ_TIMEOUT_SECS * 1000); + log("Server listening on port: " + socket.getLocalPort()); log("Enabled protocols: " + String.join(" ", engine.getEnabledProtocols())); } From f9cc9e9b00c4178a75a8401433b4e2b6103d6675 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 24 Jun 2024 08:52:40 +0000 Subject: [PATCH 107/329] 8334332: TestIOException.java fails if run by root Backport-of: 472b935b442f7f925b665c7de91eda77f3dcbe8b --- .../testIOException/TestIOException.java | 60 ++++++------------- 1 file changed, 19 insertions(+), 41 deletions(-) diff --git a/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java b/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java index 9127cdf86bb..5dd81b62d33 100644 --- a/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java +++ b/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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,9 +23,9 @@ /* * @test - * @bug 8164130 + * @bug 8164130 8334332 * @summary test IOException handling - * @library ../../lib + * @library ../../lib /test/lib * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build javadoc.tester.* * @run main TestIOException @@ -39,6 +39,7 @@ import java.util.Map; import javadoc.tester.JavadocTester; +import jtreg.SkippedException; /** * Tests IO Exception handling. @@ -61,16 +62,13 @@ public static void main(String... args) throws Exception { public void testReadOnlyDirectory() { File outDir = new File("out1"); if (!outDir.mkdir()) { - throw error(outDir, "Cannot create directory"); + throw skip(outDir, "Cannot create directory"); } if (!outDir.setReadOnly()) { - if (skip(outDir)) { - return; - } - throw error(outDir, "could not set directory read-only"); + throw skip(outDir, "could not set directory read-only"); } if (outDir.canWrite()) { - throw error(outDir, "directory is writable"); + throw skip(outDir, "directory is writable"); } try { @@ -93,15 +91,15 @@ public void testReadOnlyDirectory() { public void testReadOnlyFile() throws Exception { File outDir = new File("out2"); if (!outDir.mkdir()) { - throw error(outDir, "Cannot create directory"); + throw skip(outDir, "Cannot create directory"); } File index = new File(outDir, "index.html"); try (FileWriter fw = new FileWriter(index)) { } if (!index.setReadOnly()) { - throw error(index, "could not set index read-only"); + throw skip(index, "could not set index read-only"); } if (index.canWrite()) { - throw error(index, "index is writable"); + throw skip(index, "index is writable"); } try { @@ -139,16 +137,13 @@ public void testReadOnlySubdirectory() throws Exception { File outDir = new File("out3"); File pkgOutDir = new File(outDir, "p"); if (!pkgOutDir.mkdirs()) { - throw error(pkgOutDir, "Cannot create directory"); + throw skip(pkgOutDir, "Cannot create directory"); } if (!pkgOutDir.setReadOnly()) { - if (skip(pkgOutDir)) { - return; - } - throw error(pkgOutDir, "could not set directory read-only"); + throw skip(pkgOutDir, "could not set directory read-only"); } if (pkgOutDir.canWrite()) { - throw error(pkgOutDir, "directory is writable"); + throw skip(pkgOutDir, "directory is writable"); } // run javadoc and check results @@ -192,16 +187,13 @@ public void testReadOnlyDocFilesDir() throws Exception { File pkgOutDir = new File(outDir, "p"); File docFilesOutDir = new File(pkgOutDir, "doc-files"); if (!docFilesOutDir.mkdirs()) { - throw error(docFilesOutDir, "Cannot create directory"); + throw skip(docFilesOutDir, "Cannot create directory"); } if (!docFilesOutDir.setReadOnly()) { - if (skip(docFilesOutDir)) { - return; - } - throw error(docFilesOutDir, "could not set directory read-only"); + throw skip(docFilesOutDir, "could not set directory read-only"); } if (docFilesOutDir.canWrite()) { - throw error(docFilesOutDir, "directory is writable"); + throw skip(docFilesOutDir, "directory is writable"); } try { @@ -219,10 +211,11 @@ public void testReadOnlyDocFilesDir() throws Exception { } } - private Error error(File f, String message) { + private Error skip(File f, String message) { + out.print(System.getProperty("user.name")); out.println(f + ": " + message); showAllAttributes(f.toPath()); - throw new Error(f + ": " + message); + throw new SkippedException(f + ": " + message); } private void showAllAttributes(Path p) { @@ -242,20 +235,5 @@ private void showAttributes(Path p, String attributes) { out.println("Error accessing attributes " + attributes + ": " + t); } } - - private boolean skip(File dir) { - if (isWindows()) { - showAllAttributes(dir.toPath()); - out.println("Windows: cannot set directory read only:" + dir); - out.println("TEST CASE SKIPPED"); - return true; - } else { - return false; - } - } - - private boolean isWindows() { - return System.getProperty("os.name").toLowerCase(Locale.US).startsWith("windows"); - } } From 0392d4e45f140c4cb533953023877f8da72b2639 Mon Sep 17 00:00:00 2001 From: Elif Aslan Date: Mon, 24 Jun 2024 08:53:00 +0000 Subject: [PATCH 108/329] 8318605: Enable parallelism in vmTestbase/nsk/stress/stack tests Backport-of: d9aa1deac8474f87dd867809f7265b9496917c6f --- .../nsk/stress/stack/TEST.properties | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/TEST.properties diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/TEST.properties deleted file mode 100644 index 8b51b2a9115..00000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -exclusiveAccess.dirs=. From 02ec672c78eff7eb20b6408989ded3b0ac0254a2 Mon Sep 17 00:00:00 2001 From: Elif Aslan Date: Mon, 24 Jun 2024 08:53:21 +0000 Subject: [PATCH 109/329] 8315774: Enable parallelism in vmTestbase/gc/g1/unloading tests Backport-of: 825e0ed2a1fde617ad2a7b74d951df3c1417d463 --- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- .../TEST.properties | 23 ------------------- 112 files changed, 2576 deletions(-) delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. From 953a03de9618ca9658aabb7e36d51301b78b9de7 Mon Sep 17 00:00:00 2001 From: Xiaolong Peng Date: Mon, 24 Jun 2024 08:54:57 +0000 Subject: [PATCH 110/329] 8321025: Enable Neoverse N1 optimizations for Neoverse V2 Reviewed-by: shade Backport-of: c9d15f7d5ee616bf48d85647ee504714ac5fafc2 --- src/hotspot/cpu/aarch64/vm_version_aarch64.cpp | 7 +++---- src/hotspot/cpu/aarch64/vm_version_aarch64.hpp | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 039e9c17b46..1b115263f9e 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -212,10 +212,9 @@ void VM_Version::initialize() { } } - // Neoverse N1, N2 and V1 - if (_cpu == CPU_ARM && ((_model == 0xd0c || _model2 == 0xd0c) - || (_model == 0xd49 || _model2 == 0xd49) - || (_model == 0xd40 || _model2 == 0xd40))) { + // Neoverse N1, N2, V1, V2 + if (_cpu == CPU_ARM && (model_is(0xd0c) || model_is(0xd49) || + model_is(0xd40) || model_is(0xd4f))) { if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) { FLAG_SET_DEFAULT(UseSIMDForMemoryOps, true); } diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp index 3f186f56e75..46c77e48b8f 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp @@ -142,6 +142,10 @@ class VM_Version : public Abstract_VM_Version { static int cpu_variant() { return _variant; } static int cpu_revision() { return _revision; } + static bool model_is(int cpu_model) { + return _model == cpu_model || _model2 == cpu_model; + } + static bool is_zva_enabled() { return 0 <= _zva_length; } static int zva_length() { assert(is_zva_enabled(), "ZVA not available"); From 789cb95ea8cb9dfd196d23f460a457ed64616fcd Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Mon, 24 Jun 2024 09:36:23 +0000 Subject: [PATCH 111/329] 8316306: Open source and convert manual Swing test Backport-of: d3e821838668a0ccc0ccd098336230975e27fd7c --- test/jdk/javax/swing/JToolBar/bug4203039.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 test/jdk/javax/swing/JToolBar/bug4203039.java diff --git a/test/jdk/javax/swing/JToolBar/bug4203039.java b/test/jdk/javax/swing/JToolBar/bug4203039.java new file mode 100644 index 00000000000..af8b1f122c0 --- /dev/null +++ b/test/jdk/javax/swing/JToolBar/bug4203039.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2003, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; + +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JToolBar; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4203039 + * @summary JToolBar needs a way to limit docking to a particular orientation + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4203039 + */ + +public class bug4203039 { + private static final String instructionsText = """ + This test is used to verify that application-installed + components prevent the toolbar from docking in + those locations. + + This test has installed components on the SOUTH + and EAST, so verify the toolbar cannot dock in those + locations but can dock on the NORTH and WEST"""; + + public static void main(String[] args) throws Exception { + PassFailJFrame passFailJFrame = new PassFailJFrame.Builder() + .title("bug4203039 Instructions") + .instructions(instructionsText) + .testTimeOut(5) + .rows(10) + .columns(35) + .build(); + + SwingUtilities.invokeAndWait(() -> { + JFrame frame = new JFrame("bug4203039"); + frame.setSize(300, 200); + + JToolBar toolbar = new JToolBar(); + JLabel label = new JLabel("This is the toolbar"); + toolbar.add(label); + + frame.add(toolbar, BorderLayout.NORTH); + + frame.add(new JComponent(){}, BorderLayout.SOUTH); + frame.add(new JComponent(){}, BorderLayout.EAST); + + PassFailJFrame.addTestWindow(frame); + PassFailJFrame.positionTestWindow(frame, + PassFailJFrame.Position.HORIZONTAL); + + frame.setVisible(true); + }); + + passFailJFrame.awaitAndCheck(); + } +} From 4397fe86a7e59bb36b63a981f60e7d94b199fe10 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Mon, 24 Jun 2024 09:37:10 +0000 Subject: [PATCH 112/329] 8299487: Test java/net/httpclient/whitebox/SSLTubeTestDriver.java timed out Backport-of: 81083a0e10d9c92f5247ae256e170709014b596b --- .../jdk/internal/net/http/SSLTubeTest.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLTubeTest.java b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLTubeTest.java index ac251f9ba7d..114110344a4 100644 --- a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLTubeTest.java +++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SSLTubeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -85,16 +85,17 @@ private static class SSLLoopbackSubscriber implements FlowTube { ExecutorService exec, CountDownLatch allBytesReceived) throws IOException { SSLServerSocketFactory fac = ctx.getServerSocketFactory(); + InetAddress loopback = InetAddress.getLoopbackAddress(); SSLServerSocket serv = (SSLServerSocket) fac.createServerSocket(); serv.setReuseAddress(false); - serv.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); + serv.bind(new InetSocketAddress(loopback, 0)); SSLParameters params = serv.getSSLParameters(); params.setApplicationProtocols(new String[]{"proto2"}); serv.setSSLParameters(params); int serverPort = serv.getLocalPort(); - clientSock = new Socket("localhost", serverPort); + clientSock = new Socket(loopback, serverPort); serverSock = (SSLSocket) serv.accept(); this.buffer = new LinkedBlockingQueue<>(); this.allBytesReceived = allBytesReceived; @@ -107,6 +108,7 @@ private static class SSLLoopbackSubscriber implements FlowTube { } public void start() { + System.out.println("Starting: server listening at: " + serverSock.getLocalSocketAddress()); thread1.start(); thread2.start(); thread3.start(); @@ -144,6 +146,7 @@ private void clientReader() { publisher.submit(List.of(bb)); } } catch (Throwable e) { + System.out.println("clientReader got exception: " + e); e.printStackTrace(); Utils.close(clientSock); } @@ -176,6 +179,7 @@ private void clientWriter() { clientSubscription.request(1); } } catch (Throwable e) { + System.out.println("clientWriter got exception: " + e); e.printStackTrace(); } } @@ -212,6 +216,7 @@ private void serverLoopback() { is.close(); os.close(); serverSock.close(); + System.out.println("serverLoopback exiting normally"); return; } os.write(bb, 0, n); @@ -219,7 +224,10 @@ private void serverLoopback() { loopCount.addAndGet(n); } } catch (Throwable e) { + System.out.println("serverLoopback got exception: " + e); e.printStackTrace(); + } finally { + System.out.println("serverLoopback exiting at count: " + loopCount.get()); } } From 251b8e1ff0f372dba52f4a14dac62860d637aae2 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 24 Jun 2024 10:26:51 +0000 Subject: [PATCH 113/329] 8334333: MissingResourceCauseTestRun.java fails if run by root Backport-of: de8ee97718d7e12b541b310cf5b67f3e10e91ad9 --- .../Control/MissingResourceCauseTestRun.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/util/ResourceBundle/Control/MissingResourceCauseTestRun.java b/test/jdk/java/util/ResourceBundle/Control/MissingResourceCauseTestRun.java index 0ed86582846..6fd79ebf88a 100644 --- a/test/jdk/java/util/ResourceBundle/Control/MissingResourceCauseTestRun.java +++ b/test/jdk/java/util/ResourceBundle/Control/MissingResourceCauseTestRun.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,7 +23,7 @@ /* * @test - * @bug 4354216 8213127 + * @bug 4354216 8213127 8334333 * @summary Test for the cause support when throwing a * MissingResourceBundle. (This test exists under * ResourceBundle/Control because bad resource bundle data can be @@ -32,6 +32,7 @@ * @build jdk.test.lib.JDKToolLauncher * jdk.test.lib.Utils * jdk.test.lib.process.ProcessTools + * jdk.test.lib.Platform * MissingResourceCauseTest * NonResourceBundle * PrivateConstructorRB @@ -50,9 +51,14 @@ import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.Utils; import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.Platform; +import jtreg.SkippedException; public class MissingResourceCauseTestRun { public static void main(String[] args) throws Throwable { + if (Platform.isRoot() && !Platform.isWindows()) { + throw new SkippedException("Unable to create an unreadable properties file."); + } Path path = Paths.get("UnreadableRB.properties"); Files.deleteIfExists(path); try { @@ -100,7 +106,7 @@ private static void runCmd() throws Throwable { } private static void deleteFile(Path path) throws Throwable { - if(path.toFile().exists()) { + if (path.toFile().exists()) { ProcessTools.executeCommand("chmod", "666", path.toString()) .outputTo(System.out) .errorTo(System.out) From 70b623fe364beebf74bfc3121c58e685a429d48e Mon Sep 17 00:00:00 2001 From: Neethu Prasad Date: Mon, 24 Jun 2024 16:26:54 +0000 Subject: [PATCH 114/329] 8317360: Missing null checks in JfrCheckpointManager and JfrStringPool initialization routines Backport-of: cf4ede0e544fbd758cc9e93c695fb19fb7da0f9a --- .../share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp | 3 +++ src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp index affd8849245..dc59166bb51 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp @@ -103,6 +103,9 @@ bool JfrCheckpointManager::initialize() { // preallocate buffer count to each of the epoch live lists for (size_t i = 0; i < global_buffer_prealloc_count * 2; ++i) { Buffer* const buffer = mspace_allocate(global_buffer_size, _global_mspace); + if (buffer == nullptr) { + return false; + } _global_mspace->add_to_live_list(buffer, i % 2 == 0); } assert(_global_mspace->free_list_is_empty(), "invariant"); diff --git a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp index 132295230ac..367b4714406 100644 --- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp +++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp @@ -85,6 +85,9 @@ bool JfrStringPool::initialize() { // preallocate buffer count to each of the epoch live lists for (size_t i = 0; i < string_pool_cache_count * 2; ++i) { Buffer* const buffer = mspace_allocate(string_pool_buffer_size, _mspace); + if (buffer == nullptr) { + return false; + } _mspace->add_to_live_list(buffer, i % 2 == 0); } assert(_mspace->free_list_is_empty(), "invariant"); From c73a0746b7371cf61f4a902782a160e120b58ef9 Mon Sep 17 00:00:00 2001 From: Neethu Prasad Date: Mon, 24 Jun 2024 16:27:15 +0000 Subject: [PATCH 115/329] 8321220: JFR: RecordedClass reports incorrect modifiers Backport-of: d5f59cf0a8efe8d0f2d8ab1a5bd68fa9fe15fb1a --- .../recorder/checkpoint/types/jfrTypeSet.cpp | 2 +- .../jfr/api/consumer/TestRecordedClass.java | 115 ++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index c3c47d3dd72..dc2add22020 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -228,7 +228,7 @@ static int write_klass(JfrCheckpointWriter* writer, KlassPtr klass, bool leakp) writer->write(cld != NULL ? cld_id(cld, leakp) : 0); writer->write(mark_symbol(klass, leakp)); writer->write(package_id(klass, leakp)); - writer->write(get_flags(klass)); + writer->write(klass->modifier_flags()); writer->write(klass->is_hidden()); return 1; } diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java new file mode 100644 index 00000000000..19c63704919 --- /dev/null +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.jfr.api.consumer; + +import java.lang.reflect.Modifier; +import java.util.List; + +import jdk.jfr.Event; +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedClass; +import jdk.jfr.consumer.RecordedEvent; +import jdk.test.lib.jfr.Events; + +/** + * @test + * @summary Verifies methods of RecordedClass + * @key jfr + * @requires vm.hasJFR + * @library /test/lib + * @run main/othervm jdk.jfr.api.consumer.TestRecordedClass + */ +public class TestRecordedClass { + + static class TestEvent extends Event { + Class typeA; + Class typeB; + } + + private static class TypeA { + } + + public final static class TypeB { + } + + public static void main(String[] args) throws Exception { + try (Recording recording = new Recording()) { + recording.start(); + TestEvent event = new TestEvent(); + event.typeA = TypeA.class; + event.typeB = TypeB.class; + event.commit(); + recording.stop(); + + List events = Events.fromRecording(recording); + Events.hasEvents(events); + for (RecordedEvent recordedEvent : events) { + RecordedClass typeA = recordedEvent.getClass("typeA"); + RecordedClass typeB = recordedEvent.getClass("typeB"); + assertModifiers(typeA, TypeA.class); + assertModifiers(typeB, TypeB.class); + assertName(typeA, TypeA.class); + assertName(typeB, TypeB.class); + assertClassLoader(typeA, TypeA.class.getClassLoader()); + assertClassLoader(typeB, TypeB.class.getClassLoader()); + assertId(typeA); + assertId(typeB); + if (typeA.getId() == typeB.getId()) { + throw new Exception("Same ID for different classes"); + } + } + } + } + + private static void assertId(RecordedClass recordedClass) throws Exception { + long id = recordedClass.getId(); + if (id < 1 || id >= 1024 * 1024) { + throw new Exception("Expected class ID to be above 1 and below 1 M"); + } + } + + private static void assertClassLoader(RecordedClass recordedClass, ClassLoader classLoader) throws Exception { + String expected = classLoader.getClass().getName(); + String actual = recordedClass.getClassLoader().getType().getName(); + if (!expected.equals(actual)) { + throw new Exception("Expected class loader to be " + expected + ", was " + actual); + } + } + + private static void assertName(RecordedClass recordedClass, Class clazz) throws Exception { + String className = clazz.getClass().getName(); + if (className.equals(recordedClass.getName())) { + throw new Exception("Expected class to be named " + className); + } + } + + private static void assertModifiers(RecordedClass recordedClass, Class clazz) throws Exception { + int modifiers = clazz.getModifiers(); + if (modifiers != recordedClass.getModifiers()) { + String expected = Modifier.toString(modifiers); + String actual = Modifier.toString(recordedClass.getModifiers()); + throw new Exception("Expected modifier to be '" + expected + "', was '" + actual + "'"); + } + } +} From 879e8031949d6cd6ce82027296dd2d4325faa2bb Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 24 Jun 2024 18:04:57 +0000 Subject: [PATCH 116/329] 8279878: java/awt/font/JNICheck/JNICheck.sh test fails on Ubuntu 21.10 Backport-of: 2f48a3f032dcfe159a7ab4a3d0afd0a0760d0a04 --- test/jdk/java/awt/font/JNICheck/JNICheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/java/awt/font/JNICheck/JNICheck.sh b/test/jdk/java/awt/font/JNICheck/JNICheck.sh index 4244b510b23..cc019e72d56 100644 --- a/test/jdk/java/awt/font/JNICheck/JNICheck.sh +++ b/test/jdk/java/awt/font/JNICheck/JNICheck.sh @@ -49,7 +49,7 @@ else fi $JAVA_HOME/bin/java ${TESTVMOPTS} \ - -cp "${CP}" -Xcheck:jni JNICheck | grep -v SIG | grep -v Signal | grep -v CallStatic > "${CP}"/log.txt + -cp "${CP}" -Xcheck:jni JNICheck | grep -v SIG | grep -v Signal | grep -v Handler | grep -v jsig | grep -v CallStatic > "${CP}"/log.txt # any messages logged may indicate a failure. if [ -s "${CP}"/log.txt ]; then From e2de2b9cda970d632c14246344157913f10058e6 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 25 Jun 2024 07:24:47 +0000 Subject: [PATCH 117/329] 8329663: hs_err file event log entry for thread adding/removing should print current thread Reviewed-by: mdoerr Backport-of: 3ebf8c9359da2f45e4cefb7be2276d33c30979aa --- src/hotspot/share/runtime/thread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index ece43e350a4..03498ab7765 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -3577,7 +3577,7 @@ void Threads::add(JavaThread* p, bool force_daemon) { ObjectSynchronizer::inc_in_use_list_ceiling(); // Possible GC point. - Events::log(p, "Thread added: " INTPTR_FORMAT, p2i(p)); + Events::log(Thread::current(), "Thread added: " INTPTR_FORMAT, p2i(p)); // Make new thread known to active EscapeBarrier EscapeBarrier::thread_added(p); @@ -3625,7 +3625,7 @@ void Threads::remove(JavaThread* p, bool is_daemon) { ObjectSynchronizer::dec_in_use_list_ceiling(); // Since Events::log uses a lock, we grab it outside the Threads_lock - Events::log(p, "Thread exited: " INTPTR_FORMAT, p2i(p)); + Events::log(Thread::current(), "Thread exited: " INTPTR_FORMAT, p2i(p)); } // Operations on the Threads list for GC. These are not explicitly locked, From ba3db307dceb41e48014451873fdf4db3816a537 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Tue, 25 Jun 2024 07:46:57 +0000 Subject: [PATCH 118/329] 8319197: Exclude hb-subset and hb-style from compilation Backport-of: e1cae7203674bc288a63e6fb26f94b20e70c74fd --- make/modules/java.desktop/lib/Awt2dLibraries.gmk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index 46e3b1677f7..0d2bdda923c 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -456,7 +456,10 @@ else endif # hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later. - LIBFONTMANAGER_EXCLUDE_FILES += libharfbuzz/hb-ft.cc + # hb-subset and hb-style APIs are not needed, excluded to cut on compilation time. + LIBFONTMANAGER_EXCLUDE_FILES += hb-ft.cc hb-subset-cff-common.cc \ + hb-subset-cff1.cc hb-subset-cff2.cc hb-subset-input.cc hb-subset-plan.cc \ + hb-subset.cc hb-subset-instancer-solver.cc gsubgpos-context.cc hb-style.cc # list of disabled warnings and the compilers for which it was specifically added. # array-bounds -> GCC 12 on Alpine Linux From 8f5a9f723306a81624e478cf93b1502ae7b238dd Mon Sep 17 00:00:00 2001 From: Soumadipta Roy Date: Tue, 25 Jun 2024 07:50:27 +0000 Subject: [PATCH 119/329] 8324755: Enable parallelism in vmTestbase/gc/gctests/LargeObjects tests Backport-of: 003e86fe38ca1b809418f6282336e259862d0776 --- .../LargeObjects/large001/TEST.properties | 23 ------------------- .../LargeObjects/large002/TEST.properties | 23 ------------------- .../LargeObjects/large003/TEST.properties | 23 ------------------- .../LargeObjects/large004/TEST.properties | 23 ------------------- .../LargeObjects/large005/TEST.properties | 23 ------------------- 5 files changed, 115 deletions(-) delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large001/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large002/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large003/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large004/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large005/TEST.properties diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large001/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large001/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large001/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large002/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large002/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large002/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large003/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large003/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large003/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large004/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large004/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large004/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large005/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large005/TEST.properties deleted file mode 100644 index 04b22a107ac..00000000000 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large005/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -exclusiveAccess.dirs=. From c858b68fc1d019a8e3a03d2d25835f116372e703 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 25 Jun 2024 08:15:00 +0000 Subject: [PATCH 120/329] 8314476: TestJstatdPortAndServer.java failed with "java.rmi.NoSuchObjectException: no such object in table" Backport-of: 1d0250709a6ee97f5647edff589761bd9d0b7f4c --- test/jdk/sun/tools/jstatd/JstatdTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/jdk/sun/tools/jstatd/JstatdTest.java b/test/jdk/sun/tools/jstatd/JstatdTest.java index d7bd384f828..3b7b8739412 100644 --- a/test/jdk/sun/tools/jstatd/JstatdTest.java +++ b/test/jdk/sun/tools/jstatd/JstatdTest.java @@ -65,6 +65,8 @@ public final class JstatdTest { private static final int JSTAT_GCUTIL_INTERVAL_MS = 250; private static final String JPS_OUTPUT_REGEX = "^\\d+\\s*.*"; + private static final int MAX_JSTATD_TRIES = 10; + private boolean useDefaultPort = true; private boolean useDefaultRmiPort = true; private String port; @@ -288,7 +290,7 @@ private void addToolArg(JDKToolLauncher launcher, String name, String value) { private ProcessThread tryToSetupJstatdProcess() throws Throwable { portInUse = false; ProcessThread jstatdThread = new ProcessThread("Jstatd-Thread", - JstatdTest::isJstadReady, getJstatdCmd()); + JstatdTest::isJstatdReady, getJstatdCmd()); try { jstatdThread.start(); // Make sure jstatd is up and running @@ -308,8 +310,8 @@ private ProcessThread tryToSetupJstatdProcess() throws Throwable { return jstatdThread; } - private static boolean isJstadReady(String line) { - if (line.contains("Port already in use")) { + private static boolean isJstatdReady(String line) { + if (line.contains("Port already in use") || line.contains("Could not bind")) { portInUse = true; return true; } @@ -328,8 +330,9 @@ private void runTest(boolean useShortSyntax) throws Throwable { } ProcessThread jstatdThread = null; + int tries = 0; try { - while (jstatdThread == null) { + while (jstatdThread == null && ++tries <= MAX_JSTATD_TRIES) { if (!useDefaultPort) { port = String.valueOf(Utils.getFreePort()); } @@ -345,10 +348,11 @@ private void runTest(boolean useShortSyntax) throws Throwable { continue; } } - jstatdThread = tryToSetupJstatdProcess(); } - + if (jstatdThread == null) { + throw new RuntimeException("Cannot start jstatd."); + } runToolsAndVerify(); } finally { cleanUpThread(jstatdThread); From 1fe0bb481b017b55f43f66b9a72e30dfe7413a99 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Tue, 25 Jun 2024 15:58:45 +0000 Subject: [PATCH 121/329] 8325384: sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java failing intermittently when main thread is a virtual thread Backport-of: da9c23ace9bdf398d811a88ed137217dd3167231 --- .../ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java index 00ea4fc4ef1..b9426bcfa95 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -26,7 +26,6 @@ * @library /test/lib * @summary Test that a New Session Ticket will be generated when a * SSLSessionBindingListener is set (boundValues) - * @key intermittent * @run main/othervm ResumptionUpdateBoundValues */ @@ -256,7 +255,7 @@ public static void main(String[] args) throws Exception { Thread t; while ((t = threads.take()) != Thread.currentThread()) { System.out.printf(" joining: %s%n", t); - t.join(1000L); + t.join(4000L); } serverReady = false; System.gc(); From c281c1cd428eef976ce0c1d2153b3ca9551dee2f Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Tue, 25 Jun 2024 15:59:18 +0000 Subject: [PATCH 122/329] 8328110: Allow simultaneous use of PassFailJFrame with split UI and additional windows Backport-of: 11a3673d42edbefef70228b4d14595aab11fdac4 --- test/jdk/java/awt/regtesthelpers/PassFailJFrame.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index b7a0f58a2f8..6290d14b428 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -1331,14 +1331,6 @@ private void validate() { position = Position.HORIZONTAL; } - if (panelCreator != null) { - if (splitUI && (testWindows != null || windowListCreator != null)) { - // TODO Is it required? We can support both - throw new IllegalStateException("Split UI is not allowed " - + "with additional windows"); - } - } - if (positionWindows != null) { if (testWindows == null && windowListCreator == null) { throw new IllegalStateException("To position windows, " From b09c9eb6870cd0d2f0a5a84a01018c7f0f845c55 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Tue, 25 Jun 2024 15:59:43 +0000 Subject: [PATCH 123/329] 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Backport-of: d230b30353f59135287436b09949b80e9fd73a93 --- .../java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java b/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java index 114816d4787..e8abec354ed 100644 --- a/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java +++ b/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -101,15 +101,12 @@ public void isMultiReleaseJar() throws Exception { testCustomMultiReleaseValue("true", true); testCustomMultiReleaseValue("true\r\nOther: value", true); testCustomMultiReleaseValue("true\nOther: value", true); - // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately - // testCustomMultiReleaseValue("true\rOther: value", true); + testCustomMultiReleaseValue("true\rOther: value", true); testCustomMultiReleaseValue("false", false); testCustomMultiReleaseValue(" true", false); testCustomMultiReleaseValue("true ", false); testCustomMultiReleaseValue("true\n true", false); - - // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately testCustomMultiReleaseValue("true\r true", false); testCustomMultiReleaseValue("true\r\n true", false); From 35cac7f91d916f0ae6fb50a2905e559a369aebe9 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Tue, 25 Jun 2024 16:00:37 +0000 Subject: [PATCH 124/329] 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded Backport-of: c8cc7b67dbb4633e365a5d6e44419775ebce9d4a --- .../defineHiddenClass/UnloadingTest.java | 4 +- test/lib/jdk/test/lib/util/ForceGC.java | 39 ++++++++++++++++--- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java index 2e5c4837282..b016b2f6899 100644 --- a/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java +++ b/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -222,7 +222,7 @@ void unload() { } boolean tryUnload() { - return ForceGC.wait(() -> weakRef.refersTo(null)); + return ForceGC.waitFor(() -> weakRef.refersTo(null), 2000L); } } diff --git a/test/lib/jdk/test/lib/util/ForceGC.java b/test/lib/jdk/test/lib/util/ForceGC.java index 3c9ebc4d35e..19bbef1f7e4 100644 --- a/test/lib/jdk/test/lib/util/ForceGC.java +++ b/test/lib/jdk/test/lib/util/ForceGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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,14 +38,43 @@ public class ForceGC { /** * Causes the current thread to wait until the {@code booleanSupplier} - * returns true, or a specific waiting time elapses. The waiting time - * is 1 second scaled with the jtreg testing timeout factor. + * returns true, or the waiting time elapses. The waiting time + * is 1 second scaled with the jtreg testing timeout factor. This method + * is equivalent to calling {@link #waitFor(BooleanSupplier, long) + * waitFor(booleanSupplier, Math.round(1000L * JTREG_TIMEOUT_FACTOR)} + * where {@code JTREG_TIMEOUT_FACTOR} is the value of + * "test.timeout.factor" system property. + * + * @apiNote If the given {@code booleanSupplier} is expected to never + * return true, for example to check if an object that is expected + * to be strongly reachable is still alive, + * {@link #waitFor(BooleanSupplier, long)} can be used to specify + * the timeout for the wait method to return. * * @param booleanSupplier boolean supplier * @return true if the {@code booleanSupplier} returns true, or false - * if did not complete after the specific waiting time. + * if did not complete after the waiting time. + */ public static boolean wait(BooleanSupplier booleanSupplier) { + return waitFor(booleanSupplier, Math.round(1000L * TIMEOUT_FACTOR)); + } + + /** + * Causes the current thread to wait until the {@code booleanSupplier} + * returns true, or the specified waiting time elapses. + * + * @apiNote If the given {@code booleanSupplier} is expected to never + * return true, for example to check if an object that is expected + * to be strongly reachable is still alive, this method can be used + * to specify the timeout independent of the jtreg timeout factor. + * + * @param booleanSupplier boolean supplier + * @param timeout the maximum time to wait, in milliseconds + * @return true if the {@code booleanSupplier} returns true, or false + * if did not complete after the specified waiting time. + */ + public static boolean waitFor(BooleanSupplier booleanSupplier, long timeout) { ReferenceQueue queue = new ReferenceQueue<>(); Object obj = new Object(); PhantomReference ref = new PhantomReference<>(obj, queue); @@ -53,7 +82,7 @@ public static boolean wait(BooleanSupplier booleanSupplier) { Reference.reachabilityFence(obj); Reference.reachabilityFence(ref); - int retries = (int)(Math.round(1000L * TIMEOUT_FACTOR) / 200); + int retries = (int)(timeout / 200); for (; retries >= 0; retries--) { if (booleanSupplier.getAsBoolean()) { return true; From 0c0871d65d2db89dabf5beaede9f70d4df2ef243 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Tue, 25 Jun 2024 16:01:02 +0000 Subject: [PATCH 125/329] 8316389: Open source few AWT applet tests Backport-of: 65227a3c64a9eaead7a7b2b94a5c2786f1b1bb4f --- test/jdk/java/awt/Frame/FrameRepackTest.java | 175 ++++++++++++++++++ .../FrameResizeTest/FrameResizeTest_1.java | 92 +++++++++ .../FrameResizeTest/FrameResizeTest_2.java | 144 ++++++++++++++ test/jdk/java/awt/Frame/WindowMoveTest.java | 166 +++++++++++++++++ 4 files changed, 577 insertions(+) create mode 100644 test/jdk/java/awt/Frame/FrameRepackTest.java create mode 100644 test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java create mode 100644 test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java create mode 100644 test/jdk/java/awt/Frame/WindowMoveTest.java diff --git a/test/jdk/java/awt/Frame/FrameRepackTest.java b/test/jdk/java/awt/Frame/FrameRepackTest.java new file mode 100644 index 00000000000..4f77d195ca6 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameRepackTest.java @@ -0,0 +1,175 @@ +/* + * Copyright (c) 1998, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.ScrollPane; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @key headful + * @summary Test dynamically changing frame component visibility and repacking + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameRepackTest + */ + +public class FrameRepackTest { + + private static final String INSTRUCTIONS = """ + There is a green frame with a menubar. + The menubar has one menu, labelled 'Flip'. + The menu has two items, labelled 'visible' and 'not visible'. + The frame also contains a red panel that contains two line labels, + 'This panel is always displayed' and 'it is a test'. + + If you select the menu item 'Flip->visible', then another panel is + added below the red panel. + The added panel is blue and has yellow horizontal and vertical scrollbars. + + If you select menu item 'Flip->not visible', the second panel + is removed and the frame appears as it did originally. + + You can repeatedly add and remove the second panel in this way. + After such an addition or removal, the frame's location on the screen + should not change, while the size changes to accommodate + either just the red panel or both the red and the blue panels. + + If you resize the frame larger, the red panel remains at the + top of the frame with its height fixed and its width adjusted + to the width of the frame. + + Similarly, if it is present, the blue panel and its yellow scroolbars + remain at the bottom of the frame with fixed height and width adjusted + to the size of the frame. But selecting 'visible' or 'not visible' + repacks the frame, thereby adjusting its size tightly to its panel(s). + + Upon test completion, click Pass or Fail appropriately. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame passFailJFrame = new PassFailJFrame.Builder() + .title("FrameRepackTest Instructions") + .instructions(INSTRUCTIONS) + .testTimeOut(5) + .rows(30) + .columns(45) + .build(); + + EventQueue.invokeAndWait(() -> { + FrameRepack frame = new FrameRepack(); + + PassFailJFrame.addTestWindow(frame); + PassFailJFrame.positionTestWindow(frame, + PassFailJFrame.Position.HORIZONTAL); + + frame.setVisible(true); + }); + + passFailJFrame.awaitAndCheck(); + } + +} + +class FrameRepack extends Frame implements ActionListener { + + Panel south; + + public FrameRepack() { + super("FrameRepack"); + + // create the menubar + MenuBar menubar = new MenuBar(); + this.setMenuBar(menubar); + // create the options + Menu flip = new Menu("Flip"); + MenuItem mi; + mi = new MenuItem("visible"); + mi.addActionListener(this); + flip.add(mi); + mi = new MenuItem("not visible"); + mi.addActionListener(this); + flip.add(mi); + + menubar.add(flip); + + setLayout(new BorderLayout(2, 2)); + setBackground(Color.green); + + // north panel is always displayed + Panel north = new Panel(); + north.setBackground(Color.red); + north.setLayout(new BorderLayout(2, 2)); + north.add("North", new Label("This panel is always displayed")); + north.add("Center", new Label("it is a test")); + north.setSize(200, 200); + add("North", north); + + // south panel can be visible or not... + // The problem seems to occur when I put this panel not visible + south = new Panel(); + south.setBackground(Color.white); + south.setLayout(new BorderLayout()); + + ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); + scroller.setBackground(Color.yellow); + Panel pan1 = new Panel(); + pan1.setBackground(Color.blue); + pan1.setLayout(new BorderLayout()); + + pan1.setSize(400, 150); + scroller.add("Center", pan1); + + south.add("South", scroller); + + add("South", south); + + south.setVisible(false); + + setSize(350, 300); + + pack(); + } + + @Override + public void actionPerformed(ActionEvent evt) { + if (evt.getSource() instanceof MenuItem) { + if (evt.getActionCommand().equals("visible")) { + south.setVisible(true); + pack(); + } else if (evt.getActionCommand().equals("not visible")) { + south.setVisible(false); + pack(); + } + } + } +} diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java new file mode 100644 index 00000000000..7503672fccd --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1998, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; + +/* + * @test + * @bug 4041442 + * @key headful + * @summary Test resizing a frame containing a canvas + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameResizeTest_1 + */ + +public class FrameResizeTest_1 { + + private static final String INSTRUCTIONS = """ + To the right of this frame is an all-white 200x200 frame. + + This is actually a white canvas component in the frame. + The frame itself is red. + The red should never show. + In particular, after you resize the frame, you should see all white and no red. + (During very fast window resizing, red color may appear briefly, + which is not a failure.) + + Upon test completion, click Pass or Fail appropriately. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame passFailJFrame = new PassFailJFrame.Builder() + .title("FrameResizeTest_1 Instructions") + .instructions(INSTRUCTIONS) + .testTimeOut(5) + .rows(12) + .columns(45) + .build(); + + EventQueue.invokeAndWait(() -> { + FrameResize_1 frame = new FrameResize_1(); + + PassFailJFrame.addTestWindow(frame); + PassFailJFrame.positionTestWindow(frame, + PassFailJFrame.Position.HORIZONTAL); + + frame.setVisible(true); + }); + + passFailJFrame.awaitAndCheck(); + } +} + +class FrameResize_1 extends Frame { + + FrameResize_1() { + super("FrameResize_1"); + // Create a white canvas + Canvas canvas = new Canvas(); + canvas.setBackground(Color.white); + + setLayout(new BorderLayout()); + add("Center", canvas); + + setBackground(Color.red); + setSize(200,200); + } +} diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java new file mode 100644 index 00000000000..e8fdd52522b --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 1998, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Panel; + +/* + * @test + * @bug 4065568 + * @key headful + * @summary Test resizing a frame containing a canvas + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameResizeTest_2 + */ + +public class FrameResizeTest_2 { + private static final String INSTRUCTIONS = """ + There is a frame (size 300x300). + The left half is red and the right half is blue. + + When you resize the frame, it should still have a red left half + and a blue right half. + + In particular, no green should be visible after a resize. + + Upon test completion, click Pass or Fail appropriately. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame passFailJFrame = new PassFailJFrame.Builder() + .title("FrameResizeTest_2 Instructions") + .instructions(INSTRUCTIONS) + .testTimeOut(5) + .rows(10) + .columns(45) + .build(); + + EventQueue.invokeAndWait(() -> { + FrameResize_2 frame = new FrameResize_2(); + + PassFailJFrame.addTestWindow(frame); + PassFailJFrame.positionTestWindow(frame, + PassFailJFrame.Position.HORIZONTAL); + + frame.setVisible(true); + }); + + passFailJFrame.awaitAndCheck(); + } +} + +class FrameResize_2 extends Frame { + + FrameResize_2() { + super("FrameResize_2"); + + setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.BOTH; + c.weightx = 1; + c.weighty = 1; + + Container dumbContainer = new DumbContainer(); + add(dumbContainer, c); + + Panel dumbPanel = new DumbPanel(); + add(dumbPanel, c); + + setSize(300, 300); + } +} + + +class Fake extends Canvas { + public Fake(String name, Color what) { + setBackground(what); + setName(name); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(getBackground()); + g.fillRect(0, 0, d.width, d.height); + } +} + +class DumbContainer extends Container { + public DumbContainer() { + setLayout(new BorderLayout()); + add("Center", new Fake("dumbc", Color.red)); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(Color.green); + g.fillRect(0, 0, d.width, d.height); + super.paint(g); + } +} + +class DumbPanel extends Panel { + public DumbPanel() { + setLayout(new BorderLayout()); + add("Center", new Fake("dumbp", Color.blue)); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(Color.green); + g.fillRect(0, 0, d.width, d.height); + super.paint(g); + } +} diff --git a/test/jdk/java/awt/Frame/WindowMoveTest.java b/test/jdk/java/awt/Frame/WindowMoveTest.java new file mode 100644 index 00000000000..0b086216a3b --- /dev/null +++ b/test/jdk/java/awt/Frame/WindowMoveTest.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 1998, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/* + * @test + * @bug 4077874 + * @key headful + * @summary Test window position at opening, closing, and closed for consistency + */ + +public class WindowMoveTest { + + static WindowMove frame; + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.setAutoWaitForIdle(true); + + EventQueue.invokeAndWait(() -> frame = new WindowMove()); + + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> + frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING))); + + if (!WindowMove.latch.await(2, TimeUnit.SECONDS)) { + throw new RuntimeException("Test timeout."); + } + + if (WindowMove.failMessage != null) { + throw new RuntimeException(WindowMove.failMessage); + } + } +} + +class WindowMove extends Frame implements WindowListener { + static final Rectangle expectedBounds = + new Rectangle(100, 100, 300, 300); + + static CountDownLatch latch = new CountDownLatch(1); + static String failMessage = null; + + private boolean layoutCheck; + private boolean visibleCheck; + private boolean openedCheck; + private boolean closingCheck; + private boolean closedCheck; + + public WindowMove() { + super("WindowMove"); + addWindowListener(this); + + setSize(300, 300); + setLocation(100, 100); + setBackground(Color.white); + + setLayout(null); + if (checkBounds()) { + layoutCheck = true; + } + System.out.println("setLayout bounds: " + getBounds()); + + setVisible(true); + if (checkBounds()) { + visibleCheck = true; + } + System.out.println("setVisible bounds: " + getBounds()); + } + + private boolean checkBounds() { + return getBounds().equals(expectedBounds); + } + + public void checkResult() { + if (layoutCheck + && visibleCheck + && openedCheck + && closingCheck + && closedCheck) { + System.out.println("Test passed."); + } else { + failMessage = """ + Some of the checks failed: + layoutCheck %s + visibleCheck %s + openedCheck %s + closingCheck %s + closedCheck %s + """ + .formatted( + layoutCheck, + visibleCheck, + openedCheck, + closingCheck, + closedCheck + ); + } + + latch.countDown(); + } + + public void windowClosing(WindowEvent evt) { + if (checkBounds()) { + closingCheck = true; + } + System.out.println("Closing bounds: " + getBounds()); + + setVisible(false); + dispose(); + } + + public void windowClosed(WindowEvent evt) { + if (checkBounds()) { + closedCheck = true; + } + System.out.println("Closed bounds: " + getBounds()); + + checkResult(); + } + + public void windowOpened(WindowEvent evt) { + if (checkBounds()) { + openedCheck = true; + } + System.out.println("Opening bounds: " + getBounds()); + } + + public void windowActivated(WindowEvent evt) {} + + public void windowIconified(WindowEvent evt) {} + + public void windowDeactivated(WindowEvent evt) {} + + public void windowDeiconified(WindowEvent evt) {} +} From a963e2d713b58c74e4778dea111a014445c5c926 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Tue, 25 Jun 2024 16:01:35 +0000 Subject: [PATCH 126/329] 8241550: [macOS] SSLSocketImpl/ReuseAddr.java failed due to "BindException: Address already in use" Backport-of: 6a35311468222f9335b43d548df2ecb80746b389 --- .../security/ssl/SSLSocketImpl/ReuseAddr.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java b/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java index abad01099bc..f7e677bbbd0 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -34,9 +34,12 @@ */ import java.net.ServerSocket; +import java.net.BindException; public class ReuseAddr extends SSLSocketTemplate { + private static final int MAX_ATTEMPTS = 3; + @Override protected void doServerSide() throws Exception { super.doServerSide(); @@ -50,6 +53,21 @@ protected void doServerSide() throws Exception { } public static void main(String[] args) throws Exception { - new ReuseAddr().run(); + for (int i=1 ; i <= MAX_ATTEMPTS; i++) { + try { + new ReuseAddr().run(); + System.out.println("Test succeeded at attempt " + i); + break; + } catch (BindException x) { + System.out.println("attempt " + i + " failed: " + x); + if (i == MAX_ATTEMPTS) { + String msg = "Could not succeed after " + i + " attempts"; + System.err.println(msg); + throw new AssertionError("Failed to reuse address: " + msg, x); + } else { + System.out.println("Retrying..."); + } + } + } } } From 859dda14f3f0d90294899812f5d34ea2e952a3df Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Wed, 26 Jun 2024 10:47:13 +0000 Subject: [PATCH 127/329] 8332174: Remove 2 (unpaired) RLO Unicode characters in ff_Adlm.xml Reviewed-by: andrew Backport-of: d5363bc509d4996529420b453a99e982c843da1c --- make/data/cldr/common/main/ff_Adlm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/data/cldr/common/main/ff_Adlm.xml b/make/data/cldr/common/main/ff_Adlm.xml index 02feba420c8..05bb2c6db95 100644 --- a/make/data/cldr/common/main/ff_Adlm.xml +++ b/make/data/cldr/common/main/ff_Adlm.xml @@ -272,7 +272,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic 𞤄𞤢𞤸𞤢𞤥𞤢𞥄𞤧 𞤄𞤵𞥅𞤼𞤢𞥄𞤲 𞤅𞤵𞤪𞤭𞥅𞤪𞤫 𞤄𞤵𞥅𞤾𞤫𞥅 - ‮𞤄𞤮𞤼𞤧𞤵𞤱𞤢𞥄𞤲𞤢 + 𞤄𞤮𞤼𞤧𞤵𞤱𞤢𞥄𞤲𞤢 𞤄𞤫𞤤𞤢𞤪𞤵𞥅𞤧 𞤄𞤫𞤤𞤭𞥅𞥁 𞤑𞤢𞤲𞤢𞤣𞤢𞥄 @@ -2245,7 +2245,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic 𞤐𞤵𞥅𞤳 - ‮𞤋𞤼𞥆𞤮𞤳𞤮𞤪𞤼𞤮𞥅𞤪𞤥𞤭𞥅𞤼 + 𞤋𞤼𞥆𞤮𞤳𞤮𞤪𞤼𞤮𞥅𞤪𞤥𞤭𞥅𞤼 𞤁𞤢𞥄𞤲𞤥𞤢𞤪𞤳𞥃𞤢𞥄𞤾𞤲 From b99923c423315100b624bdfdb4392fba7182ca7c Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Wed, 26 Jun 2024 12:29:40 +0000 Subject: [PATCH 128/329] 8329605: hs errfile generic events - move memory protections and nmethod flushes to separate sections Reviewed-by: mdoerr Backport-of: 397d94831033e91c7a849774bf4e80d8f1c8ec66 --- src/hotspot/os/aix/os_aix.cpp | 4 ++-- src/hotspot/os/bsd/os_bsd.cpp | 6 +++--- src/hotspot/os/linux/os_linux.cpp | 2 +- src/hotspot/share/code/nmethod.cpp | 2 +- src/hotspot/share/utilities/events.cpp | 6 +++++- src/hotspot/share/utilities/events.hpp | 30 +++++++++++++++++++++++++- 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 32e014059da..f143d4485c4 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -2068,7 +2068,7 @@ static bool checked_mprotect(char* addr, size_t size, int prot) { // // See http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/mprotect.htm - Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); + Events::log_memprotect(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); bool rc = ::mprotect(addr, size, prot) == 0 ? true : false; if (!rc) { @@ -2107,7 +2107,7 @@ static bool checked_mprotect(char* addr, size_t size, int prot) { // A valid strategy is just to try again. This usually works. :-/ ::usleep(1000); - Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); + Events::log_memprotect(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); if (::mprotect(addr, size, prot) == 0) { const bool read_protected_2 = (SafeFetch32((int*)addr, 0x12345678) == 0x12345678 && diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index d10577b4496..e8322c21bc4 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1609,7 +1609,7 @@ bool os::pd_commit_memory(char* addr, size_t size, bool exec) { int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE; #if defined(__OpenBSD__) // XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD - Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); + Events::log_memprotect(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); if (::mprotect(addr, size, prot) == 0) { return true; } @@ -1711,7 +1711,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { #if defined(__OpenBSD__) // XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD - Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with PROT_NONE", p2i(addr), p2i(addr+size)); + Events::log_memprotect(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with PROT_NONE", p2i(addr), p2i(addr+size)); return ::mprotect(addr, size, PROT_NONE) == 0; #elif defined(__APPLE__) if (exec) { @@ -1781,7 +1781,7 @@ static bool bsd_mprotect(char* addr, size_t size, int prot) { assert(addr == bottom, "sanity check"); size = align_up(pointer_delta(addr, bottom, 1) + size, os::Bsd::page_size()); - Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(bottom), p2i(bottom+size), prot); + Events::log_memprotect(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(bottom), p2i(bottom+size), prot); return ::mprotect(bottom, size, prot) == 0; } diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 63b7562f118..3566a2f36b4 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -3589,7 +3589,7 @@ static bool linux_mprotect(char* addr, size_t size, int prot) { #ifdef CAN_SHOW_REGISTERS_ON_ASSERT if (addr != g_assert_poison) #endif - Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(bottom), p2i(bottom+size), prot); + Events::log_memprotect(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(bottom), p2i(bottom+size), prot); return ::mprotect(bottom, size, prot) == 0; } diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index eef8e6b4bbb..f5861d1f3ed 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1550,7 +1550,7 @@ void nmethod::flush() { assert_locked_or_safepoint(CodeCache_lock); // completely deallocate this method - Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, p2i(this)); + Events::log_nmethod_flush(Thread::current(), "flushing %s nmethod " INTPTR_FORMAT, is_osr_method() ? "osr" : "", p2i(this)); if (PrintMethodFlushing) { tty->print_cr("*flushing %s nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb", diff --git a/src/hotspot/share/utilities/events.cpp b/src/hotspot/share/utilities/events.cpp index 100acb3e90f..5a8281eb088 100644 --- a/src/hotspot/share/utilities/events.cpp +++ b/src/hotspot/share/utilities/events.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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,6 +35,8 @@ EventLog* Events::_logs = NULL; StringEventLog* Events::_messages = NULL; +StringEventLog* Events::_memprotect_messages = NULL; +StringEventLog* Events::_nmethod_flush_messages = NULL; StringEventLog* Events::_vm_operations = NULL; ExceptionsEventLog* Events::_exceptions = NULL; StringEventLog* Events::_redefinitions = NULL; @@ -94,6 +96,8 @@ void Events::print() { void Events::init() { if (LogEvents) { _messages = new StringEventLog("Events", "events"); + _nmethod_flush_messages = new StringEventLog("Nmethod flushes", "nmethodflushes"); + _memprotect_messages = new StringEventLog("Memory protections", "memprotects"); _vm_operations = new StringEventLog("VM Operations", "vmops"); _exceptions = new ExceptionsEventLog("Internal exceptions", "exc"); _redefinitions = new StringEventLog("Classes redefined", "redef"); diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp index 9afda084120..ef4e69a94ea 100644 --- a/src/hotspot/share/utilities/events.hpp +++ b/src/hotspot/share/utilities/events.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -220,6 +220,12 @@ class Events : AllStatic { // A log for generic messages that aren't well categorized. static StringEventLog* _messages; + // A log for memory protection related messages + static StringEventLog* _memprotect_messages; + + // A log for nmethod flush operations + static StringEventLog* _nmethod_flush_messages; + // A log for VM Operations static StringEventLog* _vm_operations; @@ -256,6 +262,10 @@ class Events : AllStatic { // Logs a generic message with timestamp and format as printf. static void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + static void log_memprotect(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + + static void log_nmethod_flush(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + static void log_vm_operation(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // Log exception related message @@ -285,6 +295,24 @@ inline void Events::log(Thread* thread, const char* format, ...) { } } +inline void Events::log_memprotect(Thread* thread, const char* format, ...) { + if (LogEvents && _memprotect_messages != nullptr) { + va_list ap; + va_start(ap, format); + _memprotect_messages->logv(thread, format, ap); + va_end(ap); + } +} + +inline void Events::log_nmethod_flush(Thread* thread, const char* format, ...) { + if (LogEvents && _nmethod_flush_messages != nullptr) { + va_list ap; + va_start(ap, format); + _nmethod_flush_messages->logv(thread, format, ap); + va_end(ap); + } +} + inline void Events::log_vm_operation(Thread* thread, const char* format, ...) { if (LogEvents && _vm_operations != NULL) { va_list ap; From f277b3999f8cd30d5874ce58f290a06538d0189f Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 26 Jun 2024 12:37:38 +0000 Subject: [PATCH 129/329] 8051959: Add thread and timestamp options to java.security.debug system property Reviewed-by: mbaesken Backport-of: 3b582dff849f1c25336e2efc415eb121f8b12189 --- .../classes/sun/security/util/Debug.java | 119 ++++++++++++--- .../sun/security/util/Debug/DebugOptions.java | 138 ++++++++++++++++++ 2 files changed, 237 insertions(+), 20 deletions(-) create mode 100644 test/jdk/sun/security/util/Debug/DebugOptions.java diff --git a/src/java.base/share/classes/sun/security/util/Debug.java b/src/java.base/share/classes/sun/security/util/Debug.java index aca672bdb31..ef03423f322 100644 --- a/src/java.base/share/classes/sun/security/util/Debug.java +++ b/src/java.base/share/classes/sun/security/util/Debug.java @@ -27,6 +27,9 @@ import java.io.PrintStream; import java.math.BigInteger; +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.HexFormat; import java.util.regex.Pattern; import java.util.regex.Matcher; @@ -41,8 +44,14 @@ public class Debug { private String prefix; + private boolean printDateTime; + private boolean printThreadDetails; private static String args; + private static boolean threadInfoAll; + private static boolean timeStampInfoAll; + private static final String TIMESTAMP_OPTION = "+timestamp"; + private static final String THREAD_OPTION = "+thread"; static { args = GetPropertyAction.privilegedGetProperty("java.security.debug"); @@ -61,12 +70,21 @@ public class Debug { args = marshal(args); if (args.equals("help")) { Help(); + } else if (args.contains("all")) { + // "all" option has special handling for decorator options + // If the thread or timestamp decorator option is detected + // with the "all" option, then it impacts decorator options + // for other categories + int beginIndex = args.lastIndexOf("all") + "all".length(); + int commaIndex = args.indexOf(',', beginIndex); + if (commaIndex == -1) commaIndex = args.length(); + threadInfoAll = args.substring(beginIndex, commaIndex).contains(THREAD_OPTION); + timeStampInfoAll = args.substring(beginIndex, commaIndex).contains(TIMESTAMP_OPTION); } } } - public static void Help() - { + public static void Help() { System.err.println(); System.err.println("all turn on all debugging"); System.err.println("access print all checkPermission results"); @@ -92,6 +110,11 @@ public static void Help() System.err.println("securerandom SecureRandom"); System.err.println("ts timestamping"); System.err.println(); + System.err.println("+timestamp can be appended to any of above options to print"); + System.err.println(" a timestamp for that debug option"); + System.err.println("+thread can be appended to any of above options to print"); + System.err.println(" thread and caller information for that debug option"); + System.err.println(); System.err.println("The following can be used with access:"); System.err.println(); System.err.println("stack include stack trace"); @@ -132,8 +155,7 @@ public static void Help() * option is set. Set the prefix to be the same as option. */ - public static Debug getInstance(String option) - { + public static Debug getInstance(String option) { return getInstance(option, option); } @@ -141,23 +163,57 @@ public static Debug getInstance(String option) * Get a Debug object corresponding to whether or not the given * option is set. Set the prefix to be prefix. */ - public static Debug getInstance(String option, String prefix) - { + public static Debug getInstance(String option, String prefix) { if (isOn(option)) { Debug d = new Debug(); d.prefix = prefix; + d.configureExtras(option); return d; } else { return null; } } + private static String formatCaller() { + return StackWalker.getInstance().walk(s -> + s.dropWhile(f -> + f.getClassName().startsWith("sun.security.util.Debug")) + .map(f -> f.getFileName() + ":" + f.getLineNumber()) + .findFirst().orElse("unknown caller")); + } + + // parse an option string to determine if extra details, + // like thread and timestamp, should be printed + private void configureExtras(String option) { + // treat "all" as special case, only used for java.security.debug property + this.printDateTime = timeStampInfoAll; + this.printThreadDetails = threadInfoAll; + + if (printDateTime && printThreadDetails) { + // nothing left to configure + return; + } + + // args is converted to lower case for the most part via marshal method + int optionIndex = args.lastIndexOf(option); + if (optionIndex == -1) { + // option not in args list. Only here since "all" was present + // in debug property argument. "all" option already parsed + return; + } + int beginIndex = optionIndex + option.length(); + int commaIndex = args.indexOf(',', beginIndex); + if (commaIndex == -1) commaIndex = args.length(); + String subOpt = args.substring(beginIndex, commaIndex); + printDateTime = printDateTime || subOpt.contains(TIMESTAMP_OPTION); + printThreadDetails = printThreadDetails || subOpt.contains(THREAD_OPTION); + } + /** * True if the system property "security.debug" contains the * string "option". */ - public static boolean isOn(String option) - { + public static boolean isOn(String option) { if (args == null) return false; else { @@ -180,18 +236,16 @@ public static boolean isVerbose() { * created from the call to getInstance. */ - public void println(String message) - { - System.err.println(prefix + ": "+message); + public void println(String message) { + System.err.println(prefix + extraInfo() + ": " + message); } /** * print a message to stderr that is prefixed with the prefix * created from the call to getInstance and obj. */ - public void println(Object obj, String message) - { - System.err.println(prefix + " [" + obj.getClass().getSimpleName() + + public void println(Object obj, String message) { + System.err.println(prefix + extraInfo() + " [" + obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj) + "]: "+message); } @@ -199,18 +253,36 @@ public void println(Object obj, String message) * print a blank line to stderr that is prefixed with the prefix. */ - public void println() - { - System.err.println(prefix + ":"); + public void println() { + System.err.println(prefix + extraInfo() + ":"); } /** * print a message to stderr that is prefixed with the prefix. */ - public static void println(String prefix, String message) - { - System.err.println(prefix + ": "+message); + public void println(String prefix, String message) { + System.err.println(prefix + extraInfo() + ": " + message); + } + + /** + * If thread debug option enabled, include information containing + * hex value of threadId and the current thread name + * If timestamp debug option enabled, include timestamp string + * @return extra info if debug option enabled. + */ + private String extraInfo() { + String retString = ""; + if (printThreadDetails) { + retString = "0x" + Long.toHexString( + Thread.currentThread().getId()).toUpperCase(Locale.ROOT) + + "|" + Thread.currentThread().getName() + "|" + formatCaller(); + } + if (printDateTime) { + retString += (retString.isEmpty() ? "" : "|") + + FormatHolder.DATE_TIME_FORMATTER.format(Instant.now()); + } + return retString.isEmpty() ? "" : "[" + retString + "]"; } /** @@ -326,4 +398,11 @@ public static String toString(byte[] b) { return HexFormat.ofDelimiter(":").formatHex(b); } + // Holder class to break cyclic dependency seen during build + private static class FormatHolder { + private static final String PATTERN = "yyyy-MM-dd kk:mm:ss.SSS"; + private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter + .ofPattern(PATTERN, Locale.ENGLISH) + .withZone(ZoneId.systemDefault()); + } } diff --git a/test/jdk/sun/security/util/Debug/DebugOptions.java b/test/jdk/sun/security/util/Debug/DebugOptions.java new file mode 100644 index 00000000000..a52566e7aeb --- /dev/null +++ b/test/jdk/sun/security/util/Debug/DebugOptions.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8051959 + * @summary Option to print extra information in java.security.debug output + * @library /test/lib + * @run junit DebugOptions + */ + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.security.KeyStore; +import java.security.Security; +import java.util.stream.Stream; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class DebugOptions { + + static final String DATE_REGEX = "\\d{4}-\\d{2}-\\d{2}"; + + private static Stream patternMatches() { + return Stream.of( + // no extra info present + Arguments.of("properties", + "properties: Initial", + "properties\\["), + // thread info only + Arguments.of("properties+thread", + "properties\\[.*\\|main\\|.*java.*]:", + "properties\\[" + DATE_REGEX), + // timestamp info only + Arguments.of("properties+timestamp", + "properties\\[" + DATE_REGEX + ".*\\]", + "\\|main\\]:"), + // both thread and timestamp + Arguments.of("properties+timestamp+thread", + "properties\\[.*\\|main|" + DATE_REGEX + ".*\\]:", + "properties:"), + // flip the arguments of previous test + Arguments.of("properties+thread+timestamp", + "properties\\[.*\\|main|" + DATE_REGEX + ".*\\]:", + "properties:"), + // comma not valid separator, ignore extra info printing request + Arguments.of("properties,thread,timestamp", + "properties:", + "properties\\[.*\\|main|" + DATE_REGEX + ".*\\]:"), + // no extra info for keystore debug prints + Arguments.of("properties+thread+timestamp,keystore", + "properties\\[.*\\|main|" + DATE_REGEX + ".*\\]:", + "keystore\\["), + // flip arguments around in last test - same outcome expected + Arguments.of("keystore,properties+thread+timestamp", + "properties\\[.*\\|main|" + DATE_REGEX + ".*\\]:", + "keystore\\["), + // turn on thread info for both keystore and properties components + Arguments.of("keystore+thread,properties+thread", + "properties\\[.*\\|main|.*\\Rkeystore\\[.*\\|main|.*\\]:", + "\\|" + DATE_REGEX + ".*\\]:"), + // same as above with erroneous comma at end of string. same output expected + Arguments.of("keystore+thread,properties+thread,", + "properties\\[.*\\|main|.*\\Rkeystore\\[.*\\|main|.*\\]:", + "\\|" + DATE_REGEX + ".*\\]:"), + // turn on thread info for properties and timestamp for keystore + Arguments.of("keystore+timestamp,properties+thread", + "properties\\[.*\\|main|.*\\Rkeystore\\[" + DATE_REGEX + ".*\\]:", + "properties\\[.*\\|" + DATE_REGEX + ".*\\]:"), + // turn on thread info for all components + Arguments.of("all+thread", + "properties\\[.*\\|main.*((.*\\R)*)keystore\\[.*\\|main.*java.*\\]:", + "properties\\[" + DATE_REGEX + ".*\\]:"), + // turn on thread info and timestamp for all components + Arguments.of("all+thread+timestamp", + "properties\\[.*\\|main.*\\|" + DATE_REGEX + + ".*\\]((.*\\R)*)keystore\\[.*\\|main.*\\|" + DATE_REGEX + ".*\\]:", + "properties:"), + // all decorator option should override other component options + Arguments.of("all+thread+timestamp,properties", + "properties\\[.*\\|main.*\\|" + DATE_REGEX + + ".*\\]((.*\\R)*)keystore\\[.*\\|main.*\\|" + DATE_REGEX + ".*\\]:", + "properties:"), + // thread details should only be printed for properties option + Arguments.of("properties+thread,all", + "properties\\[.*\\|main\\|.*\\]:", + "keystore\\[.*\\|main\\|.*\\]:"), + // thread details should be printed for all statements + Arguments.of("properties,all+thread", + "properties\\[.*\\|main.*java" + + ".*\\]((.*\\R)*)keystore\\[.*\\|main.*java.*\\]:", + "properties:") + ); + } + + @ParameterizedTest + @MethodSource("patternMatches") + public void shouldContain(String params, String expected, String notExpected) throws Exception { + OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJava( + "-Djava.security.debug=" + params, + "DebugOptions" + ); + outputAnalyzer.shouldHaveExitValue(0) + .shouldMatch(expected) + .shouldNotMatch(notExpected); + } + + public static void main(String[] args) throws Exception { + // something to trigger "properties" debug output + Security.getProperty("test"); + // trigger "keystore" debug output + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(null, null); + } +} From 11f5d00657f261e2a3388d66f66732191ca7a86c Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 26 Jun 2024 13:34:49 +0000 Subject: [PATCH 130/329] 8329103: assert(!thread->in_asgct()) failed during multi-mode profiling Backport-of: 6b1b0e9d45eb56f88398e2a6bca0d90c03112eaa --- src/hotspot/share/runtime/thread.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 825b04cc272..42ac37a601f 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -668,15 +668,17 @@ class Thread: public ThreadShadow { class ThreadInAsgct { private: Thread* _thread; + bool _saved_in_asgct; public: ThreadInAsgct(Thread* thread) : _thread(thread) { assert(thread != nullptr, "invariant"); - assert(!thread->in_asgct(), "invariant"); + // Allow AsyncGetCallTrace to be reentrant - save the previous state. + _saved_in_asgct = thread->in_asgct(); thread->set_in_asgct(true); } ~ThreadInAsgct() { assert(_thread->in_asgct(), "invariant"); - _thread->set_in_asgct(false); + _thread->set_in_asgct(_saved_in_asgct); } }; From dae2d6c7df4e37890ddf5ee702a1d7c34712d120 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Thu, 27 Jun 2024 02:21:08 +0000 Subject: [PATCH 131/329] 8328647: TestGarbageCollectorMXBean.java fails with C1-only and -Xcomp Reviewed-by: mdoerr Backport-of: bdd9438b453fedf9b8181ad2615640168638677d --- test/hotspot/jtreg/gc/z/TestGarbageCollectorMXBean.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/gc/z/TestGarbageCollectorMXBean.java b/test/hotspot/jtreg/gc/z/TestGarbageCollectorMXBean.java index e29d75b009c..07d3f3dadc7 100644 --- a/test/hotspot/jtreg/gc/z/TestGarbageCollectorMXBean.java +++ b/test/hotspot/jtreg/gc/z/TestGarbageCollectorMXBean.java @@ -26,6 +26,7 @@ * @requires vm.gc.Z * @summary Test ZGC garbage collector MXBean * @modules java.management + * @requires vm.compMode != "Xcomp" * @run main/othervm -XX:+UseZGC -Xms256M -Xmx512M -Xlog:gc TestGarbageCollectorMXBean 256 512 * @run main/othervm -XX:+UseZGC -Xms512M -Xmx512M -Xlog:gc TestGarbageCollectorMXBean 512 512 */ From 2b128f12ea24c5b4eab827eb8311dfb929de49f4 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Thu, 27 Jun 2024 02:25:07 +0000 Subject: [PATCH 132/329] 8222884: ConcurrentClassDescLookup.java times out intermittently Backport-of: bd046d9b9e79e4eea89c72af358961ef6e98e660 --- .../ConcurrentClassDescLookup.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java b/test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java index 48cbd1b0ffe..196a27b52ba 100644 --- a/test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java +++ b/test/jdk/java/io/Serializable/concurrentClassDescLookup/ConcurrentClassDescLookup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,6 +28,7 @@ */ import java.io.*; +import java.util.concurrent.CountDownLatch; class Good implements Serializable { private static final long serialVersionUID = 6319710844400051132L; @@ -51,19 +52,20 @@ class Bad implements Serializable { class SuccessfulLookup extends Thread { Class cl; long suid; - Object barrier; + final CountDownLatch lookupLatch; boolean ok; - SuccessfulLookup(Class cl, long suid, Object barrier) { + SuccessfulLookup(Class cl, long suid, CountDownLatch lookupLatch) { this.cl = cl; this.suid = suid; - this.barrier = barrier; + this.lookupLatch = lookupLatch; } public void run() { - synchronized (barrier) { - try { barrier.wait(); } catch (InterruptedException ex) {} - } + lookupLatch.countDown(); // let others know we are ready + try { + lookupLatch.await(); // await for others + } catch (InterruptedException ex) {} for (int i = 0; i < 100; i++) { if (ObjectStreamClass.lookup(cl).getSerialVersionUID() != suid) { return; @@ -75,18 +77,19 @@ public void run() { class FailingLookup extends Thread { Class cl; - final Object barrier; + final CountDownLatch lookupLatch; boolean ok; - FailingLookup(Class cl, Object barrier) { + FailingLookup(Class cl, CountDownLatch lookupLatch) { this.cl = cl; - this.barrier = barrier; + this.lookupLatch = lookupLatch; } public void run() { - synchronized (barrier) { - try { barrier.wait(); } catch (InterruptedException ex) {} - } + lookupLatch.countDown(); // let others know we are ready + try { + lookupLatch.await(); // await for others + } catch (InterruptedException ex) {} for (int i = 0; i < 100; i++) { try { ObjectStreamClass.lookup(cl); @@ -102,39 +105,36 @@ public class ConcurrentClassDescLookup { public static void main(String[] args) throws Exception { ClassLoader loader = ConcurrentClassDescLookup.class.getClassLoader(); Class cl = Class.forName("Good", false, loader); - Object barrier = new Object(); - SuccessfulLookup[] slookups = new SuccessfulLookup[50]; + int numSuccessfulLookups = 50; + CountDownLatch sLookupLatch = new CountDownLatch(numSuccessfulLookups); + SuccessfulLookup[] slookups = new SuccessfulLookup[numSuccessfulLookups]; for (int i = 0; i < slookups.length; i++) { - slookups[i] = - new SuccessfulLookup(cl, 6319710844400051132L, barrier); + slookups[i] = new SuccessfulLookup(cl, 6319710844400051132L, sLookupLatch); slookups[i].start(); } - Thread.sleep(1000); - synchronized (barrier) { - barrier.notifyAll(); - } + System.out.println("awaiting completion of " + slookups.length + " SuccessfulLookup"); for (int i = 0; i < slookups.length; i++) { slookups[i].join(); if (!slookups[i].ok) { throw new Error(); } } - + System.out.println("all " + slookups.length + " SuccessfulLookup completed"); cl = Class.forName("Bad", false, loader); - FailingLookup[] flookups = new FailingLookup[50]; + int numFailingLookups = 50; + CountDownLatch fLookupLatch = new CountDownLatch(numFailingLookups); + FailingLookup[] flookups = new FailingLookup[numFailingLookups]; for (int i = 0; i < flookups.length; i++) { - flookups[i] = new FailingLookup(cl, barrier); + flookups[i] = new FailingLookup(cl, fLookupLatch); flookups[i].start(); } - Thread.sleep(1000); - synchronized (barrier) { - barrier.notifyAll(); - } - for (int i = 0; i < slookups.length; i++) { + System.out.println("awaiting completion of " + flookups.length + " FailingLookup"); + for (int i = 0; i < flookups.length; i++) { flookups[i].join(); if (!flookups[i].ok) { throw new Error(); } } + System.out.println("all " + flookups.length + " FailingLookup completed"); } } From 719f9cebb32802abfc0a8dc4a9c1fc82706765ac Mon Sep 17 00:00:00 2001 From: Xiaolong Peng Date: Thu, 27 Jun 2024 08:02:23 +0000 Subject: [PATCH 133/329] 8323584: AArch64: Unnecessary ResourceMark in NativeCall::set_destination_mt_safe Backport-of: 34f85ee94e8b45bcebbf8ba52a38c92a7185b54a --- src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp index d5a5503213c..66b2769aca5 100644 --- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp @@ -28,7 +28,6 @@ #include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "gc/shared/collectedHeap.hpp" -#include "memory/resourceArea.hpp" #include "nativeInst_aarch64.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.hpp" @@ -189,8 +188,6 @@ void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) { CompiledICLocker::is_safe(addr_at(0)), "concurrent code patching"); - ResourceMark rm; - int code_size = NativeInstruction::instruction_size; address addr_call = addr_at(0); bool reachable = Assembler::reachable_from_branch_at(addr_call, dest); assert(NativeCall::is_call_at(addr_call), "unexpected code at call site"); From 5b43be27c310c353445b56eb881fbc55341a37fa Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Thu, 27 Jun 2024 08:05:10 +0000 Subject: [PATCH 134/329] 8317372: Refactor some NumberFormat tests to use JUnit Reviewed-by: mdoerr Backport-of: 9622de2aa89923b8444df093ae1c596bc336f14f --- .../BigDecimalCompatibilityTest.java | 200 +++++---- .../text/Format/NumberFormat/Bug4208135.java | 235 ++++++---- .../text/Format/NumberFormat/Bug4838107.java | 401 ++++++++++-------- .../text/Format/NumberFormat/Bug4944439.java | 136 +++--- .../text/Format/NumberFormat/Bug4990596.java | 22 +- .../text/Format/NumberFormat/Bug6278616.java | 65 +-- .../text/Format/NumberFormat/Bug8132125.java | 23 +- .../Format/NumberFormat/CurrencyFormat.java | 201 +++++---- .../NumberFormat/TestPeruCurrencyFormat.java | 22 +- 9 files changed, 752 insertions(+), 553 deletions(-) diff --git a/test/jdk/java/text/Format/NumberFormat/BigDecimalCompatibilityTest.java b/test/jdk/java/text/Format/NumberFormat/BigDecimalCompatibilityTest.java index 2af23a4c82d..66fc44e368f 100644 --- a/test/jdk/java/text/Format/NumberFormat/BigDecimalCompatibilityTest.java +++ b/test/jdk/java/text/Format/NumberFormat/BigDecimalCompatibilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -24,58 +24,85 @@ /* * @test * @bug 4018937 - * @summary Confirm that DecimalFormat.parse() parses BigDecimal and BigInteger as expected. + * @summary Confirm that DecimalFormat.parse() parses BigDecimal and BigInteger + * string values as expected. Specifically, ensure a ParseException is + * not thrown as well as the parsed value being numerically correct. + * Tests large String values with combinations of multipliers and exponents. + * @run junit BigDecimalCompatibilityTest */ -import java.math.*; -import java.text.*; -import java.util.*; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Locale; +import java.util.stream.Stream; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; public class BigDecimalCompatibilityTest { - static boolean err = false; + private static DecimalFormat df = new DecimalFormat(); + // Save JVM default Locale + private static final Locale savedLocale = Locale.getDefault(); - static final String[] input_data = { - "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" - }; - static final String[] exponents = { - "E-100", "E100", "E-900", "E900", "" - }; - static final int[] multipliers = { - -1, 1, -100, 100, -9999, 9999 - }; + // ---- Used for the test data (start) ---- - public static void main(String[] args) throws Exception { - Locale loc = Locale.getDefault(); - Locale.setDefault(Locale.US); + // Both ArrayList composed of Arguments(String longString, int multiplier) + private static final ArrayList bigIntegers = new ArrayList(); + private static final ArrayList bigDecimals = new ArrayList(); - testBigDecimal(); - testBigInteger(); + // Long string data to generate combinations of test values + private static final String[] inputData = { + "0".repeat(400), + "1234567890".repeat(40)}; - Locale.setDefault(loc); + // Variety of exponents to test parse() against + private static final String[] exponents = { + "E-100", "E100", "E-900", "E900", "" + }; - if (err) { - throw new RuntimeException("Error: Unexpected value"); - } - } + // Variety of multipliers that DecimalFormat can apply + private static final int[] multipliers = { + -1, 1, -100, 100, -9999, 9999 + }; + // ---- Used for the test data (end) ---- - static private void testBigDecimal() { - DecimalFormat df = new DecimalFormat(); - df.setParseBigDecimal(true); - df.setMaximumFractionDigits(Integer.MAX_VALUE); + // Set JVM default Locale to US and populate the test arrayLists + @BeforeAll + static void initAll() { + Locale.setDefault(Locale.US); + buildTestData(); + } - for (int i = 0; i < input_data.length; i++) { - for (int j = 0; j < input_data.length; j++) { - for (int k = 0; k < input_data.length; k++) { - for (int l = 0; l < input_data.length; l++) { - for (int m = 0; m < exponents.length; m++) { - String s = input_data[i] + input_data[j] + '.' + - input_data[k] + input_data[l] + - exponents[m]; - for (int n = 0; n < multipliers.length; n++) { - test(df, s, multipliers[n]); - test(df, '-'+s, multipliers[n]); + /* + * Uses inputData and exponents to build long string + * decimal and integer values and populate bigDecimals and bigIntegers + * accordingly. Attaches a multiplier value as well to the test data. + */ + private static void buildTestData() { + for (String longString1 : inputData) { + for (String longString2 : inputData) { + String bigInteger = longString1 + longString2; + for (int multiplier : multipliers) { + bigIntegers.add(Arguments.of(bigInteger, multiplier)); + bigIntegers.add(Arguments.of('-' + bigInteger, multiplier)); + } + for (String longString3 : inputData) { + for (String longString4 : inputData) { + for (String exponent : exponents) { + String bigDecimal = longString1 + longString2 + '.' + + longString3 + longString4 + exponent; + for (int multiplier : multipliers) { + bigDecimals.add(Arguments.of(bigDecimal, multiplier)); + bigDecimals.add(Arguments.of('-' + bigDecimal, multiplier)); } } } @@ -84,51 +111,70 @@ static private void testBigDecimal() { } } - static private void testBigInteger() { - DecimalFormat df = new DecimalFormat(); - df.setParseBigDecimal(true); - df.setMaximumFractionDigits(Integer.MAX_VALUE); + // Restore JVM default Locale + @AfterAll + static void tearDownAll() { + Locale.setDefault(savedLocale); + } - for (int i = 0; i < input_data.length; i++) { - for (int j = 0; j < input_data.length; j++) { - String s = input_data[i] + input_data[j]; - for (int k = 0; k < multipliers.length; k++) { - test(df, s, multipliers[k]); - test(df, '-'+s, multipliers[k]); - } - } - } + // Tests strings with length 1600+. See test() for specific details. + @ParameterizedTest + @MethodSource("bigDecimalProvider") + public void bigDecimalParseTest(String longString, int multiplier) { + test(longString, multiplier); + } + + // Returns 960 arrangements of bigDecimal string values and multipliers + // In the form of (String, int). + private static Stream bigDecimalProvider() { + return bigDecimals.stream(); + } + + // Tests strings with length 800+. See test() for specific details. + @ParameterizedTest + @MethodSource("bigIntegerProvider") + public void bigIntegerParseTest(String longString, int multiplier) { + test(longString, multiplier); + } + + // Returns 48 arrangements of bigInteger string values and multipliers + // In the form of (String, int). + private static Stream bigIntegerProvider() { + return bigIntegers.stream(); } - static void test(DecimalFormat df, String s, int multiplier) { + /* + * Tests that parsing a large BigDecimal/BigInteger string value + * will not throw a ParseException with setParseBigDecimal as true. + * Parses with a variety of multiplier values. Then ensures that the parsed + * value is the expected number. + */ + private static void test(String longString, int multiplier) { + // Reset DecimalFormat for a clean test + df = new DecimalFormat(); + df.setParseBigDecimal(true); + // wide enough to support the long string test data + df.setMaximumFractionDigits(Integer.MAX_VALUE); df.setMultiplier(multiplier); - Number num = null; - try { - num = df.parse(s); - } - catch (ParseException e) { - err = true; - System.err.println("Failed: Exception occurred: " + e.getMessage()); - return; - } + // Check parse and returned value. This was originally intended to ensure + // a ParseException is not thrown + Number parsedValue = assertDoesNotThrow(()-> df.parse(longString), + "Should not throw an Exception"); + BigDecimal expectedValue = getExpected(longString, multiplier); + assertEquals(expectedValue, parsedValue, "With multiplier: " + multiplier); + } - BigDecimal bd = new BigDecimal(s); + // Utility to get a numerically correct value of a long string. + // Dependent on BigDecimal implementation + private static BigDecimal getExpected(String longString, int multiplier) { + BigDecimal expected = new BigDecimal(longString); try { - bd = bd.divide(new BigDecimal(multiplier)); + expected = expected.divide(new BigDecimal(multiplier)); } catch (ArithmeticException e) { - bd = bd.divide(new BigDecimal(multiplier), RoundingMode.HALF_EVEN); - } - check(num, bd, multiplier); - } - - static void check(Number got, BigDecimal expected, int multiplier) { - if (!got.equals(expected)) { - err = true; - System.err.println("Failed: got:" + got + - ", expected: " + expected + - ", multiplier=" + multiplier); + expected = expected.divide(new BigDecimal(multiplier), RoundingMode.HALF_EVEN); } + return expected; } } diff --git a/test/jdk/java/text/Format/NumberFormat/Bug4208135.java b/test/jdk/java/text/Format/NumberFormat/Bug4208135.java index 1d641226ab7..301b90c89f3 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug4208135.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug4208135.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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,105 +23,164 @@ /* * @test - * @summary Confirm that the decimal separator is shown when explicitly requested. + * @summary Confirm that the decimal separator is shown when explicitly requested + * (or not shown if not requested). Tests against double, long, BigDecimal, + * and BigInteger with a combination of different patterns. * @bug 4208135 + * @run junit Bug4208135 */ -import java.math.*; -import java.text.*; -import java.util.*; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.text.DecimalFormat; +import java.util.Locale; +import java.util.stream.Stream; -public class Bug4208135 { +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; - static DecimalFormat df; +import static org.junit.jupiter.api.Assertions.assertEquals; - static boolean err = false; +public class Bug4208135 { - static public void main(String[] args){ + private static DecimalFormat df; + // Save JVM default Locale + private static final Locale savedLocale = Locale.getDefault(); - Locale defaultLoc = Locale.getDefault(); + // Set JVM default locale to US + @BeforeAll + static void init() { Locale.setDefault(Locale.US); + } - df = new DecimalFormat(); + // Restore JVM default locale + @AfterAll + static void tearDown() { + Locale.setDefault(savedLocale); + } + + // Confirm that decimal separator shown when formatting a number + @ParameterizedTest + @MethodSource("fractionalDigitsWithSeparatorProvider") + public void fractionalDigitsWithSeparatorTest(Number num, String expected) { + df = getDF("0.#E0", true); + String actualFormatted = df.format(num); + assertEquals(expected, actualFormatted, getErrMsg("0.#E0", true)); + } + + // Combination of numbers and a fractional exponent pattern with a separator + private static Stream fractionalDigitsWithSeparatorProvider() { + return Stream.of( + Arguments.of(0.0, "0.E0"), + Arguments.of(10.0, "1.E1"), + Arguments.of(1000.0, "1.E3"), + Arguments.of(0L, "0.E0"), + Arguments.of(10L, "1.E1"), + Arguments.of(1000L, "1.E3"), + Arguments.of(new BigDecimal("0.0"), "0.E0"), + Arguments.of(new BigDecimal("10.0"), "1.E1"), + Arguments.of(new BigDecimal("1000.0"), "1.E3"), + Arguments.of(new BigInteger("00"), "0.E0"), + Arguments.of(new BigInteger("10"), "1.E1"), + Arguments.of(new BigInteger("1000"), "1.E3") + ); + } + + // Confirm that decimal separator not shown when formatting a number + @ParameterizedTest + @MethodSource("fractionalDigitsNoSeparatorProvider") + public void fractionalDigitsNoSeparatorTest(Number num, String expected) { + df = getDF("0.#E0", false); + String actualFormatted = df.format(num); + assertEquals(expected, actualFormatted, getErrMsg("0.#E0", false)); + } - df.applyPattern("0.#E0"); - - df.setDecimalSeparatorAlwaysShown(true); - checkFormat(0.0, "0.E0"); - checkFormat(10.0, "1.E1"); - checkFormat(1000.0, "1.E3"); - checkFormat(0L, "0.E0"); - checkFormat(10L, "1.E1"); - checkFormat(1000L, "1.E3"); - checkFormat(new BigDecimal("0.0"), "0.E0"); - checkFormat(new BigDecimal("10.0"), "1.E1"); - checkFormat(new BigDecimal("1000.0"), "1.E3"); - checkFormat(new BigInteger("00"), "0.E0"); - checkFormat(new BigInteger("10"), "1.E1"); - checkFormat(new BigInteger("1000"), "1.E3"); - - df.setDecimalSeparatorAlwaysShown(false); - checkFormat(0.0, "0E0"); - checkFormat(10.0, "1E1"); - checkFormat(1000.0, "1E3"); - checkFormat(0L, "0E0"); - checkFormat(10L, "1E1"); - checkFormat(1000L, "1E3"); - checkFormat(new BigDecimal("0.0"), "0E0"); - checkFormat(new BigDecimal("10.0"), "1E1"); - checkFormat(new BigDecimal("1000.0"), "1E3"); - checkFormat(new BigInteger("0"), "0E0"); - checkFormat(new BigInteger("10"), "1E1"); - checkFormat(new BigInteger("1000"), "1E3"); - - df.applyPattern("0.###"); - - df.setDecimalSeparatorAlwaysShown(true); - checkFormat(0.0, "0."); - checkFormat(10.0, "10."); - checkFormat(1000.0, "1000."); - checkFormat(0L, "0."); - checkFormat(10L, "10."); - checkFormat(1000L, "1000."); - checkFormat(new BigDecimal("0.0"), "0."); - checkFormat(new BigDecimal("10.0"), "10."); - checkFormat(new BigDecimal("1000.0"), "1000."); - checkFormat(new BigInteger("0"), "0."); - checkFormat(new BigInteger("10"), "10."); - checkFormat(new BigInteger("1000"), "1000."); - - df.setDecimalSeparatorAlwaysShown(false); - checkFormat(0.0, "0"); - checkFormat(10.0, "10"); - checkFormat(1000.0, "1000"); - checkFormat(0L, "0"); - checkFormat(10L, "10"); - checkFormat(1000L, "1000"); - checkFormat(new BigDecimal("0.0"), "0"); - checkFormat(new BigDecimal("10.0"), "10"); - checkFormat(new BigDecimal("1000.0"), "1000"); - checkFormat(new BigInteger("0"), "0"); - checkFormat(new BigInteger("10"), "10"); - checkFormat(new BigInteger("1000"), "1000"); - - Locale.setDefault(defaultLoc); - - if (err) { - throw new RuntimeException("Wrong format/parse with DecimalFormat"); - } + // Combination of numbers and a fractional exponent pattern with no separator + private static Stream fractionalDigitsNoSeparatorProvider() { + return Stream.of( + Arguments.of(0.0, "0E0"), + Arguments.of(10.0, "1E1"), + Arguments.of(1000.0, "1E3"), + Arguments.of(0L, "0E0"), + Arguments.of(10L, "1E1"), + Arguments.of(1000L, "1E3"), + Arguments.of(new BigDecimal("0.0"), "0E0"), + Arguments.of(new BigDecimal("10.0"), "1E1"), + Arguments.of(new BigDecimal("1000.0"), "1E3"), + Arguments.of(new BigInteger("00"), "0E0"), + Arguments.of(new BigInteger("10"), "1E1"), + Arguments.of(new BigInteger("1000"), "1E3") + ); + } + + // Confirm that decimal separator shown when formatting a number + @ParameterizedTest + @MethodSource("noFractionalDigitsWithSeparatorProvider") + public void noFractionalDigitsWithSeparatorTest(Number num, String expected) { + df = getDF("0.###", true); + String actualFormatted = df.format(num); + assertEquals(expected, actualFormatted, getErrMsg("0.###", true)); + } + + // Combination of numbers and a non-fractional exponent pattern with a separator + private static Stream noFractionalDigitsWithSeparatorProvider() { + return Stream.of( + Arguments.of(0.0, "0."), + Arguments.of(10.0, "10."), + Arguments.of(1000.0, "1000."), + Arguments.of(0L, "0."), + Arguments.of(10L, "10."), + Arguments.of(1000L, "1000."), + Arguments.of(new BigDecimal("0.0"), "0."), + Arguments.of(new BigDecimal("10.0"), "10."), + Arguments.of(new BigDecimal("1000.0"), "1000."), + Arguments.of(new BigInteger("00"), "0."), + Arguments.of(new BigInteger("10"), "10."), + Arguments.of(new BigInteger("1000"), "1000.") + ); + } + + // Confirm that decimal separator not shown when formatting a number + @ParameterizedTest + @MethodSource("noFractionalDigitsNoSeparatorProvider") + public void noFractionalDigitsNoSeparatorTest(Number num, String expected) { + df = getDF("0.###", false); + String actualFormatted = df.format(num); + assertEquals(expected, actualFormatted, getErrMsg("0.###", false)); + } + + // Combination of numbers and a non-fractional exponent pattern with no separator + private static Stream noFractionalDigitsNoSeparatorProvider() { + return Stream.of( + Arguments.of(0.0, "0"), + Arguments.of(10.0, "10"), + Arguments.of(1000.0, "1000"), + Arguments.of(0L, "0"), + Arguments.of(10L, "10"), + Arguments.of(1000L, "1000"), + Arguments.of(new BigDecimal("0.0"), "0"), + Arguments.of(new BigDecimal("10.0"), "10"), + Arguments.of(new BigDecimal("1000.0"), "1000"), + Arguments.of(new BigInteger("00"), "0"), + Arguments.of(new BigInteger("10"), "10"), + Arguments.of(new BigInteger("1000"), "1000") + ); + } + + // Creates clean DF and sets the pattern and separatorShown value + private static DecimalFormat getDF(String pattern, boolean separatorShown) { + df = new DecimalFormat(); + df.applyPattern(pattern); + df.setDecimalSeparatorAlwaysShown(separatorShown); + return df; } - static void checkFormat(Number num, String expected) { - String got = df.format(num); - if (!got.equals(expected)) { - err = true; - System.err.println(" DecimalFormat format(" + - num.getClass().getName() + - ") error:" + - "\n\tnumber: " + num + - "\n\tSeparatorShown? : " + df.isDecimalSeparatorAlwaysShown() + - "\n\tgot: " + got + - "\n\texpected: " + expected); - } + // Utility to get a helpful error message when values are not as expected + private static String getErrMsg(String pattern, boolean separatorShown) { + return String.format("Fails with pattern= %s, with separatorShown = %s", + pattern, separatorShown); } } diff --git a/test/jdk/java/text/Format/NumberFormat/Bug4838107.java b/test/jdk/java/text/Format/NumberFormat/Bug4838107.java index 72cad141174..8d6d2c25a62 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug4838107.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug4838107.java @@ -24,225 +24,260 @@ /* * @test * @bug 4838107 8008577 - * @summary Confirm that DecimalFormat can format a number with negative exponent number correctly. + * @summary Confirm that DecimalFormat can format a number with a negative + * exponent number correctly. Tests also involve using a DecimalFormat + * with a custom pattern or a custom minus sign. * @library /java/text/testlib - * @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug4838107 + * @run junit/othervm -Djava.locale.providers=COMPAT,SPI Bug4838107 */ -import java.math.*; -import java.util.*; -import java.text.*; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; +import java.util.stream.Stream; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +/* + * This bug is about exponential formatting. But I added test cases for: + * - Double and BigDecimal numbers which don't have exponent parts. + * - Long and BigInteger numbers which don't support exponential + * notation. + * because there are few test cases for suffix and prefix. + * And also, I added test cases to guarantee further formatting and + * parsing using the same DecimalFormat instance will not change the + * Number's value anymore. + */ public class Bug4838107 extends IntlTest { - static DecimalFormat df; - static DecimalFormatSymbols dfs; - static boolean err = false; + // Save JVM default Locale + private static final Locale savedLocale = Locale.getDefault(); - static public void main(String[] args) { - Locale defaultLoc = Locale.getDefault(); + // Set JVM default Locale to US + @BeforeAll + static void init() { Locale.setDefault(Locale.US); - - /** - * This bug is about exponential formatting. But I added test cases for: - * - Double and BigDecimal numbers which don't have exponent parts. - * - Long and BigInteger numbers which don't support exponential - * notation. - * because there are few test cases for suffix and prefix. - * And also, I added test cases to guarantee further formatting and - * parsing using the same DecimalFormat instance will not change the - * Number's value anymore. - */ - - test_double(); - test_long(); - test_BigDecimal(); - test_BigInteger(); - - Locale.setDefault(defaultLoc); - - if (err) { - throw new RuntimeException("Wrong format with DecimalFormat"); - } } - static void test_double() { - df = new DecimalFormat(); - dfs = df.getDecimalFormatSymbols(); - - /* Test with default pattern */ - test(1234D, "1,234"); - test(0.1234, "0.123"); // rounded - test(-1234D, "-1,234"); - test(-0.1234, "-0.123"); // rounded - - test(Double.POSITIVE_INFINITY, "\u221e"); - test(Double.NEGATIVE_INFINITY, "-\u221e"); - test(Double.NaN, "\ufffd"); // without prefix and suffix - test(0.0, "0"); - test(-0.0, "-0"); // with the minus sign - - /* Specify a pattern and the minus sign. */ - prepareFormatter("

#.###E00", 'm'); - test(1234D, "

1.234E03"); - test(0.1234, "

1.234Em01"); - test(-1234D, "m

1.234E03"); - test(-0.1234, "m

1.234Em01"); - - prepareFormatter("

#.###E00;#.###E00", 'm'); - test(1234D, "

1.234E03"); - test(0.1234, "

1.234Em01"); - test(-1234D, "1.234E03"); - test(-0.1234, "1.234Em01"); - - prepareFormatter("#.###E00;

#.###E00", 'm'); - test(1234D, "1.234E03"); - test(0.1234, "1.234Em01"); - test(-1234D, "

1.234E03"); - test(-0.1234, "

1.234Em01"); - - prepareFormatter("

#.###E00;

-#.###E00", 'm'); - test(1234D, "

1.234E03"); - test(0.1234, "

1.234Em01"); - test(-1234D, "

m1.234E03"); - test(-0.1234, "

m1.234Em01"); - - test(Double.POSITIVE_INFINITY, "

\u221e"); - test(Double.NEGATIVE_INFINITY, "

m\u221e"); - test(Double.NaN, "\ufffd"); // without prefix and suffix - test(0.0, "

0E00"); - test(-0.0, "

m0E00"); // with the minus sign + // Restore the original JVM default locale + @AfterAll + static void tearDown() { + Locale.setDefault(savedLocale); } - static void test_BigDecimal() { - df = new DecimalFormat(); - dfs = df.getDecimalFormatSymbols(); - - /* Test with default pattern */ - test(new BigDecimal("123456789012345678901234567890"), - "123,456,789,012,345,678,901,234,567,890"); - test(new BigDecimal("0.000000000123456789012345678901234567890"), - "0"); - test(new BigDecimal("-123456789012345678901234567890"), - "-123,456,789,012,345,678,901,234,567,890"); - test(new BigDecimal("-0.000000000123456789012345678901234567890"), - "-0"); - - test(new BigDecimal("0"), "0"); - test(new BigDecimal("-0"), "0"); - - /* Specify a pattern and the minus sign. */ - prepareFormatter("

#.####################E00;

-#.####################E00", 'm'); - test(new BigDecimal("123456789012345678901234567890"), - "

1.23456789012345678901E29"); - test(new BigDecimal("0.000000000123456789012345678901234567890"), - "

1.23456789012345678901Em10"); - test(new BigDecimal("-123456789012345678901234567890"), - "

m1.23456789012345678901E29"); - test(new BigDecimal("-0.000000000123456789012345678901234567890"), - "

m1.23456789012345678901Em10"); - - test(new BigDecimal("0"), "

0E00"); - test(new BigDecimal("-0"), "

0E00"); + // Check that negative exponent number recognized for doubles + @ParameterizedTest + @MethodSource("doubles") + public void doubleTest(Number num, String str, DecimalFormat df) { + test(num, str, df); } - static void test_long() { - df = new DecimalFormat(); - dfs = df.getDecimalFormatSymbols(); - - /* Test with default pattern */ - test(123456789L, "123,456,789"); - test(-123456789L, "-123,456,789"); - - test(0L, "0"); - test(-0L, "0"); - - /* Specify a pattern and the minus sign. */ - prepareFormatter("

#,###;

-#,###", 'm'); - test(123456789L, "

123,456,789"); - test(-123456789L, "

m123,456,789"); - - test(0L, "

0"); - test(-0L, "

0"); + // Provides a double to be formatted, which is compared to the expected String. + // Additionally, provides a DecimalFormat to do the formatting (can have a custom + // pattern and minus sign). Given in the form (double, String, DecimalFormat). + private static Stream doubles() { + DecimalFormat defaultDf = new DecimalFormat(); + DecimalFormat customDf1 = getDecimalFormat("

#.###E00", 'm'); + DecimalFormat customDf2 = getDecimalFormat("

#.###E00;#.###E00", 'm'); + DecimalFormat customDf3 = getDecimalFormat("#.###E00;

#.###E00", 'm'); + DecimalFormat customDf4 = getDecimalFormat("

#.###E00;

-#.###E00", 'm'); + return Stream.of( + // Test with default pattern + Arguments.of(1234D, "1,234", defaultDf), + Arguments.of(0.1234, "0.123", defaultDf), // rounded + Arguments.of(-1234D, "-1,234", defaultDf), + Arguments.of(-0.1234, "-0.123", defaultDf), // rounded + Arguments.of(Double.POSITIVE_INFINITY, "\u221e", defaultDf), + Arguments.of(Double.NEGATIVE_INFINITY, "-\u221e", defaultDf), + Arguments.of(Double.NaN, "\ufffd", defaultDf), // without prefix and suffix + Arguments.of(0.0, "0", defaultDf), + Arguments.of(-0.0, "-0", defaultDf), // with the minus sign + // Test with a pattern and the minus sign + Arguments.of(1234D, "

1.234E03", customDf1), + Arguments.of(0.1234, "

1.234Em01", customDf1), + Arguments.of(-1234D, "m

1.234E03", customDf1), + Arguments.of(-0.1234, "m

1.234Em01", customDf1), + Arguments.of(1234D, "

1.234E03", customDf2), + Arguments.of(0.1234, "

1.234Em01", customDf2), + Arguments.of(-1234D, "1.234E03", customDf2), + Arguments.of(-0.1234, "1.234Em01", customDf2), + Arguments.of(1234D, "1.234E03", customDf3), + Arguments.of(0.1234, "1.234Em01", customDf3), + Arguments.of(-1234D, "

1.234E03", customDf3), + Arguments.of(-0.1234, "

1.234Em01", customDf3), + Arguments.of(1234D, "

1.234E03", customDf4), + Arguments.of(0.1234, "

1.234Em01", customDf4), + Arguments.of(-1234D, "

m1.234E03", customDf4), + Arguments.of(-0.1234, "

m1.234Em01", customDf4), + Arguments.of(Double.POSITIVE_INFINITY, "

\u221e", customDf4), + Arguments.of(Double.NEGATIVE_INFINITY, "

m\u221e", customDf4), + Arguments.of(Double.NaN, "\ufffd", customDf4), // without prefix and suffix + Arguments.of(0.0, "

0E00", customDf4), + Arguments.of(-0.0, "

m0E00", customDf4) // with the minus sign + ); } - static void test_BigInteger() { - df = new DecimalFormat(); - dfs = df.getDecimalFormatSymbols(); + // Check that negative exponent number recognized for longs + @ParameterizedTest + @MethodSource("longs") + public void longTest(Number num, String str, DecimalFormat df) { + test(num, str, df); + } - /* Test with default pattern */ - test(new BigInteger("123456789012345678901234567890"), - "123,456,789,012,345,678,901,234,567,890"); - test(new BigInteger("-123456789012345678901234567890"), - "-123,456,789,012,345,678,901,234,567,890"); + // Same as doubles() data provider, but with long values + // Given in the form (long, String, DecimalFormat). + private static Stream longs() { + DecimalFormat defaultDf = new DecimalFormat(); + DecimalFormat customDf = getDecimalFormat( + "

#,###;

-#,###", 'm'); + return Stream.of( + // Test with default pattern + Arguments.of(123456789L, "123,456,789", defaultDf), + Arguments.of(-123456789L, "-123,456,789", defaultDf), + Arguments.of(0L, "0", defaultDf), + Arguments.of(-0L, "0", defaultDf), + // Test with a pattern and the minus sign + Arguments.of(123456789L, "

123,456,789", customDf), + Arguments.of(-123456789L, "

m123,456,789", customDf), + Arguments.of(0L, "

0", customDf), + Arguments.of(-0L, "

0", customDf) + ); + } - test(new BigInteger("0"), "0"); - test(new BigInteger("-0"), "0"); + // Check that negative exponent number recognized for bigDecimals + @ParameterizedTest + @MethodSource("bigDecimals") + public void bigDecimalTest(Number num, String str, DecimalFormat df) { + test(num, str, df); + } - /* Specify a pattern and the minus sign. */ - prepareFormatter("

#,###;

-#,###", 'm'); - test(new BigInteger("123456789012345678901234567890"), - "

123,456,789,012,345,678,901,234,567,890"); - test(new BigInteger("-123456789012345678901234567890"), - "

m123,456,789,012,345,678,901,234,567,890"); + // Same as doubles() data provider, but with BigDecimal values + // Given in the form (BigDecimal, String, DecimalFormat). + private static Stream bigDecimals() { + DecimalFormat defaultDf = new DecimalFormat(); + DecimalFormat customDf = getDecimalFormat( + "

#.####################E00;

-#.####################E00", 'm'); + return Stream.of( + // Test with default pattern + Arguments.of(new BigDecimal("123456789012345678901234567890"), + "123,456,789,012,345,678,901,234,567,890", defaultDf), + Arguments.of(new BigDecimal("0.000000000123456789012345678901234567890"), + "0", defaultDf), + Arguments.of(new BigDecimal("-123456789012345678901234567890"), + "-123,456,789,012,345,678,901,234,567,890", defaultDf), + Arguments.of(new BigDecimal("-0.000000000123456789012345678901234567890"), + "-0", defaultDf), + Arguments.of(new BigDecimal("0"), "0", defaultDf), + Arguments.of(new BigDecimal("-0"), "0", defaultDf), + // Test with a pattern and the minus sign + Arguments.of(new BigDecimal("123456789012345678901234567890"), + "

1.23456789012345678901E29", customDf), + Arguments.of(new BigDecimal("0.000000000123456789012345678901234567890"), + "

1.23456789012345678901Em10", customDf), + Arguments.of(new BigDecimal("-123456789012345678901234567890"), + "

m1.23456789012345678901E29", customDf), + Arguments.of(new BigDecimal("-0.000000000123456789012345678901234567890"), + "

m1.23456789012345678901Em10", customDf), + Arguments.of(new BigDecimal("0"), "

0E00", customDf), + Arguments.of(new BigDecimal("-0"), "

0E00", customDf) + ); + } - test(new BigInteger("0"), "

0"); - test(new BigInteger("-0"), "

0"); + // Check that negative exponent number recognized for bigIntegers + @ParameterizedTest + @MethodSource("bigIntegers") + public void bigIntegerTest(Number num, String str, DecimalFormat df) { + test(num, str, df); } - static void prepareFormatter(String pattern, char minusSign) { - dfs = df.getDecimalFormatSymbols(); - df.applyPattern(pattern); - dfs.setMinusSign(minusSign); - df.setDecimalFormatSymbols(dfs); + // Same as doubles() data provider, but with BigInteger values + // Given in the form (BigInteger, String, DecimalFormat). + private static Stream bigIntegers() { + DecimalFormat defaultDf = new DecimalFormat(); + DecimalFormat customDf = getDecimalFormat( + "

#,###;

-#,###", 'm'); + return Stream.of( + // Test with default pattern + Arguments.of(new BigInteger("123456789012345678901234567890"), + "123,456,789,012,345,678,901,234,567,890", defaultDf), + Arguments.of(new BigInteger("-123456789012345678901234567890"), + "-123,456,789,012,345,678,901,234,567,890", defaultDf), + Arguments.of(new BigInteger("0"), "0", defaultDf), + Arguments.of(new BigInteger("-0"), "0", defaultDf), + // Test with a pattern and the minus sign + Arguments.of(new BigInteger("123456789012345678901234567890"), + "

123,456,789,012,345,678,901,234,567,890", customDf), + Arguments.of(new BigInteger("-123456789012345678901234567890"), + "

m123,456,789,012,345,678,901,234,567,890", customDf), + Arguments.of(new BigInteger("0"), "

0", customDf), + Arguments.of(new BigInteger("-0"), "

0", customDf) + ); } - static void test(Number num, String str) { + // Check that the formatted value is correct and also check that + // it can be round-tripped via parse() and format() + private static void test(Number num, String str, DecimalFormat df) { String formatted = df.format(num); - if (!formatted.equals(str)) { - err = true; - System.err.println(" DecimalFormat format(" + - num.getClass().getName() + - ") error: \n\tnumber: " + num + - "\n\tminus sign: " + dfs.getMinusSign() + - "\n\tgot: " + formatted + - "\n\texpected: " + str); - return; - } + assertEquals(str, formatted, String.format("DecimalFormat format(%s) " + + "Error: number: %s, minus sign: %s", num.getClass().getName(), num, df.getDecimalFormatSymbols().getMinusSign())); if (num instanceof BigDecimal || num instanceof BigInteger) { df.setParseBigDecimal(true); } + testRoundTrip(formatted, str, num, df); + } + + // Test that a parsed value can be round-tripped via format() and parse() + private static void testRoundTrip(String formatted, String str, + Number num, DecimalFormat df) { Number parsed1 = null, parsed2 = null; try { parsed1 = df.parse(formatted); formatted = df.format(parsed1); parsed2 = df.parse(formatted); - if (!parsed1.equals(parsed2)) { - err = true; - System.err.println(" DecimalFormat roundtrip parse(" + - num.getClass().getName() + - ") error: \n\toriginal number: " + str + - "\n\tparsed number: " + parsed1 + - " (" + parsed1.getClass().getName() + ")" + - "\n\tformatted number: " + formatted + - "\n\tre-parsed number: " + parsed2 + - " (" + parsed2.getClass().getName() + ")" + - "\n\tminus sign: " + dfs.getMinusSign()); - } + assertEquals(parsed2, parsed1, """ + DecimalFormat round trip parse(%s) error: + original number: %s + parsed number: %s + (%s) + formatted number: %s + re-parsed number: %s + (%s) + minus sign: %s + """.formatted(num.getClass().getName(), str, parsed1, parsed1.getClass().getName(), + formatted, parsed2, parsed2.getClass().getName(), df.getDecimalFormatSymbols().getMinusSign())); } catch (Exception e) { - err = true; - System.err.println(" DecimalFormat parse(" + - num.getClass().getName() + - ") threw an Exception: " + e.getMessage() + - "\n\toriginal number: " + str + - "\n\tparsed number : " + parsed1 + - " (" + parsed1.getClass().getName() + ")" + - "\n\tformatted number: " + formatted + - "\n\tre-parsed number: " + parsed2 + - " (" + parsed2.getClass().getName() + ")" + - "\n\tminus sign: " + dfs.getMinusSign()); + fail(""" + DecimalFormat parse(%s) threw an Exception: %s + original number: %s + parsed number: %s + (%s) + formatted number: %s + re-parsed number: %s + (%s) + minus sign: %s + """.formatted(num.getClass().getName(), e.getMessage(), str, parsed1, parsed1.getClass().getName(), + formatted, parsed2, parsed2.getClass().getName(), df.getDecimalFormatSymbols().getMinusSign())); } } + + // Set up custom DecimalFormat with DecimalFormatSymbols + private static DecimalFormat getDecimalFormat(String pattern, char minusSign) { + DecimalFormat df = new DecimalFormat(); + DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); + df.applyPattern(pattern); + dfs.setMinusSign(minusSign); + df.setDecimalFormatSymbols(dfs); + return df; + } } diff --git a/test/jdk/java/text/Format/NumberFormat/Bug4944439.java b/test/jdk/java/text/Format/NumberFormat/Bug4944439.java index 0e85a98119d..561052e9a95 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug4944439.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug4944439.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -25,87 +25,97 @@ * @test * @bug 4944439 * @summary Confirm that numbers where all digits after the decimal separator are 0 - * and which are between Long.MIN_VALUE and Long.MAX_VALUE are returned as Long(not double). + * and which are between Long.MIN_VALUE and Long.MAX_VALUE are returned + * as Long(not double). + * @run junit Bug4944439 */ -import java.math.BigDecimal; -import java.math.BigInteger; import java.text.DecimalFormat; +import java.util.ArrayList; import java.util.Locale; +import java.util.stream.Stream; -public class Bug4944439 { - - static boolean err = false; - static DecimalFormat df; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; - public static void main(String[] args) throws Exception { - - Locale defaultLoc = Locale.getDefault(); - Locale.setDefault(Locale.US); +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; - df = new DecimalFormat(); - String s = "-9223372036854775809"; // Long.MIN_VALUE-1 - check_Double(s); +public class Bug4944439 { - test(Long.MIN_VALUE, Long.MIN_VALUE+10); - test(-10, 10); - test(Long.MAX_VALUE-10, Long.MAX_VALUE-1); + // Save JVM default locale + private static final Locale savedLocale = Locale.getDefault(); + private static final DecimalFormat df = new DecimalFormat(); - s = "9223372036854775807.00"; // Long.MAX_VALUE - check_Long(s); - s = "9223372036854775808"; // Long.MAX_VALUE+1 - check_Double(s); + // Set JVM default locale to US for testing + @BeforeAll + static void initAll() { + Locale.setDefault(Locale.US); + } - s = "-0.0"; - check_Double(s); - s = "0.0"; - check_Long(s); + // Restore JVM default locale + @AfterAll + static void tearDownAll() { + Locale.setDefault(savedLocale); + } - Locale.setDefault(defaultLoc); + // Check return type and value returned by DecimalFormat.parse() for longs + @ParameterizedTest + @MethodSource("longs") + public void parseLongTest(String s) { + // This was originally intended to ensure a ParseException is not thrown + Number parsedNumber = assertDoesNotThrow(() -> df.parse(s), + "DecimalFormat.parse(\"%s\") should not throw an Exception"); + assertInstanceOf(Long.class, parsedNumber, + "DecimalFormat.parse(\"%s\") did not return Long"); + // Grab integer portion of value + Long expectedVal = Long.valueOf(s.substring(0, s.indexOf('.'))); + assertEquals(parsedNumber, expectedVal, + "DecimalFormat.parse(\"%s\") returned numerically incorrect value"); + } - if (err) { - throw new RuntimeException("Wrong parsing with DecimalFormat"); - } + // Test some values between Long.MIN_VALUE and Long.MAX_VALUE + private static Stream longs() { + ArrayList longs = new ArrayList<>(); + addLongData(Long.MIN_VALUE, Long.MIN_VALUE+10, longs); + addLongData(-10, 10, longs); + addLongData(Long.MAX_VALUE-10, Long.MAX_VALUE-1, longs); + longs.add("9223372036854775807.00"); + longs.add("0.0"); + return longs.stream(); } - private static void test(long from, long to) throws Exception { + // Utility to add values between parameters(long, to) to testLongs ArrayList + private static void addLongData(long from, long to, ArrayList testLongs){ for (long l = from; l <= to; l++) { - check_Long(Long.toString(l) + ".00"); + testLongs.add(l + ".00"); } } - private static void check_Long(String s) throws Exception { - Number number = df.parse(s); - if (!(number instanceof Long)) { - err = true; - System.err.println("Failed: DecimalFormat.parse(\"" + s + - "\") should return a Long, but returned a " + - number.getClass().getName()); - } - - int index = s.indexOf('.'); - Long l = Long.valueOf(s.substring(0, index)); - if (!l.equals(number)) { - err = true; - System.err.println("Failed: DecimalFormat.parse(" + s + - ") should return a Long(" + l + "), but returned " + number); - } + // Check return type and value returned by DecimalFormat.parse() for doubles + @ParameterizedTest + @MethodSource("doubles") + public void parseDoubleTest(String s) { + // This was originally intended to ensure a ParseException is not thrown + Number parsedNumber = assertDoesNotThrow(() -> df.parse(s), + "DecimalFormat.parse(\"%s\") should not throw an Exception"); + assertInstanceOf(Double.class, parsedNumber, + "DecimalFormat.parse(\"%s\") did not return Double"); + Double expectedVal = Double.valueOf(s); + assertEquals(parsedNumber, expectedVal, + "DecimalFormat.parse(\"%s\") returned numerically incorrect value"); } - private static void check_Double(String s) throws Exception { - Number number = df.parse(s); - if (!(number instanceof Double)) { - err = true; - System.err.println("Failed: DecimalFormat.parse(\"" + s + - "\") should return a Double, but returned a " + - number.getClass().getName()); - } - - Double d = Double.valueOf(s); - if (!d.equals(number)) { - err = true; - System.err.println("Failed: DecimalFormat.parse(" + s + - ") should return a Double(" + d + "), but returned " + number); - } + // Check values not between Long.MIN_VALUE and Long.MAX_VALUE + private static Stream doubles() { + return Stream.of( + "-9223372036854775809", // Long.MIN_VALUE-1 + "9223372036854775808", // Long.MAX_VALUE+1 + "-0.0" + ); } } diff --git a/test/jdk/java/text/Format/NumberFormat/Bug4990596.java b/test/jdk/java/text/Format/NumberFormat/Bug4990596.java index 2b311fb1b5f..36c0259ae56 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug4990596.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug4990596.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, 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 @@ -21,20 +21,32 @@ * questions. */ -/** +/* * @test * @bug 4990596 - * @summary Make sure that any subclass of Number can be formatted using DecimalFormat.format(). + * @summary Make sure that any subclass of Number can be formatted using + * DecimalFormat.format() without throwing an exception. + * @run junit Bug4990596 */ import java.text.DecimalFormat; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + public class Bug4990596 { - public static void main(String[] args) { - new DecimalFormat().format(new MutableInteger(0)); + // Test that a custom subclass of Number can be formatted by + // DecimalFormat without throwing an IllegalArgumentException + @Test + public void formatSubclassedNumberTest() { + assertDoesNotThrow(() -> new DecimalFormat().format(new MutableInteger(0)), + "DecimalFormat.format() should support subclasses of Number"); } + // A custom subclass of Number. Prior to this fix, if an instance of this + // class was formatted by DecimalFormat, an exception would be thrown. @SuppressWarnings("serial") public static class MutableInteger extends Number { public int value; diff --git a/test/jdk/java/text/Format/NumberFormat/Bug6278616.java b/test/jdk/java/text/Format/NumberFormat/Bug6278616.java index b1684b4d177..8f9fc7ca52d 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug6278616.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug6278616.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2023, 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 @@ -24,46 +24,55 @@ /* * @test * @summary Confirm that AtomicInteger and AtomicLong are formatted correctly. + * That is, make sure they are not treated as a double when formatted + * anymore (which can result in the loss of precision). * @bug 6278616 + * @run junit Bug6278616 */ import java.text.NumberFormat; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import java.util.Locale; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class Bug6278616 { - static final int[] ints = { - Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE - }; + private static final NumberFormat nf = NumberFormat.getInstance(); - static final long[] longs = { - Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE - }; + // Test that NumberFormat formats numerically equivalent int + // and AtomicInteger values the same + @ParameterizedTest + @MethodSource("ints") + public void formattedAtomicIntTest(int testInt) { + String formattedInt = nf.format(testInt); + String formattedAtomicInt = nf.format(new AtomicInteger(testInt)); + assertEquals(formattedAtomicInt, formattedInt, "Formatting numerically" + + " equivalent AtomicInteger and int should produce the same String value"); + } - public static void main(String[] args) { - NumberFormat nf = NumberFormat.getInstance(); + // Various int values + private static int[] ints() { + return new int[] { Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE}; + } - for (int j = 0; j < ints.length; j++) { - String s_i = nf.format(ints[j]); - String s_ai = nf.format(new AtomicInteger(ints[j])); - if (!s_i.equals(s_ai)) { - throw new RuntimeException("format(AtomicInteger " + s_ai + - ") doesn't equal format(Integer " + - s_i + ")"); - } - } + // Test that NumberFormat formats numerically equivalent long + // and AtomicLong values the same + @ParameterizedTest + @MethodSource("longs") + public void formattedAtomicLongTest(long testLong) { + String formattedLong = nf.format(testLong); + String formattedAtomicLong = nf.format(new AtomicLong(testLong)); + assertEquals(formattedAtomicLong, formattedLong, "Formatting numerically" + + " equivalent AtomicLong and long should produce the same String value"); + } - for (int j = 0; j < longs.length; j++) { - String s_l = nf.format(longs[j]); - String s_al = nf.format(new AtomicLong(longs[j])); - if (!s_l.equals(s_al)) { - throw new RuntimeException("format(AtomicLong " + s_al + - ") doesn't equal format(Long " + - s_l + ")"); - } - } + // Various long values + private static long[] longs() { + return new long[] { Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE}; } } diff --git a/test/jdk/java/text/Format/NumberFormat/Bug8132125.java b/test/jdk/java/text/Format/NumberFormat/Bug8132125.java index 9c02ad44f78..edd1d3c5bcd 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug8132125.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug8132125.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -26,20 +26,27 @@ * @bug 8132125 8202537 * @summary Checks Swiss' number elements * @modules jdk.localedata + * @run junit Bug8132125 */ -import java.text.*; -import java.util.*; +import java.text.NumberFormat; +import java.util.Locale; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class Bug8132125 { - public static void main(String[] args) { + + // Ensure the CLDRConverter does not omit the Swiss number elements + @Test + public void swissNumElementsTest() { Locale deCH = new Locale("de", "CH"); NumberFormat nf = NumberFormat.getInstance(deCH); - String expected = "54\u2019839\u2019483.142"; // i.e. "\u2019" as decimal separator, "\u2019" as grouping separator + // "\u002E" as decimal separator, "\u2019" as grouping separator + String expected = "54\u2019839\u2019483.142"; String actual = nf.format(54839483.1415); - if (!actual.equals(expected)) { - throw new RuntimeException("incorrect for de_CH: " + expected + " vs. actual " + actual); - } + assertEquals(expected, actual, "incorrect number elements for de_CH"); } } diff --git a/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java b/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java index c25a6d88b26..2eb01c3e403 100644 --- a/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java +++ b/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java @@ -25,13 +25,17 @@ * @test * @bug 4290801 4942982 5102005 8008577 8021121 8210153 8227313 * @summary Basic tests for currency formatting. + * Tests both COMPAT and CLDR data. * @modules jdk.localedata - * @run main/othervm -Djava.locale.providers=COMPAT CurrencyFormat COMPAT - * @run main/othervm -Djava.locale.providers=CLDR CurrencyFormat CLDR + * @run junit/othervm -Djava.locale.providers=COMPAT CurrencyFormat + * @run junit/othervm -Djava.locale.providers=CLDR CurrencyFormat */ import java.io.File; import java.io.FileInputStream; +import java.io.IOException; +import java.text.ParseException; +import java.util.ArrayList; import java.util.Currency; import java.util.Locale; import java.util.Properties; @@ -40,126 +44,139 @@ import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.text.SimpleDateFormat; +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class CurrencyFormat { - private static boolean isCompat; + // Expected data is switched depending on COMPAT or CLDR + // currencySymbolsTest() is only ran for COMPAT + private static final boolean isCompat = + "COMPAT".equals(System.getProperty("java.locale.providers")); - public static void main(String[] args) throws Exception { - isCompat = "COMPAT".equals(args[0]); - testFormatting(); - testSymbols(); + // Tests the formatting of data for COMPAT + CLDR under various currencies + // Using a NumberFormat generated by getCurrencyInstance() + @ParameterizedTest + @MethodSource("currencyFormatDataProvider") + public void currencyFormatTest(String expected, Currency currency, + NumberFormat format, Locale locale) { + if (currency != null) { + format.setCurrency(currency); + int digits = currency.getDefaultFractionDigits(); + format.setMinimumFractionDigits(digits); + format.setMaximumFractionDigits(digits); + } + String result = format.format(1234.56); + assertEquals(expected, result, String.format("Failed with locale: %s%s", + locale, (currency == null ? ", default currency" : (", currency: " + currency)))); } - static void testFormatting() { - boolean failed = false; + // Generate a combination of expected data for 1234.56 formatted + // under various currencies/locale provider/locale + private static Stream currencyFormatDataProvider() { + ArrayList data = new ArrayList(); Locale[] locales = { - Locale.US, - Locale.JAPAN, - Locale.GERMANY, - Locale.ITALY, - new Locale("it", "IT", "EURO"), - Locale.forLanguageTag("de-AT"), - Locale.forLanguageTag("fr-CH"), + Locale.US, + Locale.JAPAN, + Locale.GERMANY, + Locale.ITALY, + new Locale("it", "IT", "EURO"), + Locale.forLanguageTag("de-AT"), + Locale.forLanguageTag("fr-CH"), }; Currency[] currencies = { - null, - Currency.getInstance("USD"), - Currency.getInstance("JPY"), - Currency.getInstance("DEM"), - Currency.getInstance("EUR"), + null, + Currency.getInstance("USD"), + Currency.getInstance("JPY"), + Currency.getInstance("DEM"), + Currency.getInstance("EUR"), }; - String[][] expecteds = { - {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"}, - {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"}, - {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"}, - {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"}, - {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"}, - {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"}, - {"SFr. 1'234.56", "USD 1'234.56", "JPY 1'235", "DEM 1'234.56", "EUR 1'234.56"}, + String[][] expectedCOMPATData = { + {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"}, + {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"}, + {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"}, + {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"}, + {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"}, + {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"}, + {"SFr. 1'234.56", "USD 1'234.56", "JPY 1'235", "DEM 1'234.56", "EUR 1'234.56"}, }; - String[][] expecteds_cldr = { - {"$1,234.56", "$1,234.56", "\u00a51,235", "DEM1,234.56", "\u20ac1,234.56"}, - {"\uFFE51,235", "$1,234.56", "\uFFE51,235", "DEM1,234.56", "\u20ac1,234.56"}, - {"1.234,56\u00a0\u20ac", "1.234,56\u00a0$", "1.235\u00a0\u00a5", "1.234,56\u00a0DM", "1.234,56\u00a0\u20ac"}, - {"1.234,56\u00a0\u20ac", "1.234,56\u00a0USD", "1.235\u00a0JPY", "1.234,56\u00a0DEM", "1.234,56\u00a0\u20ac"}, - {"1.234,56\u00a0\u20ac", "1.234,56\u00a0USD", "1.235\u00a0JPY", "1.234,56\u00a0DEM", "1.234,56\u00a0\u20ac"}, - {"\u20ac\u00a01.234,56", "$\u00a01.234,56", "\u00a5\u00a01.235", "DM\u00a01.234,56", "\u20ac\u00a01.234,56"}, - {"1\u202f234.56\u00a0CHF", "1\u202f234.56\u00a0$US", "1\u202f235\u00a0JPY", "1\u202f234.56\u00a0DEM", "1\u202f234.56\u00a0\u20ac"}, + String[][] expectedCLDRData = { + {"$1,234.56", "$1,234.56", "\u00a51,235", "DEM1,234.56", "\u20ac1,234.56"}, + {"\uFFE51,235", "$1,234.56", "\uFFE51,235", "DEM1,234.56", "\u20ac1,234.56"}, + {"1.234,56\u00a0\u20ac", "1.234,56\u00a0$", "1.235\u00a0\u00a5", "1.234,56\u00a0DM", "1.234,56\u00a0\u20ac"}, + {"1.234,56\u00a0\u20ac", "1.234,56\u00a0USD", "1.235\u00a0JPY", "1.234,56\u00a0DEM", "1.234,56\u00a0\u20ac"}, + {"1.234,56\u00a0\u20ac", "1.234,56\u00a0USD", "1.235\u00a0JPY", "1.234,56\u00a0DEM", "1.234,56\u00a0\u20ac"}, + {"\u20ac\u00a01.234,56", "$\u00a01.234,56", "\u00a5\u00a01.235", "DM\u00a01.234,56", "\u20ac\u00a01.234,56"}, + {"1\u202f234.56\u00a0CHF", "1\u202f234.56\u00a0$US", "1\u202f235\u00a0JPY", "1\u202f234.56\u00a0DEM", "1\u202f234.56\u00a0\u20ac"}, }; - for (int i = 0; i < locales.length; i++) { Locale locale = locales[i]; NumberFormat format = NumberFormat.getCurrencyInstance(locale); for (int j = 0; j < currencies.length; j++) { Currency currency = currencies[j]; - String expected = isCompat ? expecteds[i][j] : expecteds_cldr[i][j]; - if (currency != null) { - format.setCurrency(currency); - int digits = currency.getDefaultFractionDigits(); - format.setMinimumFractionDigits(digits); - format.setMaximumFractionDigits(digits); - } - String result = format.format(1234.56); - if (!result.equals(expected)) { - failed = true; - System.out.println("FAIL: Locale " + locale - + (currency == null ? ", default currency" : (", currency: " + currency)) - + ", expected: " + expected - + ", actual: " + result); - } + String expected = isCompat ? expectedCOMPATData[i][j] : expectedCLDRData[i][j]; + data.add(Arguments.of(expected, currency, format, locale)); } } - - if (failed) { - throw new RuntimeException(); - } + return data.stream(); } - static void testSymbols() throws Exception { + // Compares the expected currency symbol of a locale to the value returned by + // DecimalFormatSymbols.getCurrencySymbol(). + @ParameterizedTest + @MethodSource("currencySymbolsDataProvider") + public void currencySymbolsTest(String expected, Locale locale) throws ParseException { if (!isCompat) { - // For COMPAT only. - return; + return; // For COMPAT only. } + if (expected == null) { + System.out.println("Warning: No expected currency symbol defined for locale " + locale); + } else { + // Reserved for when a currency will change its symbol at a given time in the future + if (expected.contains(";")) { + expected = getFutureSymbol(expected); + } + DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); + String result = symbols.getCurrencySymbol(); + assertEquals(expected, result, "Wrong currency symbol for locale " + + locale + ", expected: " + expected + ", got: " + result); + } + } - FileInputStream stream = new FileInputStream(new File(System.getProperty("test.src", "."), "CurrencySymbols.properties")); + // Grabs the custom CurrencySymbols.properties and loads the file into a Properties + // instance. Building the data set, which consists of the currency symbol for the locale. + private static Stream currencySymbolsDataProvider() throws IOException { + ArrayList data = new ArrayList(); + FileInputStream stream = new FileInputStream(new File( + System.getProperty("test.src", "."), "CurrencySymbols.properties")); Properties props = new Properties(); props.load(stream); - SimpleDateFormat format = null; - Locale[] locales = NumberFormat.getAvailableLocales(); - for (int i = 0; i < locales.length; i++) { - Locale locale = locales[i]; - DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); - String result = symbols.getCurrencySymbol(); + for (Locale locale : locales) { String expected = (String) props.get(locale.toString()); + data.add(Arguments.of(expected, locale)); + } + return data.stream(); + } - if (expected == null) { - System.out.println("Warning: No expected currency symbol defined for locale " + locale); - } else { - if (expected.contains(";")) { - StringTokenizer tokens = new StringTokenizer(expected, ";"); - int tokensCount = tokens.countTokens(); - - if (tokensCount == 3) { - expected = tokens.nextToken(); - if (format == null) { - format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US); - format.setTimeZone(TimeZone.getTimeZone("GMT")); - format.setLenient(false); - } - - if (format.parse(tokens.nextToken()).getTime() < System.currentTimeMillis()) { - expected = tokens.nextToken(); - } - } - } - - if (!expected.equals(result)) { - throw new RuntimeException("Wrong currency symbol for locale " + - locale + ", expected: " + expected + ", got: " + result); - } + // Utility to grab the future symbol if in the right format and date cut-over allows + private static String getFutureSymbol(String expected) throws ParseException { + StringTokenizer tokens = new StringTokenizer(expected, ";"); + int tokensCount = tokens.countTokens(); + if (tokensCount == 3) { + expected = tokens.nextToken(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US); + format.setTimeZone(TimeZone.getTimeZone("GMT")); + format.setLenient(false); + if (format.parse(tokens.nextToken()).getTime() < System.currentTimeMillis()) { + expected = tokens.nextToken(); } } + return expected; } } diff --git a/test/jdk/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java b/test/jdk/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java index 246208b7aaf..0bfb13888e2 100644 --- a/test/jdk/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java +++ b/test/jdk/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -21,27 +21,31 @@ * questions. */ -/** +/* * @test * @bug 8206879 - * @summary Currency decimal marker incorrect for Peru. * @modules jdk.localedata - * @run main/othervm -Djava.locale.providers=JRE TestPeruCurrencyFormat + * @summary Currency decimal marker incorrect for Peru (COMPAT). + * @run junit/othervm -Djava.locale.providers=COMPAT TestPeruCurrencyFormat */ import java.text.NumberFormat; import java.util.Locale; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + public class TestPeruCurrencyFormat { - public static void main(String[] args) { + // Confirm correct decimal marker for Peru locale on COMPAT + @Test + public void peruDecimalMarketCOMPAT() { final String expected = "S/.1,234.56"; NumberFormat currencyFmt = NumberFormat.getCurrencyInstance(new Locale("es", "PE")); String s = currencyFmt.format(1234.56); - - if (!s.equals(expected)) { - throw new RuntimeException("Currency format for Peru failed, expected " + expected + ", got " + s); - } + assertEquals(expected, s, + "Currency format for Peru failed, expected " + expected + ", got " + s); } } From 445aba4eccedd067a035a6fffeee29b8723b7687 Mon Sep 17 00:00:00 2001 From: Martin Balao Date: Thu, 27 Jun 2024 15:34:59 +0000 Subject: [PATCH 135/329] 8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL Reviewed-by: roland Backport-of: cc894d849aa5f730d5a806acfc7a237cf5170af1 --- src/hotspot/share/opto/addnode.cpp | 132 ++++++++++++++++++ src/hotspot/share/opto/addnode.hpp | 26 ++-- src/hotspot/share/opto/convertnode.cpp | 14 ++ src/hotspot/share/opto/convertnode.hpp | 1 + src/hotspot/share/opto/loopTransform.cpp | 117 ++++++---------- src/hotspot/share/opto/macro.cpp | 14 ++ .../loopopts/TestUnrollLimitPreciseType.java | 92 ++++++++++++ 7 files changed, 312 insertions(+), 84 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/loopopts/TestUnrollLimitPreciseType.java diff --git a/src/hotspot/share/opto/addnode.cpp b/src/hotspot/share/opto/addnode.cpp index 959f059fa6b..35e8e2bdc1c 100644 --- a/src/hotspot/share/opto/addnode.cpp +++ b/src/hotspot/share/opto/addnode.cpp @@ -1257,6 +1257,138 @@ const Type *MinINode::add_ring( const Type *t0, const Type *t1 ) const { return TypeInt::make( MIN2(r0->_lo,r1->_lo), MIN2(r0->_hi,r1->_hi), MAX2(r0->_widen,r1->_widen) ); } +// Collapse the "addition with overflow-protection" pattern, and the symmetrical +// "subtraction with underflow-protection" pattern. These are created during the +// unrolling, when we have to adjust the limit by subtracting the stride, but want +// to protect against underflow: MaxL(SubL(limit, stride), min_jint). +// If we have more than one of those in a sequence: +// +// x con2 +// | | +// AddL clamp2 +// | | +// Max/MinL con1 +// | | +// AddL clamp1 +// | | +// Max/MinL (n) +// +// We want to collapse it to: +// +// x con1 con2 +// | | | +// | AddLNode (new_con) +// | | +// AddLNode clamp1 +// | | +// Max/MinL (n) +// +// Note: we assume that SubL was already replaced by an AddL, and that the stride +// has its sign flipped: SubL(limit, stride) -> AddL(limit, -stride). +Node* fold_subI_no_underflow_pattern(Node* n, PhaseGVN* phase) { + assert(n->Opcode() == Op_MaxL || n->Opcode() == Op_MinL, "sanity"); + // Check that the two clamps have the correct values. + jlong clamp = (n->Opcode() == Op_MaxL) ? min_jint : max_jint; + auto is_clamp = [&](Node* c) { + const TypeLong* t = phase->type(c)->isa_long(); + return t != nullptr && t->is_con() && + t->get_con() == clamp; + }; + // Check that the constants are negative if MaxL, and positive if MinL. + auto is_sub_con = [&](Node* c) { + const TypeLong* t = phase->type(c)->isa_long(); + return t != nullptr && t->is_con() && + t->get_con() < max_jint && t->get_con() > min_jint && + (t->get_con() < 0) == (n->Opcode() == Op_MaxL); + }; + // Verify the graph level by level: + Node* add1 = n->in(1); + Node* clamp1 = n->in(2); + if (add1->Opcode() == Op_AddL && is_clamp(clamp1)) { + Node* max2 = add1->in(1); + Node* con1 = add1->in(2); + if (max2->Opcode() == n->Opcode() && is_sub_con(con1)) { + Node* add2 = max2->in(1); + Node* clamp2 = max2->in(2); + if (add2->Opcode() == Op_AddL && is_clamp(clamp2)) { + Node* x = add2->in(1); + Node* con2 = add2->in(2); + if (is_sub_con(con2)) { + Node* new_con = phase->transform(new AddLNode(con1, con2)); + Node* new_sub = phase->transform(new AddLNode(x, new_con)); + n->set_req_X(1, new_sub, phase); + return n; + } + } + } + } + return nullptr; +} + +const Type* MaxLNode::add_ring(const Type* t0, const Type* t1) const { + const TypeLong* r0 = t0->is_long(); + const TypeLong* r1 = t1->is_long(); + + return TypeLong::make(MAX2(r0->_lo, r1->_lo), MAX2(r0->_hi, r1->_hi), MAX2(r0->_widen, r1->_widen)); +} + +Node* MaxLNode::Identity(PhaseGVN* phase) { + const TypeLong* t1 = phase->type(in(1))->is_long(); + const TypeLong* t2 = phase->type(in(2))->is_long(); + + // Can we determine maximum statically? + if (t1->_lo >= t2->_hi) { + return in(1); + } else if (t2->_lo >= t1->_hi) { + return in(2); + } + + return MaxNode::Identity(phase); +} + +Node* MaxLNode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* n = AddNode::Ideal(phase, can_reshape); + if (n != nullptr) { + return n; + } + if (can_reshape) { + return fold_subI_no_underflow_pattern(this, phase); + } + return nullptr; +} + +const Type* MinLNode::add_ring(const Type* t0, const Type* t1) const { + const TypeLong* r0 = t0->is_long(); + const TypeLong* r1 = t1->is_long(); + + return TypeLong::make(MIN2(r0->_lo, r1->_lo), MIN2(r0->_hi, r1->_hi), MIN2(r0->_widen, r1->_widen)); +} + +Node* MinLNode::Identity(PhaseGVN* phase) { + const TypeLong* t1 = phase->type(in(1))->is_long(); + const TypeLong* t2 = phase->type(in(2))->is_long(); + + // Can we determine minimum statically? + if (t1->_lo >= t2->_hi) { + return in(2); + } else if (t2->_lo >= t1->_hi) { + return in(1); + } + + return MaxNode::Identity(phase); +} + +Node* MinLNode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* n = AddNode::Ideal(phase, can_reshape); + if (n != nullptr) { + return n; + } + if (can_reshape) { + return fold_subI_no_underflow_pattern(this, phase); + } + return nullptr; +} + //------------------------------add_ring--------------------------------------- const Type *MinFNode::add_ring( const Type *t0, const Type *t1 ) const { const TypeF *r0 = t0->is_float_constant(); diff --git a/src/hotspot/share/opto/addnode.hpp b/src/hotspot/share/opto/addnode.hpp index 132d796aea4..a2867ad7aac 100644 --- a/src/hotspot/share/opto/addnode.hpp +++ b/src/hotspot/share/opto/addnode.hpp @@ -330,28 +330,38 @@ class MinINode : public MaxNode { // MAXimum of 2 longs. class MaxLNode : public MaxNode { public: - MaxLNode(Node *in1, Node *in2) : MaxNode(in1, in2) {} + MaxLNode(Compile* C, Node* in1, Node* in2) : MaxNode(in1, in2) { + init_flags(Flag_is_macro); + C->add_macro_node(this); + } virtual int Opcode() const; - virtual const Type *add_ring(const Type*, const Type*) const { return TypeLong::LONG; } - virtual const Type *add_id() const { return TypeLong::make(min_jlong); } - virtual const Type *bottom_type() const { return TypeLong::LONG; } + virtual const Type* add_ring(const Type* t0, const Type* t1) const; + virtual const Type* add_id() const { return TypeLong::make(min_jlong); } + virtual const Type* bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; } int max_opcode() const { return Op_MaxL; } int min_opcode() const { return Op_MinL; } + virtual Node* Identity(PhaseGVN* phase); + virtual Node* Ideal(PhaseGVN *phase, bool can_reshape); }; //------------------------------MinLNode--------------------------------------- // MINimum of 2 longs. class MinLNode : public MaxNode { public: - MinLNode(Node *in1, Node *in2) : MaxNode(in1, in2) {} + MinLNode(Compile* C, Node* in1, Node* in2) : MaxNode(in1, in2) { + init_flags(Flag_is_macro); + C->add_macro_node(this); + } virtual int Opcode() const; - virtual const Type *add_ring(const Type*, const Type*) const { return TypeLong::LONG; } - virtual const Type *add_id() const { return TypeLong::make(max_jlong); } - virtual const Type *bottom_type() const { return TypeLong::LONG; } + virtual const Type* add_ring(const Type* t0, const Type* t1) const; + virtual const Type* add_id() const { return TypeLong::make(max_jlong); } + virtual const Type* bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; } int max_opcode() const { return Op_MaxL; } int min_opcode() const { return Op_MinL; } + virtual Node* Identity(PhaseGVN* phase); + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); }; //------------------------------MaxFNode--------------------------------------- diff --git a/src/hotspot/share/opto/convertnode.cpp b/src/hotspot/share/opto/convertnode.cpp index 961e1f4a5f2..9fad77e5fa8 100644 --- a/src/hotspot/share/opto/convertnode.cpp +++ b/src/hotspot/share/opto/convertnode.cpp @@ -260,6 +260,20 @@ const Type* ConvI2LNode::Value(PhaseGVN* phase) const { return tl; } +Node* ConvI2LNode::Identity(PhaseGVN* phase) { + // If type is in "int" sub-range, we can + // convert I2L(L2I(x)) => x + // since the conversions have no effect. + if (in(1)->Opcode() == Op_ConvL2I) { + Node* x = in(1)->in(1); + const TypeLong* t = phase->type(x)->isa_long(); + if (t != nullptr && t->_lo >= min_jint && t->_hi <= max_jint) { + return x; + } + } + return this; +} + static inline bool long_ranges_overlap(jlong lo1, jlong hi1, jlong lo2, jlong hi2) { // Two ranges overlap iff one range's low point falls in the other range. diff --git a/src/hotspot/share/opto/convertnode.hpp b/src/hotspot/share/opto/convertnode.hpp index fb670191fc3..c28c084e4e2 100644 --- a/src/hotspot/share/opto/convertnode.hpp +++ b/src/hotspot/share/opto/convertnode.hpp @@ -151,6 +151,7 @@ class ConvI2LNode : public TypeNode { virtual int Opcode() const; virtual const Type* Value(PhaseGVN* phase) const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); + virtual Node* Identity(PhaseGVN* phase); virtual uint ideal_reg() const { return Op_RegL; } }; diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index ae2ed68c8f3..0ff5fbfa504 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -2162,7 +2162,7 @@ void PhaseIdealLoop::do_unroll(IdealLoopTree *loop, Node_List &old_new, bool adj new_limit = _igvn.intcon(limit->get_int() - stride_con); set_ctrl(new_limit, C->root()); } else { - // Limit is not constant. + // Limit is not constant. Int subtraction could lead to underflow. if (loop_head->unrolled_count() == 1) { // only for first unroll // Separate limit by Opaque node in case it is an incremented // variable from previous loop to avoid using pre-incremented @@ -2174,68 +2174,38 @@ void PhaseIdealLoop::do_unroll(IdealLoopTree *loop, Node_List &old_new, bool adj Node* opaq_ctrl = get_ctrl(opaq); limit = new Opaque2Node(C, limit); register_new_node(limit, opaq_ctrl); + + // The Opaque2 node created above (in the case of the first unrolling) hides the type of the loop limit. + // Propagate this precise type information. + limit = new CastIINode(limit, limit_type); + register_new_node(limit, opaq_ctrl); } - if ((stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo)) || - (stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi))) { - // No underflow. - new_limit = new SubINode(limit, stride); + // (1) Convert to long. + Node* limit_l = new ConvI2LNode(limit); + register_new_node(limit_l, get_ctrl(limit)); + Node* stride_l = _igvn.longcon(stride_con); + set_ctrl(stride_l, C->root()); + + // (2) Subtract: compute in long, to prevent underflow. + Node* new_limit_l = new SubLNode(limit_l, stride_l); + register_new_node(new_limit_l, ctrl); + + // (3) Clamp to int range, in case we had subtraction underflow. + Node* underflow_clamp_l = _igvn.longcon((stride_con > 0) ? min_jint : max_jint); + set_ctrl(underflow_clamp_l, C->root()); + Node* new_limit_no_underflow_l = nullptr; + if (stride_con > 0) { + // limit = MaxL(limit - stride, min_jint) + new_limit_no_underflow_l = new MaxLNode(C, new_limit_l, underflow_clamp_l); } else { - // (limit - stride) may underflow. - // Clamp the adjustment value with MININT or MAXINT: - // - // new_limit = limit-stride - // if (stride > 0) - // new_limit = (limit < new_limit) ? MININT : new_limit; - // else - // new_limit = (limit > new_limit) ? MAXINT : new_limit; - // - BoolTest::mask bt = loop_end->test_trip(); - assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected"); - Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint); - set_ctrl(adj_max, C->root()); - Node* old_limit = nullptr; - Node* adj_limit = nullptr; - Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : nullptr; - if (loop_head->unrolled_count() > 1 && - limit->is_CMove() && limit->Opcode() == Op_CMoveI && - limit->in(CMoveNode::IfTrue) == adj_max && - bol->as_Bool()->_test._test == bt && - bol->in(1)->Opcode() == Op_CmpI && - bol->in(1)->in(2) == limit->in(CMoveNode::IfFalse)) { - // Loop was unrolled before. - // Optimize the limit to avoid nested CMove: - // use original limit as old limit. - old_limit = bol->in(1)->in(1); - // Adjust previous adjusted limit. - adj_limit = limit->in(CMoveNode::IfFalse); - adj_limit = new SubINode(adj_limit, stride); - } else { - old_limit = limit; - adj_limit = new SubINode(limit, stride); - } - assert(old_limit != nullptr && adj_limit != nullptr, ""); - register_new_node(adj_limit, ctrl); // adjust amount - Node* adj_cmp = new CmpINode(old_limit, adj_limit); - register_new_node(adj_cmp, ctrl); - Node* adj_bool = new BoolNode(adj_cmp, bt); - register_new_node(adj_bool, ctrl); - new_limit = new CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); + // limit = MinL(limit - stride, max_jint) + new_limit_no_underflow_l = new MinLNode(C, new_limit_l, underflow_clamp_l); } + register_new_node(new_limit_no_underflow_l, ctrl); + + // (4) Convert back to int. + new_limit = new ConvL2INode(new_limit_no_underflow_l); register_new_node(new_limit, ctrl); - if (loop_head->unrolled_count() == 1) { - // The Opaque2 node created above (in the case of the first unrolling) hides the type of the loop limit. - // As a result, if the iv Phi constant folds (because it captured the iteration range), the exit test won't - // constant fold and the graph contains a broken counted loop. - const Type* new_limit_t; - if (stride_con > 0) { - new_limit_t = TypeInt::make(min_jint, limit_type->_hi, limit_type->_widen); - } else { - assert(stride_con < 0, "stride can't be 0"); - new_limit_t = TypeInt::make(limit_type->_lo, max_jint, limit_type->_widen); - } - new_limit = new CastIINode(new_limit, new_limit_t); - register_new_node(new_limit, ctrl); - } } assert(new_limit != nullptr, ""); @@ -2443,6 +2413,9 @@ void PhaseIdealLoop::mark_reductions(IdealLoopTree *loop) { //------------------------------adjust_limit----------------------------------- // Helper function that computes new loop limit as (rc_limit-offset)/scale Node* PhaseIdealLoop::adjust_limit(bool is_positive_stride, Node* scale, Node* offset, Node* rc_limit, Node* old_limit, Node* pre_ctrl, bool round) { + Node* old_limit_long = new ConvI2LNode(old_limit); + register_new_node(old_limit_long, pre_ctrl); + Node* sub = new SubLNode(rc_limit, offset); register_new_node(sub, pre_ctrl); Node* limit = new DivLNode(nullptr, sub, scale); @@ -2468,27 +2441,19 @@ Node* PhaseIdealLoop::adjust_limit(bool is_positive_stride, Node* scale, Node* o // - integer underflow of limit: MAXL chooses old_limit (>= MIN_INT > limit) // INT() is finally converting the limit back to an integer value. - // We use CMove nodes to implement long versions of min/max (MINL/MAXL). - // We use helper methods for inner MINL/MAXL which return CMoveL nodes to keep a long value for the outer MINL/MAXL comparison: - Node* inner_result_long; + Node* inner_result_long = nullptr; + Node* outer_result_long = nullptr; if (is_positive_stride) { - inner_result_long = MaxNode::signed_max(limit, _igvn.longcon(min_jint), TypeLong::LONG, _igvn); + inner_result_long = new MaxLNode(C, limit, _igvn.longcon(min_jint)); + outer_result_long = new MinLNode(C, inner_result_long, old_limit_long); } else { - inner_result_long = MaxNode::signed_min(limit, _igvn.longcon(max_jint), TypeLong::LONG, _igvn); + inner_result_long = new MinLNode(C, limit, _igvn.longcon(max_jint)); + outer_result_long = new MaxLNode(C, inner_result_long, old_limit_long); } - set_subtree_ctrl(inner_result_long, false); + register_new_node(inner_result_long, pre_ctrl); + register_new_node(outer_result_long, pre_ctrl); - // Outer MINL/MAXL: - // The comparison is done with long values but the result is the converted back to int by using CmovI. - Node* old_limit_long = new ConvI2LNode(old_limit); - register_new_node(old_limit_long, pre_ctrl); - Node* cmp = new CmpLNode(old_limit_long, limit); - register_new_node(cmp, pre_ctrl); - Node* bol = new BoolNode(cmp, is_positive_stride ? BoolTest::gt : BoolTest::lt); - register_new_node(bol, pre_ctrl); - Node* inner_result_int = new ConvL2INode(inner_result_long); // Could under-/overflow but that's fine as comparison was done with CmpL - register_new_node(inner_result_int, pre_ctrl); - limit = new CMoveINode(bol, old_limit, inner_result_int, TypeInt::INT); + limit = new ConvL2INode(outer_result_long); register_new_node(limit, pre_ctrl); return limit; } diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index 293d630ded4..69596ac80cf 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -2568,6 +2568,8 @@ void PhaseMacroExpand::eliminate_macro_nodes() { n->Opcode() == Op_Opaque2 || n->Opcode() == Op_Opaque3 || n->Opcode() == Op_Opaque4 || + n->Opcode() == Op_MaxL || + n->Opcode() == Op_MinL || BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(n), "unknown node type in macro list"); } @@ -2646,6 +2648,18 @@ bool PhaseMacroExpand::expand_macro_nodes() { n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn); C->remove_macro_node(n); success = true; + } else if (n->Opcode() == Op_MaxL) { + // Since MaxL and MinL are not implemented in the backend, we expand them to + // a CMoveL construct now. At least until here, the type could be computed + // precisely. CMoveL is not so smart, but we can give it at least the best + // type we know abouot n now. + Node* repl = MaxNode::signed_max(n->in(1), n->in(2), _igvn.type(n), _igvn); + _igvn.replace_node(n, repl); + success = true; + } else if (n->Opcode() == Op_MinL) { + Node* repl = MaxNode::signed_min(n->in(1), n->in(2), _igvn.type(n), _igvn); + _igvn.replace_node(n, repl); + success = true; } assert(!success || (C->macro_count() == (old_macro_count - 1)), "elimination must have deleted one node from macro list"); progress = progress || success; diff --git a/test/hotspot/jtreg/compiler/loopopts/TestUnrollLimitPreciseType.java b/test/hotspot/jtreg/compiler/loopopts/TestUnrollLimitPreciseType.java new file mode 100644 index 00000000000..18a58aa7ae5 --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/TestUnrollLimitPreciseType.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test id=test1 + * @bug 8298935 + * @summary CMoveI for underflow protection of the limit did not compute a type that was precise enough. + * This lead to dead data but zero-trip-guard control did not die -> "malformed control flow". + * @requires vm.compiler2.enabled + * @run main/othervm + * -XX:CompileCommand=compileonly,compiler.loopopts.TestUnrollLimitPreciseType::test1 + * -XX:CompileCommand=dontinline,compiler.loopopts.TestUnrollLimitPreciseType::* + * -XX:MaxVectorSize=64 + * -Xcomp + * -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0 + * compiler.loopopts.TestUnrollLimitPreciseType test1 + */ + +/* + * @test id=test2 + * @bug 8298935 + * @summary CMoveI for underflow protection of the limit did not compute a type that was precise enough. + * This lead to dead data but zero-trip-guard control did not die -> "malformed control flow". + * @requires vm.compiler2.enabled + * @run main/othervm + * -XX:CompileCommand=compileonly,compiler.loopopts.TestUnrollLimitPreciseType::* + * -Xcomp + * compiler.loopopts.TestUnrollLimitPreciseType test2 + */ + + +package compiler.loopopts; + +public class TestUnrollLimitPreciseType { + static final int RANGE = 512; + + public static void main(String args[]) { + if (args.length != 1) { + throw new RuntimeException("Need exactly one argument."); + } + if (args[0].equals("test1")) { + byte[] data = new byte[RANGE]; + test1(data); + } else if (args[0].equals("test2")) { + test2(); + } else { + throw new RuntimeException("Do not have: " + args[0]); + } + } + + public static void test1(byte[] data) { + // Did not fully analyze this. But it is also unrolled, SuperWorded, + // and further unrolled with vectorlized post loop. + // Only seems to reproduce with avx512, and not with avx2. + for (int j = 192; j < RANGE; j++) { + data[j - 192] = (byte)(data[j] * 11); + } + } + + static void test2() { + // Loop is SuperWord'ed. + // We unroll more afterwards, and so add vectorized post loop. + // But it turns out that the vectorized post loop is never entered. + // This lead to assert, because the zero-trip-guard did not collaspse, + // but the CastII with the trip count did die. + // Only seems to reproduce with avx512, and not with avx2. + double dArr[][] = new double[100][100]; + for (int i = 2, j = 2; j < 68; j++) { + dArr[i][j] = 8; + } + } +} From acff32c3ea372eb0a25edd92f8944d733802d2d0 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Fri, 28 Jun 2024 09:14:25 +0000 Subject: [PATCH 136/329] 8328896: Fontmetrics for large Fonts has zero width Backport-of: 25871af36b1397bdc3715ab0edc589f0483ea0b1 --- .../macosx/classes/sun/font/CStrike.java | 2 +- .../native/libawt_lwawt/font/CGGlyphImages.m | 18 ++- .../classes/sun/font/FileFontStrike.java | 16 +++ .../native/libfontmanager/freetypeScaler.c | 14 +++ .../awt/FontMetrics/ExtremeFontSizeTest.java | 118 ++++++++++++++++++ 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 test/jdk/java/awt/FontMetrics/ExtremeFontSizeTest.java diff --git a/src/java.desktop/macosx/classes/sun/font/CStrike.java b/src/java.desktop/macosx/classes/sun/font/CStrike.java index 31047d2f5f5..068a1b46af3 100644 --- a/src/java.desktop/macosx/classes/sun/font/CStrike.java +++ b/src/java.desktop/macosx/classes/sun/font/CStrike.java @@ -201,7 +201,7 @@ void getGlyphImageBounds(int glyphCode, Point2D.Float pt, Rectangle result) { getGlyphImageBounds(glyphCode, pt.x, pt.y, floatRect); if (floatRect.width == 0 && floatRect.height == 0) { - result.setRect(0, 0, -1, -1); + result.setRect(0, 0, 0, 0); return; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m b/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m index c745e8715c1..fdd855b6994 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m @@ -1020,4 +1020,20 @@ @implementation CGGI_GlyphCanvas CTFontGetAdvancesForGlyphs(font, kCTFontDefaultOrientation, glyphs, advances, count); } } -} \ No newline at end of file + int MAX_SIZE = 1 << 30; + if (bboxes) { + for (int i = 0; i < count; i++) { + if (bboxes[i].origin.x > (double)MAX_SIZE) bboxes[i].origin.x = 0; + if (bboxes[i].origin.y > (double)MAX_SIZE) bboxes[i].origin.y = 0; + if (bboxes[i].size.width > (double)MAX_SIZE) bboxes[i].size.width = 0; + if (bboxes[i].size.height > (double)MAX_SIZE) bboxes[i].size.height = 0; + } + } + if (advances) { + for (int i = 0; i < count; i++) { + if (advances[i].width > (double)MAX_SIZE) advances[i].width = 0; + if (advances[i].height > (double)MAX_SIZE) advances[i].height = 0; + } + } +} + diff --git a/src/java.desktop/share/classes/sun/font/FileFontStrike.java b/src/java.desktop/share/classes/sun/font/FileFontStrike.java index ea2a1608f2d..bf98b8ca578 100644 --- a/src/java.desktop/share/classes/sun/font/FileFontStrike.java +++ b/src/java.desktop/share/classes/sun/font/FileFontStrike.java @@ -37,6 +37,7 @@ import java.awt.geom.Rectangle2D; import java.util.concurrent.ConcurrentHashMap; import static sun.awt.SunHints.*; +import sun.java2d.pipe.OutlineTextRenderer; public class FileFontStrike extends PhysicalStrike { @@ -107,6 +108,7 @@ public class FileFontStrike extends PhysicalStrike { boolean useNatives; NativeStrike[] nativeStrikes; + static final int MAX_IMAGE_SIZE = OutlineTextRenderer.THRESHHOLD; /* Used only for communication to native layer */ private int intPtSize; @@ -697,6 +699,20 @@ float getCodePointAdvance(int cp) { void getGlyphImageBounds(int glyphCode, Point2D.Float pt, Rectangle result) { + if (intPtSize > MAX_IMAGE_SIZE) { + Rectangle.Float obds = getGlyphOutlineBounds(glyphCode); + if (obds.isEmpty()) { + Rectangle bds = getGlyphOutline(glyphCode, pt.x, pt.y).getBounds(); + result.setBounds(bds); + } else { + result.x = (int)Math.floor(pt.x + obds.getX() + 0.5f); + result.y = (int)Math.floor(pt.y + obds.getY() + 0.5f); + result.width = (int)Math.floor(obds.getWidth() + 0.5f); + result.height = (int)Math.floor(obds.getHeight() + 0.5f); + } + return; + } + long ptr = getGlyphImagePtr(glyphCode); float topLeftX, topLeftY; diff --git a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c index 4cdd0855fe8..7d5b1ed94fe 100644 --- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c +++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c @@ -486,6 +486,8 @@ static double euclidianDistance(double a, double b) { return sqrt(a*a+b*b); } +#define TOO_LARGE(a, b) (abs((int)(a / b)) > 32766) + JNIEXPORT jlong JNICALL Java_sun_font_FreetypeFontScaler_createScalerContextNative( JNIEnv *env, jobject scaler, jlong pScaler, jdoubleArray matrix, @@ -497,6 +499,7 @@ Java_sun_font_FreetypeFontScaler_createScalerContextNative( (FTScalerInfo*) jlong_to_ptr(pScaler); if (context == NULL) { + free(context); invalidateJavaScaler(env, scaler, NULL); return (jlong) 0; } @@ -506,7 +509,18 @@ Java_sun_font_FreetypeFontScaler_createScalerContextNative( //text can not be smaller than 1 point ptsz = 1.0; } + if (ptsz > 16384) { + ptsz = 16384; // far enough from 32767 + fm = TEXT_FM_ON; // avoids calculations which might overflow + } context->ptsz = (int)(ptsz * 64); + if (TOO_LARGE(dmat[0], ptsz) || TOO_LARGE(dmat[1], ptsz) || + TOO_LARGE(dmat[2], ptsz) || TOO_LARGE(dmat[3], ptsz)) + { + free(context); + return (jlong)0; + } + context->transform.xx = FloatToFTFixed((float)(dmat[0]/ptsz)); context->transform.yx = -FloatToFTFixed((float)(dmat[1]/ptsz)); context->transform.xy = -FloatToFTFixed((float)(dmat[2]/ptsz)); diff --git a/test/jdk/java/awt/FontMetrics/ExtremeFontSizeTest.java b/test/jdk/java/awt/FontMetrics/ExtremeFontSizeTest.java new file mode 100644 index 00000000000..caa365a3f21 --- /dev/null +++ b/test/jdk/java/awt/FontMetrics/ExtremeFontSizeTest.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +/* + * @test + * @bug 8328896 + * @summary test that using very large font sizes used don't break later uses + */ + +public class ExtremeFontSizeTest { + + static BufferedImage bi = new BufferedImage(1,1,1); + static Graphics2D g2d = bi.createGraphics(); + static String testString = "M"; + static Font font = new Font("SansSerif", Font.PLAIN, 12); + static int fontSize = 0; + static boolean failed = false; + static int[] fontSizes = { 10, 12, 1000, 2000, 20000, 100000, 8 }; + static double[] scales = { 1.0, 900.0}; + static boolean[] fms = { false, true }; + + public static void main(String[] args) { + + /* run tests validating bounds etc are non-zero + * then run with extreme scales for which zero is allowed - but not required + * then run the first tests again to be sure they are still reasonable. + */ + runTests(); + test(5_000_000, 10_000, false, testString, false); + test(5_000_000, 10_000, true, testString, false); + test(0, 0.00000001, false, testString, false); + runTests(); + + if (failed) { + throw new RuntimeException("Test failed. Check stdout log."); + } + } + + static void runTests() { + for (int fontSize : fontSizes) { + for (double scale : scales) { + for (boolean fm : fms) { + test(fontSize, scale, fm, testString, true); + } + } + } + } + + static void test(int size, double scale, boolean fm, String str, boolean checkAll) { + + AffineTransform at = AffineTransform.getScaleInstance(scale, scale); + FontRenderContext frc = new FontRenderContext(at, false, fm); + font = font.deriveFont((float)size); + g2d.setTransform(at); + g2d.setFont(font); + FontMetrics metrics = g2d.getFontMetrics(); + int height = metrics.getHeight(); + double width = font.getStringBounds(str, frc).getWidth(); + + GlyphVector gv = font.createGlyphVector(frc, str.toCharArray()); + Rectangle pixelBounds = gv.getPixelBounds(frc, 0, 0); + Rectangle2D visualBounds = gv.getVisualBounds(); + + System.out.println("Test parameters: size="+size+" scale="+scale+" fm="+fm+" str="+str); + System.out.println("font height="+metrics.getHeight()); + System.out.println("string bounds width="+width); + System.out.println("GlyphVector Pixel Bounds="+ pixelBounds); + System.out.println("GlyphVector Visual Bounds="+ visualBounds); + + + if (height < 0 || width < 0 || pixelBounds.getWidth() < 0 || visualBounds.getWidth() < 0) { + failed = true; + System.out.println(" *** Unexpected negative size reported *** "); + } + if (!checkAll) { + System.out.println(); + return; + } + + if (height == 0 || width == 0 || (pixelBounds.isEmpty()) || visualBounds.isEmpty() ) { + failed = true; + System.out.println("Pixel bounds empty="+pixelBounds.isEmpty()); + System.out.println("Visual bounds empty="+visualBounds.isEmpty()); + System.out.println(" *** RESULTS NOT AS EXPECTED *** "); + } + System.out.println(); + } +} From 107010051fae72b0383a4c38e5b162bb07bac75d Mon Sep 17 00:00:00 2001 From: Xiaolong Peng Date: Fri, 28 Jun 2024 15:34:50 +0000 Subject: [PATCH 137/329] 8170817: G1: Returning MinTLABSize from unsafe_max_tlab_alloc causes TLAB flapping Reviewed-by: phh Backport-of: 4c79e7d59caec01b4d2bdae2f7d25f1dd24ffbf6 --- src/hotspot/share/gc/g1/g1Allocator.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index 1aca61234e5..b55f47826f4 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -192,11 +192,14 @@ size_t G1Allocator::unsafe_max_tlab_alloc() { uint node_index = current_node_index(); HeapRegion* hr = mutator_alloc_region(node_index)->get(); size_t max_tlab = _g1h->max_tlab_size() * wordSize; - if (hr == NULL) { + + if (hr == NULL || hr->free() < MinTLABSize) { + // The next TLAB allocation will most probably happen in a new region, + // therefore we can attempt to allocate the maximum allowed TLAB size. return max_tlab; - } else { - return clamp(hr->free(), MinTLABSize, max_tlab); } + + return MIN2(hr->free(), max_tlab); } size_t G1Allocator::used_in_alloc_regions() { From 3bdbf49bb98224c4d2664881bd8b2ef46e691d35 Mon Sep 17 00:00:00 2001 From: Dmitry Chuyko Date: Fri, 28 Jun 2024 17:27:50 +0000 Subject: [PATCH 138/329] 8298809: Clean up vm/compiler/InterfaceCalls JMH Backport-of: 81e23ab3403a983ccddf27b1169a49e2ca061296 --- .../bench/vm/compiler/InterfaceCalls.java | 234 +++++------------- 1 file changed, 58 insertions(+), 176 deletions(-) diff --git a/test/micro/org/openjdk/bench/vm/compiler/InterfaceCalls.java b/test/micro/org/openjdk/bench/vm/compiler/InterfaceCalls.java index bbecd3d3b23..fae3f7968da 100644 --- a/test/micro/org/openjdk/bench/vm/compiler/InterfaceCalls.java +++ b/test/micro/org/openjdk/bench/vm/compiler/InterfaceCalls.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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,250 +38,132 @@ @State(Scope.Thread) public class InterfaceCalls { - interface AnInterface { - public int getInt(); + interface FirstInterface { + public int getIntFirst(); } interface SecondInterface { - public int get1(); + public int getIntSecond(); } - interface OnlyHasOneImplInterface { - public int getLong(); - } - - interface AloneInterface { - public int getNumber(); - } - - class SingleImplementor implements OnlyHasOneImplInterface { - public int getLong() { + class FirstClass implements FirstInterface, SecondInterface { + public int getIntFirst() { return 1; } - } - - class Extender1 extends SingleImplementor { - } - class FirstClass implements AnInterface { - public int getInt() { + public int getIntSecond() { return 1; } } - class SecondClass implements AnInterface { - public int getInt() { + class SecondClass implements FirstInterface, SecondInterface { + public int getIntFirst() { return 2; } - } - class ThirdClass implements AnInterface { - public int getInt() { - return -3; + public int getIntSecond() { + return 1; } } - class FourthClass implements AnInterface { - public int getInt() { - return -4; + class ThirdClass implements FirstInterface, SecondInterface { + public int getIntFirst() { + return -3; } - } - class FifthClass implements AnInterface { - public int getInt() { - return -5; + public int getIntSecond() { + return 1; } } - class MultiClass1 implements AnInterface, SecondInterface { - public int get1() { - return 1; + class FourthClass implements FirstInterface, SecondInterface { + public int getIntFirst() { + return -4; } - public int getInt() { - return 2; + public int getIntSecond() { + return 1; } } - class MultiClass2 implements AnInterface, SecondInterface { - public int get1() { - return -1; - } - - public int getInt() { - return -2; + class FifthClass implements FirstInterface, SecondInterface { + public int getIntFirst() { + return -5; } - } - class Aloner implements AloneInterface { - public int getNumber() { - return 7; + public int getIntSecond() { + return 1; } } - public Object dummy1; - - public Object dummy2; - - public Object dummy3; - - public AnInterface multi1a, multi2a; - - public SecondInterface multi1b, multi2b; - - public Object multic, multic2; - - public AnInterface[] as = new AnInterface[5]; - - public AnInterface multi; - - public OnlyHasOneImplInterface single1; + final int asLength = 5; + public FirstInterface[] as = new FirstInterface[asLength]; - public OnlyHasOneImplInterface single2; - - public AloneInterface alone; - - int count; @Setup public void setupSubclass() { - dummy1 = new FirstClass(); - dummy2 = new SecondClass(); - dummy3 = new ThirdClass(); as[0] = new FirstClass(); as[1] = new SecondClass(); as[2] = new ThirdClass(); as[3] = new FourthClass(); as[4] = new FifthClass(); - MultiClass1 mc1 = new MultiClass1(); - multi1a = mc1; - multi1b = mc1; - multic = mc1; - MultiClass2 mc2 = new MultiClass2(); - multi2a = mc2; - multi2b = mc2; - multic2 = mc2; - single1 = new SingleImplementor(); - single2 = new Extender1(); - alone = new Aloner(); - } - - private void swapMultiParts() { - AnInterface tmpa = multi1a; - SecondInterface tmpb = multi1b; - multi1a = multi2a; - multi2a = tmpa; - multi1b = multi2b; - multi2b = tmpb; - } - - @SuppressWarnings("unused") - private void swapMulti() { - Object tmp = multic; - multic = multic2; - multic2 = tmp; } /** - * Tests a call where there are multiple implementors but only one of the implementors is every used here so the - * call-site is monomorphic + * Tests a call where there are multiple implementors but only one of the + * implementors is every used here so the call-site is monomorphic */ @Benchmark public int testMonomorphic() { - return as[0].getInt(); - } - - /** Tests a interface call that only has one single implementation */ - @Benchmark - public int testSingle() { - return alone.getNumber(); + return as[0].getIntFirst(); } - /** - * Tests a call where there is a single implementation but multiple classes that inherit that implementation and both - * these implementors are used. - */ - @Benchmark - public int testSingle2() { - OnlyHasOneImplInterface oi; - if ((count & 1) == 0) { - oi = single1; - } else { - oi = single2; - } - count++; - return oi.getLong(); - } + int l = 0; /** - * Tests calling two different interface methods in two different interfaces on the same receiver. Make sure to switch - * between two different types of receivers to achieve polymorhpism + * Interface call address computation within loop but the receiver preexists + * the loop and the ac can be moved outside of the loop */ @Benchmark - public void testCall2Poly2(Blackhole bh) { - bh.consume(multi1a.getInt()); - bh.consume(multi1b.get1()); - swapMultiParts(); - } - - @Benchmark - public int testCallMulti1Poly2NoSwap() { - return multi1a.getInt(); + public int test1stInt2Types() { + FirstInterface ai = as[l]; + l = 1 - l; + return ai.getIntFirst(); } - /** - * This test goes together with Multi2 below It tests if a class implements multiple interfaces if the different - * interfaces take different amounts of time (They do for hotspot) - */ @Benchmark - public int testCallMulti1Poly2() { - swapMultiParts(); - return multi1a.getInt(); + public int test1stInt3Types() { + FirstInterface ai = as[l]; + l = ++ l % 3; + return ai.getIntFirst(); } - /** - * This test goes together with Multi2 below It tests if a class implements multiple interfaces if the different - * interfaces take different amounts of time (They do for hotspot) - */ @Benchmark - public int testCallMulti2Poly2() { - swapMultiParts(); - return multi1b.get1(); + public int test1stInt5Types() { + FirstInterface ai = as[l]; + l = ++ l % asLength; + return ai.getIntFirst(); } - /** Interface call with three different receivers */ @Benchmark - public void testCallPoly3(Blackhole bh) { - for (int kk = 0; kk < 3; kk++) { - bh.consume(as[kk].getInt()); - } + public int test2ndInt2Types() { + SecondInterface ai = (SecondInterface) as[l]; + l = 1 - l; + return ai.getIntSecond(); } - /** Interface call with five different receivers. */ @Benchmark - public void testCallPoly5(Blackhole bh) { - for (int kk = 0; kk < 5; kk++) { - bh.consume(as[kk].getInt()); - } + public int test2ndInt3Types() { + SecondInterface ai = (SecondInterface) as[l]; + l = ++ l % 3; + return ai.getIntSecond(); } - int l; - - /** - * Interface call address computation within loop but the receiver preexists the loop and the ac can be moved outside - * of the loop - */ @Benchmark - public int testAC1() { - AnInterface ai = as[l]; - l = 1 - l; - return ai.getInt(); + public int test2ndInt5Types() { + SecondInterface ai = (SecondInterface) as[l]; + l = ++ l % asLength; + return ai.getIntSecond(); } - /** Tests an interface cast followed by an interface call. */ - @Benchmark - public int testInterfaceCastAndCall() throws Exception { - return ((AnInterface) dummy1).getInt() + ((AnInterface) dummy2).getInt() - + ((AnInterface) dummy3).getInt(); - } } From a4a0a82dc0720cc4372a90bc2cb0884525da3633 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Mon, 1 Jul 2024 05:00:37 +0000 Subject: [PATCH 139/329] 8293862: javax/swing/JFileChooser/8046391/bug8046391.java failed with 'Cannot invoke "java.awt.Image.getWidth(java.awt.image.ImageObserver)" because "retVal" is null' Reviewed-by: mdoerr Backport-of: 2e4a3c47e262f91a7f881d9d990eb81a929d1627 --- .../sun/awt/shell/Win32ShellFolder2.java | 15 ++++++++++++-- .../native/libawt/windows/ShellFolder2.cpp | 20 ++++++++++++------- .../JFileChooser/8046391/bug8046391.java | 2 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java index a936aabc327..db3bde5889a 100644 --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java @@ -1136,6 +1136,14 @@ public Image call() { return icon; } + /** + * The data is not available yet. + * @see + * COM + * Error Codes. + */ + private static final long E_PENDING = 0x8000000AL; + /** * @return The icon image of specified size used to display this shell folder */ @@ -1161,10 +1169,10 @@ public Image getIcon(int width, int height) { getRelativePIDL(), s, false); // E_PENDING: loading can take time so get the default - if (hIcon <= 0) { + if (hIcon == E_PENDING || hIcon == 0) { hIcon = extractIcon(getParentIShellFolder(), getRelativePIDL(), s, true); - if (hIcon <= 0) { + if (hIcon == 0) { if (isDirectory()) { newIcon = getShell32Icon(FOLDER_ICON_ID, size); } else { @@ -1404,11 +1412,14 @@ static class MultiResolutionIconImage extends AbstractMultiResolutionImage { final Map resolutionVariants = new HashMap<>(); public MultiResolutionIconImage(int baseSize, Map resolutionVariants) { + assert !resolutionVariants.containsValue(null) + : "There are null icons in the MRI variants map"; this.baseSize = baseSize; this.resolutionVariants.putAll(resolutionVariants); } public MultiResolutionIconImage(int baseSize, Image image) { + assert image != null : "Null icon passed as the base image for MRI"; this.baseSize = baseSize; this.resolutionVariants.put(baseSize, image); } diff --git a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp index 1de97dbb826..93de667b410 100644 --- a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp +++ b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -974,7 +974,7 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon return 0; } - HICON hIcon = NULL; + HICON hIcon; HRESULT hres; IExtractIconW* pIcon; @@ -995,15 +995,21 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon iconSize = (16 << 16) + size; } hres = pIcon->Extract(szBuf, index, &hIcon, &hIconSmall, iconSize); - if (size < 24) { - fn_DestroyIcon((HICON)hIcon); - hIcon = hIconSmall; + if (SUCCEEDED(hres)) { + if (size < 24) { + fn_DestroyIcon((HICON)hIcon); + hIcon = hIconSmall; + } else { + fn_DestroyIcon((HICON)hIconSmall); + } } else { - fn_DestroyIcon((HICON)hIconSmall); + hIcon = NULL; } } else if (hres == E_PENDING) { pIcon->Release(); - return E_PENDING; + return (unsigned) E_PENDING; + } else { + hIcon = NULL; } pIcon->Release(); } diff --git a/test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java b/test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java index 60e80d33116..db9b89cbdc3 100644 --- a/test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java +++ b/test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8046391 + * @bug 8046391 8293862 * @requires (os.family == "windows") * @summary JFileChooser hangs if displayed in Windows L&F * @author Alexey Ivanov From 4e702a40432d2259e139652328398ce51b9f97fd Mon Sep 17 00:00:00 2001 From: Xiaolong Peng Date: Mon, 1 Jul 2024 12:16:08 +0000 Subject: [PATCH 140/329] 8319406: x86: Shorter movptr(reg, imm) for 32-bit immediates Backport-of: b120a05b22426567b33bbe491f791179e377bd78 --- src/hotspot/cpu/x86/assembler_x86.cpp | 11 ----------- src/hotspot/cpu/x86/assembler_x86.hpp | 1 - src/hotspot/cpu/x86/macroAssembler_x86.cpp | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index b05646ac20c..4817080c139 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -10513,17 +10513,6 @@ void Assembler::movsbq(Register dst, Register src) { emit_int24(0x0F, (unsigned char)0xBE, (0xC0 | encode)); } -void Assembler::movslq(Register dst, int32_t imm32) { - // dbx shows movslq(rcx, 3) as movq $0x0000000049000000,(%rbx) - // and movslq(r8, 3); as movl $0x0000000048000000,(%rbx) - // as a result we shouldn't use until tested at runtime... - ShouldNotReachHere(); - InstructionMark im(this); - int encode = prefixq_and_encode(dst->encoding()); - emit_int8(0xC7 | encode); - emit_int32(imm32); -} - void Assembler::movslq(Address dst, int32_t imm32) { assert(is_simm32(imm32), "lost bits"); InstructionMark im(this); diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index e8a61efe992..09ca79a02d1 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -1584,7 +1584,6 @@ class Assembler : public AbstractAssembler { // Move signed 32bit immediate to 64bit extending sign void movslq(Address dst, int32_t imm64); - void movslq(Register dst, int32_t imm64); void movslq(Register dst, Address src); void movslq(Register dst, Register src); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index da4a40ba3f9..1ab299aa8c0 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -1516,7 +1516,12 @@ void MacroAssembler::call(AddressLiteral entry) { void MacroAssembler::ic_call(address entry, jint method_index) { RelocationHolder rh = virtual_call_Relocation::spec(pc(), method_index); +#ifdef _LP64 + // Needs full 64-bit immediate for later patching. + mov64(rax, (intptr_t)Universe::non_oop_word()); +#else movptr(rax, (intptr_t)Universe::non_oop_word()); +#endif call(AddressLiteral(entry, rh)); } @@ -2685,7 +2690,15 @@ void MacroAssembler::movptr(Register dst, Address src) { // src should NEVER be a real pointer. Use AddressLiteral for true pointers void MacroAssembler::movptr(Register dst, intptr_t src) { - LP64_ONLY(mov64(dst, src)) NOT_LP64(movl(dst, src)); +#ifdef _LP64 + if (is_simm32(src)) { + movq(dst, checked_cast(src)); + } else { + mov64(dst, src); + } +#else + movl(dst, src); +#endif } void MacroAssembler::movptr(Address dst, Register src) { From 313a7e09b12b54c364fc6ceb5315da365b2ba30b Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 1 Jul 2024 17:58:37 +0000 Subject: [PATCH 141/329] 8327007: javax/swing/JSpinner/8008657/bug8008657.java fails Backport-of: b7540df6a4279c63e69d32b9d9834f7a427478d1 --- test/jdk/javax/swing/JSpinner/8008657/bug8008657.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/javax/swing/JSpinner/8008657/bug8008657.java b/test/jdk/javax/swing/JSpinner/8008657/bug8008657.java index cbeb0c185bb..26ed0e0082c 100644 --- a/test/jdk/javax/swing/JSpinner/8008657/bug8008657.java +++ b/test/jdk/javax/swing/JSpinner/8008657/bug8008657.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, 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,7 +39,6 @@ * @test * @key headful * @bug 8008657 - * @author Alexander Scherbatiy * @summary JSpinner setComponentOrientation doesn't affect on text orientation * @run main bug8008657 */ @@ -137,6 +136,7 @@ static void createDateSpinner() { calendar.add(Calendar.YEAR, -1); Date earliestDate = calendar.getTime(); calendar.add(Calendar.YEAR, 1); + calendar.add(Calendar.DAY_OF_MONTH, 1); Date latestDate = calendar.getTime(); SpinnerModel dateModel = new SpinnerDateModel(initDate, earliestDate, From 379a14bb49f9445d384c9fa5f8e4804804a7ee22 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Tue, 2 Jul 2024 02:00:43 +0000 Subject: [PATCH 142/329] 8260633: [macos] java/awt/dnd/MouseEventAfterStartDragTest/MouseEventAfterStartDragTest.html test failed Backport-of: 6f7ddbec7d0bc459d44b6518fe1d982eaba7f37b --- .../MouseEventAfterStartDragTest.java | 214 ++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 test/jdk/java/awt/dnd/MouseEventAfterStartDragTest/MouseEventAfterStartDragTest.java diff --git a/test/jdk/java/awt/dnd/MouseEventAfterStartDragTest/MouseEventAfterStartDragTest.java b/test/jdk/java/awt/dnd/MouseEventAfterStartDragTest/MouseEventAfterStartDragTest.java new file mode 100644 index 00000000000..faa98c43b75 --- /dev/null +++ b/test/jdk/java/awt/dnd/MouseEventAfterStartDragTest/MouseEventAfterStartDragTest.java @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2014, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.event.AWTEventListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.MouseMotionListener; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4613903 + * @summary verifies that mouse events are not dispatched during drag + * @key headful + * @run main MouseEventAfterStartDragTest + */ + +public final class MouseEventAfterStartDragTest implements AWTEventListener { + final Frame frame = new Frame(); + volatile Point srcPoint; + volatile Dimension d; + volatile MouseEvent lastMouseEvent = null; + volatile boolean passed = true; + final DragSource dragSource = DragSource.getDefaultDragSource(); + final Transferable transferable = new StringSelection("TEXT"); + + final MouseMotionListener mouseMotionListener = new MouseMotionAdapter() { + public void mouseDragged(MouseEvent e) { + System.out.println("mouseDragged: " + e + + ", hash:" + e.hashCode()); + if (lastMouseEvent != null && !e.equals(lastMouseEvent)) { + System.out.println("Unexpected: " + e + + ", hash:" + e.hashCode()); + passed = false; + } + } + }; + + final DragSourceListener dragSourceListener = new DragSourceAdapter() { + public void dragDropEnd(DragSourceDragEvent dsde) { + System.out.println("dragDropEnd: " + dsde); + lastMouseEvent = null; + } + }; + + final DragGestureListener dragGestureListener = new DragGestureListener() { + public void dragGestureRecognized(DragGestureEvent dge) { + System.out.println("dragGestureRecognized: " + dge); + Object[] events = dge.toArray(); + Object lastEvent = events[events.length - 1]; + if (lastEvent instanceof MouseEvent) { + lastMouseEvent = (MouseEvent) lastEvent; + } + System.out.println("The last mouse event: " + lastMouseEvent + + ", hash:" + lastMouseEvent.hashCode()); + dge.startDrag(null, transferable, dragSourceListener); + } + }; + + static final Object SYNC_LOCK = new Object(); + static final int MOUSE_RELEASE_TIMEOUT = 1000; + volatile Component clickedComponent = null; + + public static void main(String[] args) throws Exception { + System.setProperty("awt.dnd.drag.threshold", "0"); + MouseEventAfterStartDragTest app = new MouseEventAfterStartDragTest(); + try { + app.createAndShowGUI(); + app.test(); + } finally { + app.dispose(); + } + } + + public void createAndShowGUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + frame.setTitle("Test frame"); + frame.setBounds(100, 100, 200, 200); + frame.setLocationRelativeTo(null); + frame.addMouseMotionListener(mouseMotionListener); + dragSource.createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_COPY_OR_MOVE, + dragGestureListener); + + frame.getToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK); + frame.setVisible(true); + }); + } + + public static int sign(int n) { + return n < 0 ? -1 : n == 0 ? 0 : 1; + } + + public void test() throws Exception { + final Robot robot = new Robot(); + robot.setAutoDelay(45); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + srcPoint = frame.getLocationOnScreen(); + d = frame.getSize(); + }); + srcPoint.translate(d.width / 2, d.height / 2); + + if (!pointInComponent(robot, srcPoint, frame)) { + System.err.println("WARNING: Couldn't locate source frame."); + return; + } + + final Point dstPoint = new Point(srcPoint); + dstPoint.translate(d.width / 4, d.height / 4); + + if (!pointInComponent(robot, dstPoint, frame)) { + System.err.println("WARNING: Couldn't locate target frame."); + return; + } + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.delay(250); + System.out.println("srcPoint = " + srcPoint); + for (; !srcPoint.equals(dstPoint); + srcPoint.translate(sign(dstPoint.x - srcPoint.x), + sign(dstPoint.y - srcPoint.y))) { + robot.mouseMove(srcPoint.x, srcPoint.y); + System.out.println("srcPoint = " + srcPoint); + } + + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + System.out.println("done"); + robot.waitForIdle(); + robot.delay(MOUSE_RELEASE_TIMEOUT); + + if (!passed) { + throw new RuntimeException("Test failed"); + } + } + + public void dispose() throws Exception { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + + public void reset() { + clickedComponent = null; + } + + public void eventDispatched(AWTEvent e) { + if (e.getID() == MouseEvent.MOUSE_RELEASED) { + clickedComponent = (Component) e.getSource(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + } + + boolean pointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + robot.waitForIdle(); + reset(); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + synchronized (SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT); + } + + Component c = clickedComponent; + + while (c != null && c != comp) { + c = c.getParent(); + } + + return c == comp; + } +} From b555bbbe0ae5b6ed653dc11d87c25dc5097b5e11 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Thu, 4 Jul 2024 02:31:23 +0000 Subject: [PATCH 143/329] 8294691: dynamicArchive/RelativePath.java is running other test case Backport-of: 3466e999348696c8666afd7a59c6947f61fe4d6a --- .../cds/appcds/dynamicArchive/RelativePath.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RelativePath.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RelativePath.java index 5760b15d0bb..dacac4770d1 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RelativePath.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RelativePath.java @@ -39,7 +39,7 @@ public class RelativePath extends DynamicArchiveTestBase { public static void main(String[] args) throws Exception { - runTest(AppendClasspath::testDefaultBase); + runTest(RelativePath::testDefaultBase); } static void testDefaultBase() throws Exception { @@ -54,6 +54,16 @@ private static void doTest(String topArchiveName) throws Exception { int idx = appJar.lastIndexOf(File.separator); String jarName = appJar.substring(idx + 1); String jarDir = appJar.substring(0, idx); + + // Create CDS Archive + dump(topArchiveName, "-Xlog:cds", + "-Xlog:cds+dynamic=debug", + "-cp", appJar + File.pathSeparator + appJar2, + "HelloMore") + .assertNormalExit(output-> { + output.shouldContain("Written dynamic archive 0x"); + }); + // relative path starting with "." runWithRelativePath(null, topArchiveName, jarDir, "-Xlog:class+load", From dc3abeee7e2f91ad03fbad9f111dd7ccceea25b4 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Thu, 4 Jul 2024 03:04:47 +0000 Subject: [PATCH 144/329] 8309241: ClassForNameLeak fails intermittently as the class loader hasn't been unloaded Backport-of: a23bbea9593a85a9d60431e68805efa6f960a4d4 --- .../forNameLeak/ClassForNameLeak.java | 72 ++++++++----------- 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java index a0374522567..045e26bf3c3 100644 --- a/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java +++ b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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,15 +28,14 @@ * from a custom classloader. * @library /test/lib * @build jdk.test.lib.Utils + * jdk.test.lib.util.ForceGC * jdk.test.lib.util.JarUtils * @build ClassForName ClassForNameLeak * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak */ import java.io.IOException; -import java.lang.ref.PhantomReference; -import java.lang.ref.Reference; -import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -51,6 +50,7 @@ import java.util.stream.Stream; import jdk.test.lib.Utils; +import jdk.test.lib.util.ForceGC; import jdk.test.lib.util.JarUtils; /* @@ -60,35 +60,32 @@ public class ClassForNameLeak { private static final long TIMEOUT = (long)(5000.0 * Utils.TIMEOUT_FACTOR); private static final int THREADS = 10; private static final Path jarFilePath = Paths.get("cfn.jar"); - private static final ReferenceQueue rq = new ReferenceQueue<>(); - static class TestLoader { - private final PhantomReference ref; - TestLoader() { - this.ref = loadAndRun(); - } - - // Use a new classloader to load the ClassForName class, then run its - // Runnable. - PhantomReference loadAndRun() { + static class TestLoader extends URLClassLoader { + static URL[] toURLs() { try { - ClassLoader classLoader = - new URLClassLoader("LeakedClassLoader", - new URL[]{jarFilePath.toUri().toURL()}, - ClassLoader.getPlatformClassLoader()); - - Class loadClass = Class.forName("ClassForName", true, classLoader); - ((Runnable) loadClass.newInstance()).run(); - - return new PhantomReference<>(classLoader, rq); - } catch (MalformedURLException|ReflectiveOperationException e) { + return new URL[]{jarFilePath.toUri().toURL()}; + } catch (MalformedURLException e) { throw new RuntimeException(e); } } - PhantomReference getRef() { - return ref; + TestLoader() { + super("LeakedClassLoader", toURLs(), ClassLoader.getPlatformClassLoader()); + } + } + + // Use a new classloader to load the ClassForName class, then run its + // Runnable. + static WeakReference loadAndRun() { + TestLoader classLoader = new TestLoader(); + try { + Class loadClass = Class.forName("ClassForName", true, classLoader); + ((Runnable) loadClass.newInstance()).run(); + } catch (ReflectiveOperationException ex) { + throw new RuntimeException(ex); } + return new WeakReference<>(classLoader); } public static void main(String... args) throws Exception { @@ -98,30 +95,19 @@ public static void main(String... args) throws Exception { // Make simultaneous calls to the test method, to stress things a bit ExecutorService es = Executors.newFixedThreadPool(THREADS); - List> callables = + List>> callables = Stream.generate(() -> { - Callable cprcl = TestLoader::new; + Callable> cprcl = ClassForNameLeak::loadAndRun; return cprcl; }).limit(THREADS).collect(Collectors.toList()); - List> futures = es.invokeAll(callables); - - // Give the GC a chance to enqueue the PhantomReferences - for (int i = 0; i < 10; i++) { - System.gc(); - } - - // Make sure all PhantomReferences to the leaked classloader are enqueued - for (int j = 0; j < futures.size(); j++) { - Reference rmRef = rq.remove(TIMEOUT); - if (rmRef == null) { - throw new RuntimeException("ClassLoader was never enqueued!"); - } else { - System.out.println("Enqueued " + rmRef); + for (Future> future : es.invokeAll(callables)) { + WeakReference ref = future.get(); + if (!ForceGC.wait(() -> ref.refersTo(null))) { + throw new RuntimeException(ref.get() + " not unloaded"); } } es.shutdown(); - System.out.println("All ClassLoaders successfully enqueued"); } private static final String CLASSFILENAME = "ClassForName.class"; From 83a5a4d9477b975a55490ab620a213ce00648267 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Thu, 4 Jul 2024 07:36:49 +0000 Subject: [PATCH 145/329] 8331331: :tier1 target explanation in doc/testing.md is incorrect Reviewed-by: mbaesken Backport-of: 04271dfe7a262379944e2a2cf83a98a3a1b78a74 --- doc/testing.html | 2 +- doc/testing.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/testing.html b/doc/testing.html index a64a891b5b8..862b207a2d5 100644 --- a/doc/testing.html +++ b/doc/testing.html @@ -67,7 +67,7 @@

Configuration

Test selection

All functionality is available using the test make target. In this use case, the test or tests to be executed is controlled using the TEST variable. To speed up subsequent test runs with no source code changes, test-only can be used instead, which do not depend on the source and test image build.

For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that make test-tier1 is equivalent to make test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the test TEST="x" solution needs to be used.

-

The test specifications given in TEST is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, :tier1 will expand to jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1. You can always submit a list of fully qualified test descriptors in the TEST variable if you want to shortcut the parser.

+

The test specifications given in TEST is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, :tier1 will expand to include all subcomponent test directories that define `tier1`, for example: jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 .... You can always submit a list of fully qualified test descriptors in the TEST variable if you want to shortcut the parser.

Common Test Groups

Ideally, all tests are run for every change but this may not be practical due to the limited testing resources, the scope of the change, etc.

The source tree currently defines a few common test groups in the relevant TEST.groups files. There are test groups that cover a specific component, for example hotspot_gc. It is a good idea to look into TEST.groups files to get a sense what tests are relevant to a particular JDK component.

diff --git a/doc/testing.md b/doc/testing.md index 3cdc0d662d6..bddc6ba3ee9 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -58,11 +58,11 @@ test runs, the `test TEST="x"` solution needs to be used. The test specifications given in `TEST` is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an -example, `:tier1` will expand to `jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 -jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 -jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1`. You can -always submit a list of fully qualified test descriptors in the `TEST` variable -if you want to shortcut the parser. +example, `:tier1` will expand to include all subcomponent test directories +that define `tier1`, for example: `jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 +jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 ...`. You +can always submit a list of fully qualified test descriptors in the `TEST` +variable if you want to shortcut the parser. ### Common Test Groups From 7ae015fdf1321237a08af69580efb86f65321fa5 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 4 Jul 2024 07:38:17 +0000 Subject: [PATCH 146/329] 8330063: Upgrade jQuery to 3.7.1 Reviewed-by: mdoerr Backport-of: 3b9abf9ec1b30d67a40f9d10ec497ff8e0cca8f2 --- .../doclets/formats/html/HtmlDoclet.java | 2 +- .../resources/script-dir/jquery-3.6.1.min.js | 2 - .../{jquery-3.6.1.js => jquery-3.7.1.js} | 1915 ++++++++--------- .../resources/script-dir/jquery-3.7.1.min.js | 2 + .../doclets/toolkit/util/DocPaths.java | 2 +- src/jdk.javadoc/share/legal/jquery.md | 50 +- .../javadoc/doclet/testSearch/TestSearch.java | 4 +- .../doclet/testSearchScript/javadoc-search.js | 10 +- .../jdk/javadoc/tool/api/basic/APITest.java | 2 +- 9 files changed, 878 insertions(+), 1111 deletions(-) delete mode 100644 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.1.min.js rename src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/{jquery-3.6.1.js => jquery-3.7.1.js} (88%) create mode 100644 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.7.1.min.js diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java index dae63c2f0bf..92f2b9081db 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java @@ -310,7 +310,7 @@ protected void generateOtherFiles(ClassTree classtree) private void copyJqueryFiles() throws DocletException { List files = Arrays.asList( - "jquery-3.6.1.min.js", + "jquery-3.7.1.min.js", "jquery-ui.min.js", "jquery-ui.min.css"); DocFile f; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.1.min.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.1.min.js deleted file mode 100644 index 2c69bc908b1..00000000000 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.6.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,y=n.hasOwnProperty,a=y.toString,l=a.call(Object),v={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&v(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!y||!y.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ve(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ye(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ve(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],y=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||y.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),y=y.length&&new RegExp(y.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),v=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&v(p,e)?-1:t==C||t.ownerDocument==p&&v(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!y||!y.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),v.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",v.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",v.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return B(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=_e(v.pixelPosition,function(e,t){if(t)return t=Be(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 0 && ( length - 1 ) in obj; } -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.6 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2021-02-16 - */ -( function( window ) { + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +} +var pop = arr.pop; + + +var sort = arr.sort; + + +var splice = arr.splice; + + +var whitespace = "[\\x20\\t\\r\\n\\f]"; + + +var rtrimCSS = new RegExp( + "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", + "g" +); + + + + +// Note: an element does not contain itself +jQuery.contains = function( a, b ) { + var bup = b && b.parentNode; + + return a === bup || !!( bup && bup.nodeType === 1 && ( + + // Support: IE 9 - 11+ + // IE doesn't have `contains` on SVG. + a.contains ? + a.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + ) ); +}; + + + + +// CSS string/identifier serialization +// https://drafts.csswg.org/cssom/#common-serializing-idioms +var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; + +function fcssescape( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; +} + +jQuery.escapeSelector = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); +}; + + + + +var preferredDoc = document, + pushNative = push; + +( function() { + var i, - support, Expr, - getText, - isXML, - tokenize, - compile, - select, outermostContext, sortInput, hasDuplicate, + push = pushNative, // Local document vars - setDocument, document, - docElem, + documentElement, documentIsHTML, rbuggyQSA, - rbuggyMatches, matches, - contains, // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, + expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), @@ -570,47 +664,22 @@ var i, return 0; }, - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + + "loop|multiple|open|readonly|required|scoped", // Regular expressions - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", @@ -629,101 +698,88 @@ var i, // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), + rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + + whitespace + "*" ), rdescend = new RegExp( whitespace + "|>" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + ID: new RegExp( "^#(" + identifier + ")" ), + CLASS: new RegExp( "^\\.(" + identifier + ")" ), + TAG: new RegExp( "^(" + identifier + "|[*])" ), + ATTR: new RegExp( "^" + attributes ), + PSEUDO: new RegExp( "^" + pseudos ), + CHILD: new RegExp( + "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + bool: new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + + needsContext: new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, - rhtml = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, - rnative = /^[^{]+\{\s*\[native \w/, - // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), + // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\([^\\r\\n\\f])", "g" ), funescape = function( escape, nonHex ) { var high = "0x" + escape.slice( 1 ) - 0x10000; - return nonHex ? + if ( nonHex ) { // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + return nonHex; } - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; + // Replace a hexadecimal escape sequence with the encoded Unicode code point + // Support: IE <=11+ + // For values outside the Basic Multilingual Plane (BMP), manually construct a + // surrogate pair + return high < 0 ? + String.fromCharCode( high + 0x10000 ) : + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, - // Used for iframes - // See setDocument() + // Used for iframes; see `setDocument`. + // Support: IE 9 - 11+, Edge 12 - 18+ // Removing the function wrapper causes a "Permission Denied" - // error in IE + // error in IE/Edge. unloadHandler = function() { setDocument(); }, inDisabledFieldset = addCombinator( function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; + return elem.disabled === true && nodeName( elem, "fieldset" ); }, { dir: "parentNode", next: "legend" } ); +// Support: IE <=9 only +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + // Optimize for push.apply( _, NodeList ) try { push.apply( @@ -731,32 +787,22 @@ try { preferredDoc.childNodes ); - // Support: Android<4.0 + // Support: Android <=4.0 // Detect silently failing push.apply // eslint-disable-next-line no-unused-expressions arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { + push = { + apply: function( target, els ) { pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; + }, + call: function( target ) { + pushNative.apply( target, slice.call( arguments, 1 ) ); } }; } -function Sizzle( selector, context, results, seed ) { +function find( selector, context, results, seed ) { var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, @@ -790,11 +836,10 @@ function Sizzle( selector, context, results, seed ) { if ( nodeType === 9 ) { if ( ( elem = context.getElementById( m ) ) ) { - // Support: IE, Opera, Webkit - // TODO: identify versions + // Support: IE 9 only // getElementById can match elements by name instead of ID if ( elem.id === m ) { - results.push( elem ); + push.call( results, elem ); return results; } } else { @@ -804,14 +849,13 @@ function Sizzle( selector, context, results, seed ) { // Element context } else { - // Support: IE, Opera, Webkit - // TODO: identify versions + // Support: IE 9 only // getElementById can match elements by name instead of ID if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && + find.contains( context, elem ) && elem.id === m ) { - results.push( elem ); + push.call( results, elem ); return results; } } @@ -822,22 +866,15 @@ function Sizzle( selector, context, results, seed ) { return results; // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - + } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { + if ( !nonnativeSelectorCache[ selector + " " ] && + ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { newSelector = selector; newContext = context; @@ -850,7 +887,7 @@ function Sizzle( selector, context, results, seed ) { // as such selectors are not recognized by querySelectorAll. // Thanks to Andrew Dupont for this technique. if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { + ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || @@ -858,11 +895,15 @@ function Sizzle( selector, context, results, seed ) { // We can use :scope instead of the ID hack if the browser // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when + // strict-comparing two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( newContext != context || !support.scope ) { // Capture the context ID, setting it first if necessary if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); + nid = jQuery.escapeSelector( nid ); } else { context.setAttribute( "id", ( nid = expando ) ); } @@ -895,7 +936,7 @@ function Sizzle( selector, context, results, seed ) { } // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); + return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); } /** @@ -909,7 +950,8 @@ function createCache() { function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + // Use (key + " ") to avoid collision with native prototype properties + // (see https://github.com/jquery/sizzle/issues/157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries @@ -921,7 +963,7 @@ function createCache() { } /** - * Mark a function for special use by Sizzle + * Mark a function for special use by jQuery selector module * @param {Function} fn The function to mark */ function markFunction( fn ) { @@ -952,56 +994,13 @@ function assert( fn ) { } } -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; + return nodeName( elem, "input" ) && elem.type === type; }; } @@ -1011,8 +1010,8 @@ function createInputPseudo( type ) { */ function createButtonPseudo( type ) { return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; + return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && + elem.type === type; }; } @@ -1048,14 +1047,13 @@ function createDisabledPseudo( disabled ) { } } - // Support: IE 6 - 11 + // Support: IE 6 - 11+ // Use the isDisabled shortcut property to check for disabled fieldset ancestors return elem.isDisabled === disabled || // Where there is no isDisabled, check manually - /* jshint -W018 */ elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; + inDisabledFieldset( elem ) === disabled; } return elem.disabled === disabled; @@ -1095,7 +1093,7 @@ function createPositionalPseudo( fn ) { } /** - * Checks a node for validity as a Sizzle context + * Checks a node for validity as a jQuery selector context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ @@ -1103,31 +1101,13 @@ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem && elem.namespaceURI, - docElem = elem && ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - /** * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document + * @param {Element|Object} [node] An element or document object to use to set the document * @returns {Object} Returns the current document */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, +function setDocument( node ) { + var subWindow, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected @@ -1141,87 +1121,90 @@ setDocument = Sizzle.setDocument = function( node ) { // Update global variables document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); + documentElement = document.documentElement; + documentIsHTML = !jQuery.isXMLDoc( document ); + + // Support: iOS 7 only, IE 9 - 11+ + // Older browsers didn't support unprefixed `matches`. + matches = documentElement.matches || + documentElement.webkitMatchesSelector || + documentElement.msMatchesSelector; // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { + // Accessing iframe documents after unload throws "permission denied" errors + // (see trac-13936). + // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, + // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. + if ( documentElement.msMatchesSelector && - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + preferredDoc != document && + ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } + // Support: IE 9 - 11+, Edge 12 - 18+ + subWindow.addEventListener( "unload", unloadHandler ); } - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; + // Support: IE <10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert( function( el ) { + documentElement.appendChild( el ).id = jQuery.expando; + return !document.getElementsByName || + !document.getElementsByName( jQuery.expando ).length; } ); - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); + // Support: IE 9 only + // Check to see if it's possible to do matchesSelector + // on a disconnected node. + support.disconnectedMatch = assert( function( el ) { + return matches.call( el, "*" ); } ); - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; + // Support: IE 9 - 11+, Edge 12 - 18+ + // IE/Edge don't support the :scope pseudo-class. + support.scope = assert( function() { + return document.querySelectorAll( ":scope" ); } ); - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; + // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only + // Make sure the `:has()` argument is parsed unforgivingly. + // We include `*` in the test to detect buggy implementations that are + // _selectively_ forgiving (specifically when the list includes at least + // one valid selector). + // Note that we treat complete lack of support for `:has()` as if it were + // spec-compliant support, which is fine because use of `:has()` in such + // environments will fail in the qSA path and fall back to jQuery traversal + // anyway. + support.cssHas = assert( function() { + try { + document.querySelector( ":has(*,:jqfake)" ); + return false; + } catch ( e ) { + return true; + } } ); // ID filter and find if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { + Expr.filter.ID = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute( "id" ) === attrId; }; }; - Expr.find[ "ID" ] = function( id, context ) { + Expr.find.ID = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var elem = context.getElementById( id ); return elem ? [ elem ] : []; } }; } else { - Expr.filter[ "ID" ] = function( id ) { + Expr.filter.ID = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && @@ -1232,7 +1215,7 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE 6 - 7 only // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { + Expr.find.ID = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var node, i, elems, elem = context.getElementById( id ); @@ -1262,40 +1245,18 @@ setDocument = Sizzle.setDocument = function( node ) { } // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); + Expr.find.TAG = function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; + // DocumentFragment nodes don't have gEBTN + } else { + return context.querySelectorAll( tag ); + } + }; // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { + Expr.find.CLASS = function( className, context ) { if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { return context.getElementsByClassName( className ); } @@ -1306,177 +1267,94 @@ setDocument = Sizzle.setDocument = function( node ) { // QSA and matchesSelector support - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 rbuggyQSA = []; - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert( function( el ) { - var input; + var input; - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } + documentElement.appendChild( el ).innerHTML = + "" + + ""; - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } + // Support: iOS <=7 - 8 only + // Boolean attributes and "value" are not treated correctly in some XML documents + if ( !el.querySelectorAll( "[selected]" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } + // Support: iOS <=7 - 8 only + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push( "~=" ); + } - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } + // Support: iOS 8 only + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push( ".#.+[+~]" ); + } - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { + // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ + // In some of the document kinds, these selectors wouldn't work natively. + // This is probably OK but for backwards compatibility we want to maintain + // handling them through jQuery traversal in jQuery 3.x. + if ( !el.querySelectorAll( ":checked" ).length ) { + rbuggyQSA.push( ":checked" ); + } - assert( function( el ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + input = document.createElement( "input" ); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE 9 - 11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ + // In some of the document kinds, these selectors wouldn't work natively. + // This is probably OK but for backwards compatibility we want to maintain + // handling them through jQuery traversal in jQuery 3.x. + documentElement.appendChild( el ).disabled = true; + if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE 11+, Edge 15 - 18+ + // IE 11/Edge don't find elements on a `[name='']` query in some cases. + // Adding a temporary attribute to the document before the selection works + // around the issue. + // Interestingly, IE 10 & older don't seem to have the issue. + input = document.createElement( "input" ); + input.setAttribute( "name", "" ); + el.appendChild( input ); + if ( !el.querySelectorAll( "[name='']" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + + whitespace + "*(?:''|\"\")" ); + } + } ); - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); + if ( !support.cssHas ) { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ + // Our regular `try-catch` mechanism fails to detect natively-unsupported + // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) + // in browsers that parse the `:has()` argument as a forgiving selector list. + // https://drafts.csswg.org/selectors/#relational now requires the argument + // to be parsed unforgivingly, but browsers have not yet fully adjusted. + rbuggyQSA.push( ":has" ); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { + sortOrder = function( a, b ) { // Flag for duplicate removal if ( a === b ) { @@ -1510,8 +1388,8 @@ setDocument = Sizzle.setDocument = function( node ) { // IE/Edge sometimes throw a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { + if ( a === document || a.ownerDocument == preferredDoc && + find.contains( preferredDoc, a ) ) { return -1; } @@ -1519,100 +1397,33 @@ setDocument = Sizzle.setDocument = function( node ) { // IE/Edge sometimes throw a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { + if ( b === document || b.ownerDocument == preferredDoc && + find.contains( preferredDoc, b ) ) { return 1; } // Maintain original order return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; }; return document; -}; +} -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); +find.matches = function( expr, elements ) { + return find( expr, null, null, elements ); }; -Sizzle.matchesSelector = function( elem, expr ) { +find.matchesSelector = function( elem, expr ) { setDocument( elem ); - if ( support.matchesSelector && documentIsHTML && + if ( documentIsHTML && !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); @@ -1620,9 +1431,9 @@ Sizzle.matchesSelector = function( elem, expr ) { // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch ( e ) { @@ -1630,10 +1441,10 @@ Sizzle.matchesSelector = function( elem, expr ) { } } - return Sizzle( expr, document, null, [ elem ] ).length > 0; + return find( expr, document, null, [ elem ] ).length > 0; }; -Sizzle.contains = function( context, elem ) { +find.contains = function( context, elem ) { // Set document vars if needed // Support: IE 11+, Edge 17 - 18+ @@ -1643,10 +1454,11 @@ Sizzle.contains = function( context, elem ) { if ( ( context.ownerDocument || context ) != document ) { setDocument( context ); } - return contains( context, elem ); + return jQuery.contains( context, elem ); }; -Sizzle.attr = function( elem, name ) { + +find.attr = function( elem, name ) { // Set document vars if needed // Support: IE 11+, Edge 17 - 18+ @@ -1659,25 +1471,19 @@ Sizzle.attr = function( elem, name ) { var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) + // Don't get fooled by Object.prototype properties (see trac-13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; + if ( val !== undefined ) { + return val; + } -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); + return elem.getAttribute( name ); }; -Sizzle.error = function( msg ) { +find.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; @@ -1685,16 +1491,20 @@ Sizzle.error = function( msg ) { * Document sorting and removing duplicates * @param {ArrayLike} results */ -Sizzle.uniqueSort = function( results ) { +jQuery.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); + // + // Support: Android <=4.0+ + // Testing for detecting duplicates is unpredictable so instead assume we can't + // depend on duplicate detection in all browsers without a stable sort. + hasDuplicate = !support.sortStable; + sortInput = !support.sortStable && slice.call( results, 0 ); + sort.call( results, sortOrder ); if ( hasDuplicate ) { while ( ( elem = results[ i++ ] ) ) { @@ -1703,7 +1513,7 @@ Sizzle.uniqueSort = function( results ) { } } while ( j-- ) { - results.splice( duplicates[ j ], 1 ); + splice.call( results, duplicates[ j ], 1 ); } } @@ -1714,47 +1524,11 @@ Sizzle.uniqueSort = function( results ) { return results; }; -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; +jQuery.fn.uniqueSort = function() { + return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); }; -Expr = Sizzle.selectors = { +Expr = jQuery.expr = { // Can be adjusted by the user cacheLength: 50, @@ -1775,12 +1549,12 @@ Expr = Sizzle.selectors = { }, preFilter: { - "ATTR": function( match ) { + ATTR: function( match ) { match[ 1 ] = match[ 1 ].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); + match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) + .replace( runescape, funescape ); if ( match[ 2 ] === "~=" ) { match[ 3 ] = " " + match[ 3 ] + " "; @@ -1789,7 +1563,7 @@ Expr = Sizzle.selectors = { return match.slice( 0, 4 ); }, - "CHILD": function( match ) { + CHILD: function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) @@ -1807,29 +1581,30 @@ Expr = Sizzle.selectors = { // nth-* requires argument if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); + find.error( match[ 0 ] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[ 4 ] = +( match[ 4 ] ? match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); + 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) + ); match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - // other types prohibit arguments + // other types prohibit arguments } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); + find.error( match[ 0 ] ); } return match; }, - "PSEUDO": function( match ) { + PSEUDO: function( match ) { var excess, unquoted = !match[ 6 ] && match[ 2 ]; - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { + if ( matchExpr.CHILD.test( match[ 0 ] ) ) { return null; } @@ -1858,36 +1633,36 @@ Expr = Sizzle.selectors = { filter: { - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + TAG: function( nodeNameSelector ) { + var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + return nodeName( elem, expectedNodeName ); }; }, - "CLASS": function( className ) { + CLASS: function( className ) { var pattern = classCache[ className + " " ]; return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); + ( pattern = new RegExp( "(^|" + whitespace + ")" + className + + "(" + whitespace + "|$)" ) ) && + classCache( className, function( elem ) { + return pattern.test( + typeof elem.className === "string" && elem.className || + typeof elem.getAttribute !== "undefined" && + elem.getAttribute( "class" ) || + "" + ); } ); }, - "ATTR": function( name, operator, check ) { + ATTR: function( name, operator, check ) { return function( elem ) { - var result = Sizzle.attr( elem, name ); + var result = find.attr( elem, name ); if ( result == null ) { return operator === "!="; @@ -1898,22 +1673,34 @@ Expr = Sizzle.selectors = { result += ""; - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ + if ( operator === "=" ) { + return result === check; + } + if ( operator === "!=" ) { + return result !== check; + } + if ( operator === "^=" ) { + return check && result.indexOf( check ) === 0; + } + if ( operator === "*=" ) { + return check && result.indexOf( check ) > -1; + } + if ( operator === "$=" ) { + return check && result.slice( -check.length ) === check; + } + if ( operator === "~=" ) { + return ( " " + result.replace( rwhitespace, " " ) + " " ) + .indexOf( check ) > -1; + } + if ( operator === "|=" ) { + return result === check || result.slice( 0, check.length + 1 ) === check + "-"; + } + return false; }; }, - "CHILD": function( type, what, _argument, first, last ) { + CHILD: function( type, what, _argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; @@ -1926,7 +1713,7 @@ Expr = Sizzle.selectors = { } : function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, + var cache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), @@ -1941,7 +1728,7 @@ Expr = Sizzle.selectors = { node = elem; while ( ( node = node[ dir ] ) ) { if ( ofType ? - node.nodeName.toLowerCase() === name : + nodeName( node, name ) : node.nodeType === 1 ) { return false; @@ -1960,17 +1747,8 @@ Expr = Sizzle.selectors = { if ( forward && useCache ) { // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; + outerCache = parent[ expando ] || ( parent[ expando ] = {} ); + cache = outerCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex && cache[ 2 ]; node = nodeIndex && parent.childNodes[ nodeIndex ]; @@ -1982,7 +1760,7 @@ Expr = Sizzle.selectors = { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } @@ -1991,17 +1769,8 @@ Expr = Sizzle.selectors = { // Use previously-cached element index if available if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; + outerCache = elem[ expando ] || ( elem[ expando ] = {} ); + cache = outerCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex; } @@ -2015,7 +1784,7 @@ Expr = Sizzle.selectors = { ( diff = nodeIndex = 0 ) || start.pop() ) ) { if ( ( ofType ? - node.nodeName.toLowerCase() === name : + nodeName( node, name ) : node.nodeType === 1 ) && ++diff ) { @@ -2023,13 +1792,7 @@ Expr = Sizzle.selectors = { if ( useCache ) { outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; + outerCache[ type ] = [ dirruns, diff ]; } if ( node === elem ) { @@ -2047,19 +1810,19 @@ Expr = Sizzle.selectors = { }; }, - "PSEUDO": function( pseudo, argument ) { + PSEUDO: function( pseudo, argument ) { // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes + // https://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); + find.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function - // just as Sizzle does + // just as jQuery does if ( fn[ expando ] ) { return fn( argument ); } @@ -2073,7 +1836,7 @@ Expr = Sizzle.selectors = { matched = fn( seed, argument ), i = matched.length; while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); + idx = indexOf.call( seed, matched[ i ] ); seed[ idx ] = !( matches[ idx ] = matched[ i ] ); } } ) : @@ -2089,14 +1852,14 @@ Expr = Sizzle.selectors = { pseudos: { // Potentially complex pseudos - "not": markFunction( function( selector ) { + not: markFunction( function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); + matcher = compile( selector.replace( rtrimCSS, "$1" ) ); return matcher[ expando ] ? markFunction( function( seed, matches, _context, xml ) { @@ -2115,22 +1878,23 @@ Expr = Sizzle.selectors = { input[ 0 ] = elem; matcher( input, null, xml, results ); - // Don't keep the element (issue #299) + // Don't keep the element + // (see https://github.com/jquery/sizzle/issues/299) input[ 0 ] = null; return !results.pop(); }; } ), - "has": markFunction( function( selector ) { + has: markFunction( function( selector ) { return function( elem ) { - return Sizzle( selector, elem ).length > 0; + return find( selector, elem ).length > 0; }; } ), - "contains": markFunction( function( text ) { + contains: markFunction( function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; + return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; }; } ), @@ -2140,12 +1904,12 @@ Expr = Sizzle.selectors = { // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { + // https://www.w3.org/TR/selectors/#lang-pseudo + lang: markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); + find.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { @@ -2164,38 +1928,39 @@ Expr = Sizzle.selectors = { } ), // Miscellaneous - "target": function( elem ) { + target: function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, - "root": function( elem ) { - return elem === docElem; + root: function( elem ) { + return elem === documentElement; }, - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && + focus: function( elem ) { + return elem === safeActiveElement() && + document.hasFocus() && !!( elem.type || elem.href || ~elem.tabIndex ); }, // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), + enabled: createDisabledPseudo( false ), + disabled: createDisabledPseudo( true ), - "checked": function( elem ) { + checked: function( elem ) { // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); + // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + return ( nodeName( elem, "input" ) && !!elem.checked ) || + ( nodeName( elem, "option" ) && !!elem.selected ); }, - "selected": function( elem ) { + selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly + // Support: IE <=11+ + // Accessing the selectedIndex property + // forces the browser to treat the default option as + // selected when in an optgroup. if ( elem.parentNode ) { // eslint-disable-next-line no-unused-expressions elem.parentNode.selectedIndex; @@ -2205,9 +1970,9 @@ Expr = Sizzle.selectors = { }, // Contents - "empty": function( elem ) { + empty: function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo + // https://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children @@ -2219,49 +1984,49 @@ Expr = Sizzle.selectors = { return true; }, - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); + parent: function( elem ) { + return !Expr.pseudos.empty( elem ); }, // Element/input types - "header": function( elem ) { + header: function( elem ) { return rheader.test( elem.nodeName ); }, - "input": function( elem ) { + input: function( elem ) { return rinputs.test( elem.nodeName ); }, - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; + button: function( elem ) { + return nodeName( elem, "input" ) && elem.type === "button" || + nodeName( elem, "button" ); }, - "text": function( elem ) { + text: function( elem ) { var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && + return nodeName( elem, "input" ) && elem.type === "text" && - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + // Support: IE <10 only + // New HTML5 attribute values (e.g., "search") appear + // with elem.type === "text" ( ( attr = elem.getAttribute( "type" ) ) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection - "first": createPositionalPseudo( function() { + first: createPositionalPseudo( function() { return [ 0 ]; } ), - "last": createPositionalPseudo( function( _matchIndexes, length ) { + last: createPositionalPseudo( function( _matchIndexes, length ) { return [ length - 1 ]; } ), - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { + eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; } ), - "even": createPositionalPseudo( function( matchIndexes, length ) { + even: createPositionalPseudo( function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); @@ -2269,7 +2034,7 @@ Expr = Sizzle.selectors = { return matchIndexes; } ), - "odd": createPositionalPseudo( function( matchIndexes, length ) { + odd: createPositionalPseudo( function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); @@ -2277,19 +2042,24 @@ Expr = Sizzle.selectors = { return matchIndexes; } ), - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; + lt: createPositionalPseudo( function( matchIndexes, length, argument ) { + var i; + + if ( argument < 0 ) { + i = argument + length; + } else if ( argument > length ) { + i = length; + } else { + i = argument; + } + for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; } ), - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { + gt: createPositionalPseudo( function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); @@ -2299,7 +2069,7 @@ Expr = Sizzle.selectors = { } }; -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; +Expr.pseudos.nth = Expr.pseudos.eq; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { @@ -2314,7 +2084,7 @@ function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { +function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; @@ -2342,13 +2112,13 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { matched = false; // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { + if ( ( match = rleadingCombinator.exec( soFar ) ) ) { matched = match.shift(); tokens.push( { value: matched, // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) + type: match[ 0 ].replace( rtrimCSS, " " ) } ); soFar = soFar.slice( matched.length ); } @@ -2375,14 +2145,16 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : + if ( parseOnly ) { + return soFar.length; + } - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; + return soFar ? + find.error( selector ) : + + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} function toSelector( tokens ) { var i = 0, @@ -2415,7 +2187,7 @@ function addCombinator( matcher, combinator, base ) { // Check against all ancestor/preceding elements function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, + var oldCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching @@ -2432,14 +2204,9 @@ function addCombinator( matcher, combinator, base ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { + if ( skip && nodeName( elem, skip ) ) { elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && + } else if ( ( oldCache = outerCache[ key ] ) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements @@ -2447,7 +2214,7 @@ function addCombinator( matcher, combinator, base ) { } else { // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; + outerCache[ key ] = newCache; // A match means we're done; a fail means we have to keep checking if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { @@ -2479,7 +2246,7 @@ function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); + find( selector, contexts[ i ], results ); } return results; } @@ -2513,38 +2280,37 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS postFinder = setMatcher( postFinder, postSelector ); } return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, + var temp, i, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), + elems = seed || + multipleContexts( selector || "*", + context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : - elems, + elems; - matcherOut = matcher ? + if ( matcher ) { - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + // If we have a postFinder, or filtered seed, or non-seed postFilter + // or preexisting results, + matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - // ...intermediate processing is necessary - [] : + // ...intermediate processing is necessary + [] : - // ...otherwise use results directly - results : - matcherIn; + // ...otherwise use results directly + results; - // Find primary matches - if ( matcher ) { + // Find primary matches matcher( matcherIn, matcherOut, context, xml ); + } else { + matcherOut = matcherIn; } // Apply postFilter @@ -2582,7 +2348,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS i = matcherOut.length; while ( i-- ) { if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { + ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { seed[ temp ] = !( results[ temp ] = elem ); } @@ -2617,15 +2383,21 @@ function matcherFromTokens( tokens ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; + return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( ( checkContext = context ).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) + // Avoid hanging onto element + // (see https://github.com/jquery/sizzle/issues/299) checkContext = null; return ret; } ]; @@ -2650,11 +2422,10 @@ function matcherFromTokens( tokens ) { i > 1 && elementMatcher( matchers ), i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ) + .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) + ).replace( rtrimCSS, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), @@ -2680,7 +2451,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { contextBackup = outermostContext, // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), + elems = seed || byElement && Expr.find.TAG( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), @@ -2696,8 +2467,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { } // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + // Support: iOS <=7 - 9 only + // Tolerate NodeList properties (IE: "length"; Safari: ) matching + // elements by id. (see trac-14142) for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { if ( byElement && elem ) { j = 0; @@ -2712,7 +2484,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { } while ( ( matcher = elementMatchers[ j++ ] ) ) { if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); + push.call( results, elem ); break; } } @@ -2775,7 +2547,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { - Sizzle.uniqueSort( results ); + jQuery.uniqueSort( results ); } } @@ -2793,7 +2565,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { superMatcher; } -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { +function compile( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], @@ -2816,27 +2588,25 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { } // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); + cached = compilerCache( selector, + matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; -}; +} /** - * A low-level selection function that works with Sizzle's compiled + * A low-level selection function that works with jQuery's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile + * selector function built with jQuery selector compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ -select = Sizzle.select = function( selector, context, results, seed ) { +function select( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( ( selector = compiled.selector || selector ) ); @@ -2850,10 +2620,12 @@ select = Sizzle.select = function( selector, context, results, seed ) { // Reduce context if the leading compound selector is an ID tokens = match[ 0 ] = match[ 0 ].slice( 0 ); if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; + context = ( Expr.find.ID( + token.matches[ 0 ].replace( runescape, funescape ), + context + ) || [] )[ 0 ]; if ( !context ) { return results; @@ -2866,7 +2638,7 @@ select = Sizzle.select = function( selector, context, results, seed ) { } // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; + i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[ i ]; @@ -2879,8 +2651,8 @@ select = Sizzle.select = function( selector, context, results, seed ) { // Search, expanding context for leading sibling combinators if ( ( seed = find( token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context + rsibling.test( tokens[ 0 ].type ) && + testContext( context.parentNode ) || context ) ) ) { // If seed is empty or no tokens remain, we can return early @@ -2907,21 +2679,18 @@ select = Sizzle.select = function( selector, context, results, seed ) { !context || rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; -}; +} // One-time assignments +// Support: Android <=4.0 - 4.1+ // Sort stability support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - // Initialize against the default document setDocument(); -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Support: Android <=4.0 - 4.1+ // Detached nodes confoundingly follow *each other* support.sortDetached = assert( function( el ) { @@ -2929,68 +2698,29 @@ support.sortDetached = assert( function( el ) { return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; } ); -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; +jQuery.find = find; // Deprecated jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; +jQuery.unique = jQuery.uniqueSort; +// These have always been private, but they used to be documented as part of +// Sizzle so let's maintain them for now for backwards compatibility purposes. +find.compile = compile; +find.select = select; +find.setDocument = setDocument; +find.tokenize = tokenize; +find.escape = jQuery.escapeSelector; +find.getText = jQuery.text; +find.isXML = jQuery.isXMLDoc; +find.selectors = jQuery.expr; +find.support = jQuery.support; +find.uniqueSort = jQuery.uniqueSort; + + /* eslint-enable */ + +} )(); var dir = function( elem, dir, until ) { @@ -3024,13 +2754,6 @@ var siblings = function( n, elem ) { var rneedsContext = jQuery.expr.match.needsContext; - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -} var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); @@ -3281,7 +3004,7 @@ jQuery.fn.extend( { if ( cur.nodeType < 11 && ( targets ? targets.index( cur ) > -1 : - // Don't pass non-elements to Sizzle + // Don't pass non-elements to jQuery#find cur.nodeType === 1 && jQuery.find.matchesSelector( cur, selectors ) ) ) { @@ -3836,7 +3559,7 @@ jQuery.extend( { if ( jQuery.Deferred.exceptionHook ) { jQuery.Deferred.exceptionHook( e, - process.stackTrace ); + process.error ); } // Support: Promises/A+ section 2.3.3.3.4.1 @@ -3864,10 +3587,17 @@ jQuery.extend( { process(); } else { - // Call an optional hook to record the stack, in case of exception + // Call an optional hook to record the error, in case of exception // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); + if ( jQuery.Deferred.getErrorHook ) { + process.error = jQuery.Deferred.getErrorHook(); + + // The deprecated alias of the above. While the name suggests + // returning the stack, not an error instance, jQuery just passes + // it directly to `console.warn` so both will work; an instance + // just better cooperates with source maps. + } else if ( jQuery.Deferred.getStackHook ) { + process.error = jQuery.Deferred.getStackHook(); } window.setTimeout( process ); } @@ -4042,12 +3772,16 @@ jQuery.extend( { // warn about them ASAP rather than swallowing them by default. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; -jQuery.Deferred.exceptionHook = function( error, stack ) { +// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error +// captured before the async barrier to get the original error cause +// which may otherwise be hidden. +jQuery.Deferred.exceptionHook = function( error, asyncError ) { // Support: IE 8 - 9 only // Console exists when dev tools are open, which can happen at any time if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + window.console.warn( "jQuery.Deferred exception: " + error.message, + error.stack, asyncError ); } }; @@ -5103,25 +4837,6 @@ function returnFalse() { return false; } -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - function on( elem, types, selector, data, fn, one ) { var origFn, type; @@ -5559,7 +5274,7 @@ jQuery.event = { el.click && nodeName( el, "input" ) ) { // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); + leverageNative( el, "click", true ); } // Return false to allow normal processing in the caller @@ -5610,10 +5325,10 @@ jQuery.event = { // synthetic events by interrupting progress until reinvoked in response to // *native* events that it fires directly, ensuring that state changes have // already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { +function leverageNative( el, type, isSetup ) { - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { + // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add + if ( !isSetup ) { if ( dataPriv.get( el, type ) === undefined ) { jQuery.event.add( el, type, returnTrue ); } @@ -5625,15 +5340,13 @@ function leverageNative( el, type, expectSync ) { jQuery.event.add( el, type, { namespace: false, handler: function( event ) { - var notAsync, result, + var result, saved = dataPriv.get( this, type ); if ( ( event.isTrigger & 1 ) && this[ type ] ) { // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { + if ( !saved ) { // Store arguments for use when handling the inner native event // There will always be at least one argument (an event object), so this array @@ -5642,33 +5355,22 @@ function leverageNative( el, type, expectSync ) { dataPriv.set( this, type, saved ); // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); this[ type ](); result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } + dataPriv.set( this, type, false ); + if ( saved !== result ) { // Cancel the outer synthetic event event.stopImmediatePropagation(); event.preventDefault(); - // Support: Chrome 86+ - // In Chrome, if an element having a focusout handler is blurred by - // clicking outside of it, it invokes the handler synchronously. If - // that handler calls `.remove()` on the element, the data is cleared, - // leaving `result` undefined. We need to guard against this. - return result && result.value; + return result; } // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. + // (focus or blur), assume that the surrogate already propagated from triggering + // the native event and prevent that from happening again here. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the // bubbling surrogate propagates *after* the non-bubbling base), but that seems // less bad than duplication. @@ -5678,22 +5380,25 @@ function leverageNative( el, type, expectSync ) { // If this is a native event triggered above, everything is now in order // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { + } else if ( saved ) { // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); + dataPriv.set( this, type, jQuery.event.trigger( + saved[ 0 ], + saved.slice( 1 ), + this + ) ); + + // Abort handling of the native event by all jQuery handlers while allowing + // native handlers on the same element to run. On target, this is achieved + // by stopping immediate propagation just on the jQuery event. However, + // the native event is re-wrapped by a jQuery one on each level of the + // propagation so the only way to stop it for jQuery is to stop it for + // everyone via native `stopPropagation()`. This is not a problem for + // focus/blur which don't bubble, but it does also stop click on checkboxes + // and radios. We accept this limitation. + event.stopPropagation(); + event.isImmediatePropagationStopped = returnTrue; } } } ); @@ -5832,18 +5537,73 @@ jQuery.each( { }, jQuery.event.addProp ); jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { + + function focusMappedHandler( nativeEvent ) { + if ( document.documentMode ) { + + // Support: IE 11+ + // Attach a single focusin/focusout handler on the document while someone wants + // focus/blur. This is because the former are synchronous in IE while the latter + // are async. In other browsers, all those handlers are invoked synchronously. + + // `handle` from private data would already wrap the event, but we need + // to change the `type` here. + var handle = dataPriv.get( this, "handle" ), + event = jQuery.event.fix( nativeEvent ); + event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; + event.isSimulated = true; + + // First, handle focusin/focusout + handle( nativeEvent ); + + // ...then, handle focus/blur + // + // focus/blur don't bubble while focusin/focusout do; simulate the former by only + // invoking the handler at the lower level. + if ( event.target === event.currentTarget ) { + + // The setup part calls `leverageNative`, which, in turn, calls + // `jQuery.event.add`, so event handle will already have been set + // by this point. + handle( event ); + } + } else { + + // For non-IE browsers, attach a single capturing handler on the document + // while someone wants focusin/focusout. + jQuery.event.simulate( delegateType, nativeEvent.target, + jQuery.event.fix( nativeEvent ) ); + } + } + jQuery.event.special[ type ] = { // Utilize native event if possible so blur/focus sequence is correct setup: function() { + var attaches; + // Claim the first handler // dataPriv.set( this, "focus", ... ) // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); + leverageNative( this, type, true ); - // Return false to allow normal processing in the caller - return false; + if ( document.documentMode ) { + + // Support: IE 9 - 11+ + // We use the same native handler for focusin & focus (and focusout & blur) + // so we need to coordinate setup & teardown parts between those events. + // Use `delegateType` as the key as `type` is already used by `leverageNative`. + attaches = dataPriv.get( this, delegateType ); + if ( !attaches ) { + this.addEventListener( delegateType, focusMappedHandler ); + } + dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); + } else { + + // Return false to allow normal processing in the caller + return false; + } }, trigger: function() { @@ -5854,6 +5614,24 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp return true; }, + teardown: function() { + var attaches; + + if ( document.documentMode ) { + attaches = dataPriv.get( this, delegateType ) - 1; + if ( !attaches ) { + this.removeEventListener( delegateType, focusMappedHandler ); + dataPriv.remove( this, delegateType ); + } else { + dataPriv.set( this, delegateType, attaches ); + } + } else { + + // Return false to indicate standard teardown should be applied + return false; + } + }, + // Suppress native focus or blur if we're currently inside // a leveraged native-event stack _default: function( event ) { @@ -5862,6 +5640,58 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp delegateType: delegateType }; + + // Support: Firefox <=44 + // Firefox doesn't have focus(in | out) events + // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 + // + // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 + // focus(in | out) events fire after focus & blur events, + // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order + // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 + // + // Support: IE 9 - 11+ + // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, + // attach a single handler for both events in IE. + jQuery.event.special[ delegateType ] = { + setup: function() { + + // Handle: regular nodes (via `this.ownerDocument`), window + // (via `this.document`) & document (via `this`). + var doc = this.ownerDocument || this.document || this, + dataHolder = document.documentMode ? this : doc, + attaches = dataPriv.get( dataHolder, delegateType ); + + // Support: IE 9 - 11+ + // We use the same native handler for focusin & focus (and focusout & blur) + // so we need to coordinate setup & teardown parts between those events. + // Use `delegateType` as the key as `type` is already used by `leverageNative`. + if ( !attaches ) { + if ( document.documentMode ) { + this.addEventListener( delegateType, focusMappedHandler ); + } else { + doc.addEventListener( type, focusMappedHandler, true ); + } + } + dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this.document || this, + dataHolder = document.documentMode ? this : doc, + attaches = dataPriv.get( dataHolder, delegateType ) - 1; + + if ( !attaches ) { + if ( document.documentMode ) { + this.removeEventListener( delegateType, focusMappedHandler ); + } else { + doc.removeEventListener( type, focusMappedHandler, true ); + } + dataPriv.remove( dataHolder, delegateType ); + } else { + dataPriv.set( dataHolder, delegateType, attaches ); + } + } + }; } ); // Create mouseenter/leave events using mouseover/out and event-time checks @@ -6093,7 +5923,7 @@ function domManip( collection, args, callback, ignored ) { if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; - // Reenable scripts + // Re-enable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion @@ -6164,7 +5994,8 @@ jQuery.extend( { if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + // We eschew jQuery#find here for performance reasons: + // https://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); @@ -6440,15 +6271,6 @@ var swap = function( elem, options, callback ) { var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); -var whitespace = "[\\x20\\t\\r\\n\\f]"; - - -var rtrimCSS = new RegExp( - "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", - "g" -); - - ( function() { @@ -6558,7 +6380,7 @@ var rtrimCSS = new RegExp( trChild = document.createElement( "div" ); table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "border:1px solid"; + tr.style.cssText = "box-sizing:content-box;border:1px solid"; // Support: Chrome 86+ // Height set through cssText does not get applied. @@ -6570,7 +6392,7 @@ var rtrimCSS = new RegExp( // In our bodyBackground.html iframe, // display for all div elements is set to "inline", // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is display: block + // Ensuring the div is `display: block` // gets around this issue. trChild.style.display = "block"; @@ -6608,17 +6430,37 @@ function curCSS( elem, name, computed ) { // .css('filter') (IE 9 only, trac-12537) // .css('--customProperty) (gh-3144) if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - // trim whitespace for custom property (issue gh-4926) - if ( isCustomProp ) { + // Support: IE <=9 - 11+ + // IE only supports `"float"` in `getPropertyValue`; in computed styles + // it's only available as `"cssFloat"`. We no longer modify properties + // sent to `.css()` apart from camelCasing, so we need to check both. + // Normally, this would create difference in behavior: if + // `getPropertyValue` returns an empty string, the value returned + // by `.css()` would be `undefined`. This is usually the case for + // disconnected elements. However, in IE even disconnected elements + // with no styles return `"none"` for `getPropertyValue( "float" )` + ret = computed.getPropertyValue( name ) || computed[ name ]; - // rtrim treats U+000D CARRIAGE RETURN and U+000C FORM FEED + if ( isCustomProp && ret ) { + + // Support: Firefox 105+, Chrome <=105+ + // Spec requires trimming whitespace for custom properties (gh-4926). + // Firefox only trims leading whitespace. Chrome just collapses + // both leading & trailing whitespace to a single space. + // + // Fall back to `undefined` if empty string returned. + // This collapses a missing definition with property defined + // and set to an empty string but there's no standard API + // allowing us to differentiate them without a performance penalty + // and returning `undefined` aligns with older jQuery. + // + // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED // as whitespace while CSS does not, but this is not a problem // because CSS preprocessing replaces them with U+000A LINE FEED // (which *is* CSS whitespace) // https://www.w3.org/TR/css-syntax-3/#input-preprocessing - ret = ret.replace( rtrimCSS, "$1" ); + ret = ret.replace( rtrimCSS, "$1" ) || undefined; } if ( ret === "" && !isAttached( elem ) ) { @@ -6737,7 +6579,8 @@ function setPositiveNumber( _elem, value, subtract ) { function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { var i = dimension === "width" ? 1 : 0, extra = 0, - delta = 0; + delta = 0, + marginDelta = 0; // Adjustment may not be necessary if ( box === ( isBorderBox ? "border" : "content" ) ) { @@ -6747,8 +6590,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed for ( ; i < 4; i += 2 ) { // Both box models exclude margin + // Count margin delta separately to only add it after scroll gutter adjustment. + // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); + marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); } // If we get here with a content-box, we're seeking "padding" or "border" or "margin" @@ -6799,7 +6644,7 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed ) ) || 0; } - return delta; + return delta + marginDelta; } function getWidthOrHeight( elem, dimension, extra ) { @@ -6897,26 +6742,35 @@ jQuery.extend( { // Don't automatically add "px" to these possibly-unitless properties cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true + animationIterationCount: true, + aspectRatio: true, + borderImageSlice: true, + columnCount: true, + flexGrow: true, + flexShrink: true, + fontWeight: true, + gridArea: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnStart: true, + gridRow: true, + gridRowEnd: true, + gridRowStart: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + scale: true, + widows: true, + zIndex: true, + zoom: true, + + // SVG-related + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeMiterlimit: true, + strokeOpacity: true }, // Add in properties whose names you wish to fix before @@ -8642,9 +8496,39 @@ jQuery.each( [ "radio", "checkbox" ], function() { // Return jQuery for attributes-only inclusion +var location = window.location; + +var nonce = { guid: Date.now() }; +var rquery = ( /\?/ ); -support.focusin = "onfocusin" in window; + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml, parserErrorElem; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) {} + + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); + } + return xml; +}; var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, @@ -8832,85 +8716,6 @@ jQuery.fn.extend( { } ); -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, parserErrorElem; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) {} - - parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; - if ( !xml || parserErrorElem ) { - jQuery.error( "Invalid XML: " + ( - parserErrorElem ? - jQuery.map( parserErrorElem.childNodes, function( el ) { - return el.textContent; - } ).join( "\n" ) : - data - ) ); - } - return xml; -}; - - var rbracket = /\[\]$/, rCRLF = /\r?\n/g, @@ -10755,7 +10560,9 @@ jQuery.fn.extend( { }, hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + return this + .on( "mouseenter", fnOver ) + .on( "mouseleave", fnOut || fnOver ); } } ); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.7.1.min.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.7.1.min.js new file mode 100644 index 00000000000..7f37b5d9912 --- /dev/null +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.7.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0 """, """ - + """, """ """, @@ -684,7 +684,7 @@ void checkJqueryAndImageFiles(boolean expectedOutput) { checkFiles(expectedOutput, "search.js", "jquery-ui.overrides.css", - "script-dir/jquery-3.6.1.min.js", + "script-dir/jquery-3.7.1.min.js", "script-dir/jquery-ui.min.js", "script-dir/jquery-ui.min.css", "resources/x.png", diff --git a/test/langtools/jdk/javadoc/doclet/testSearchScript/javadoc-search.js b/test/langtools/jdk/javadoc/doclet/testSearchScript/javadoc-search.js index 52c1b136035..660dc2b1e1b 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearchScript/javadoc-search.js +++ b/test/langtools/jdk/javadoc/doclet/testSearchScript/javadoc-search.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -36,7 +36,7 @@ function loadIndexFiles(docsPath) { tryLoad(docsPath, "type-search-index.js"); tryLoad(docsPath, "member-search-index.js"); tryLoad(docsPath, "tag-search-index.js"); - load(docsPath + "/search.js"); + load(docsPath + "/script-files/search.js"); } function tryLoad(docsPath, file) { @@ -62,6 +62,12 @@ var $ = function(f) { f(); } else { return { + attr: function() { + return this; + }, + css: function() { + return this; + }, val: function() { return this; }, diff --git a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java index 0e2641ca04e..f7a5ba4fb80 100644 --- a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java +++ b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java @@ -200,7 +200,7 @@ protected void error(String msg) { "help-doc.html", "index-all.html", "index.html", - "script-dir/jquery-3.6.1.min.js", + "script-dir/jquery-3.7.1.min.js", "script-dir/jquery-ui.min.js", "script-dir/jquery-ui.min.css", "member-search-index.js", From 009016187acdca30a038b34cc0b4fa4eafca8455 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 4 Jul 2024 07:53:09 +0000 Subject: [PATCH 147/329] 8332524: Instead of printing "TLSv1.3," it is showing "TLS13" Backport-of: e681b4e9b3ae24f45d8c6adab4105df39e6b8a92 --- .../share/classes/sun/security/ssl/ClientHello.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/ClientHello.java b/src/java.base/share/classes/sun/security/ssl/ClientHello.java index be06d5b9024..63d82bfb64f 100644 --- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -904,8 +904,8 @@ private ProtocolVersion negotiateProtocol( throw context.conContext.fatal(Alert.PROTOCOL_VERSION, "The client supported protocol versions " + Arrays.toString( ProtocolVersion.toStringArray(clientSupportedVersions)) + - " are not accepted by server preferences " + - context.activeProtocols); + " are not accepted by server preferences " + Arrays.toString( + ProtocolVersion.toStringArray(context.activeProtocols))); } } From c025eb6ed0728392f6ce00570768bab216857943 Mon Sep 17 00:00:00 2001 From: Scott Gibbons Date: Thu, 4 Jul 2024 16:07:32 +0000 Subject: [PATCH 148/329] 8330611: AES-CTR vector intrinsic may read out of bounds (x86_64, AVX-512) Reviewed-by: sviswanathan, chagedorn Backport-of: 8a8d9288980513db459f7d6b36554b65844951ca --- src/hotspot/cpu/x86/assembler_x86.cpp | 8 ++++++++ src/hotspot/cpu/x86/assembler_x86.hpp | 1 + src/hotspot/cpu/x86/macroAssembler_x86_aes.cpp | 18 +++++++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index 4817080c139..b24778aee30 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -5811,6 +5811,14 @@ void Assembler::xorw(Register dst, Register src) { emit_arith(0x33, 0xC0, dst, src); } +void Assembler::xorw(Register dst, Address src) { + InstructionMark im(this); + emit_int8(0x66); + prefix(src, dst); + emit_int8(0x33); + emit_operand(dst, src, 0); +} + // AVX 3-operands scalar float-point arithmetic instructions void Assembler::vaddsd(XMMRegister dst, XMMRegister nds, Address src) { diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index 09ca79a02d1..d6c6a5d01ef 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -2115,6 +2115,7 @@ class Assembler : public AbstractAssembler { void xorb(Address dst, Register src); void xorb(Register dst, Address src); void xorw(Register dst, Register src); + void xorw(Register dst, Address src); void xorq(Register dst, Address src); void xorq(Address dst, int32_t imm32); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_aes.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_aes.cpp index dcc48a6c1f0..78372e1408c 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_aes.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_aes.cpp @@ -798,6 +798,7 @@ void MacroAssembler::aesctr_encrypt(Register src_addr, Register dest_addr, Regis const Register rounds = 0; const Register pos = r12; + const Register tail = r15; Label PRELOOP_START, EXIT_PRELOOP, REMAINDER, REMAINDER_16, LOOP, END, EXIT, END_LOOP, AES192, AES256, AES192_REMAINDER16, REMAINDER16_END_LOOP, AES256_REMAINDER16, @@ -1228,29 +1229,36 @@ void MacroAssembler::aesctr_encrypt(Register src_addr, Register dest_addr, Regis // Save encrypted counter value in xmm0 for next invocation, before XOR operation movdqu(Address(saved_encCounter_start, 0), xmm0); // XOR encryted block cipher in xmm0 with PT to produce CT - evpxorq(xmm0, xmm0, Address(src_addr, pos, Address::times_1, 0), Assembler::AVX_128bit); // extract upto 15 bytes of CT from xmm0 as specified by length register testptr(len_reg, 8); jcc(Assembler::zero, EXTRACT_TAIL_4BYTES); - pextrq(Address(dest_addr, pos), xmm0, 0); + pextrq(tail, xmm0, 0); + xorq(tail, Address(src_addr, pos, Address::times_1, 0)); + movq(Address(dest_addr, pos), tail); psrldq(xmm0, 8); addl(pos, 8); bind(EXTRACT_TAIL_4BYTES); testptr(len_reg, 4); jcc(Assembler::zero, EXTRACT_TAIL_2BYTES); - pextrd(Address(dest_addr, pos), xmm0, 0); + pextrd(tail, xmm0, 0); + xorl(tail, Address(src_addr, pos, Address::times_1, 0)); + movl(Address(dest_addr, pos), tail); psrldq(xmm0, 4); addq(pos, 4); bind(EXTRACT_TAIL_2BYTES); testptr(len_reg, 2); jcc(Assembler::zero, EXTRACT_TAIL_1BYTE); - pextrw(Address(dest_addr, pos), xmm0, 0); + pextrw(tail, xmm0, 0); + xorw(tail, Address(src_addr, pos, Address::times_1, 0)); + movw(Address(dest_addr, pos), tail); psrldq(xmm0, 2); addl(pos, 2); bind(EXTRACT_TAIL_1BYTE); testptr(len_reg, 1); jcc(Assembler::zero, END); - pextrb(Address(dest_addr, pos), xmm0, 0); + pextrb(tail, xmm0, 0); + xorb(tail, Address(src_addr, pos, Address::times_1, 0)); + movb(Address(dest_addr, pos), tail); addl(pos, 1); bind(END); From c0869dbd7b5114f25a753d3379e16bfb123c7a6e Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 5 Jul 2024 05:42:50 +0000 Subject: [PATCH 149/329] 8291760: PipelineLeaksFD.java still fails: More or fewer pipes than expected Reviewed-by: sgehwolf Backport-of: 4e457acda09be57dbb49b5c89123bf79bf81f38c --- .../lang/ProcessBuilder/PipelineLeaksFD.java | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/jdk/java/lang/ProcessBuilder/PipelineLeaksFD.java b/test/jdk/java/lang/ProcessBuilder/PipelineLeaksFD.java index 4f572610b9d..d3c44bc9279 100644 --- a/test/jdk/java/lang/ProcessBuilder/PipelineLeaksFD.java +++ b/test/jdk/java/lang/ProcessBuilder/PipelineLeaksFD.java @@ -25,10 +25,10 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.Writer; import java.nio.file.Files; import java.nio.file.Path; import java.util.HashSet; @@ -37,9 +37,9 @@ /* * @test - * @bug 8289643 + * @bug 8289643 8291760 * @requires (os.family == "linux" & !vm.musl) - * @summary file descriptor leak with ProcessBuilder.startPipeline + * @summary File descriptor leak detection with ProcessBuilder.startPipeline * @run testng/othervm PipelineLeaksFD */ @@ -68,26 +68,27 @@ void checkForLeaks(List builders) throws IOException { Assert.fail("There should be at least 3 pipes before, (0, 1, 2)"); } - // Redirect all of the error streams to stdout (except the last) - // so those file descriptors are not left open - for (int i = 0; i < builders.size() - 1; i++) { - builders.get(i).redirectErrorStream(true); - } - List processes = ProcessBuilder.startPipeline(builders); // Write something through the pipeline - try (OutputStream out = processes.get(0).getOutputStream()) { - out.write('a'); + final String text = "xyz"; + try (Writer out = processes.get(0).outputWriter()) { + out.write(text); } - Process last = processes.get(processes.size() - 1); - try (InputStream inputStream = last.getInputStream(); - InputStream errorStream = last.getErrorStream()) { - byte[] bytes = inputStream.readAllBytes(); - Assert.assertEquals(bytes.length, 1, "stdout bytes read"); - byte[] errBytes = errorStream.readAllBytes(); - Assert.assertEquals(errBytes.length, 0, "stderr bytes read"); + // Read, check, and close all streams + for (int i = 0; i < processes.size(); i++) { + final Process p = processes.get(i); + String expectedOut = (i == processes.size() - 1) ? text : null; + String expectedErr = null; // EOF + try (BufferedReader inputStream = p.inputReader(); + BufferedReader errorStream = p.errorReader()) { + String outActual = inputStream.readLine(); + Assert.assertEquals(outActual, expectedOut, "stdout, process[ " + i + "]: " + p); + + String errActual = errorStream.readLine(); + Assert.assertEquals(errActual, expectedErr, "stderr, process[ " + i + "]: " + p); + } } processes.forEach(p -> waitForQuiet(p)); From 123b973a3b134f8173d4d313948b1d7dcd347b16 Mon Sep 17 00:00:00 2001 From: George Adams Date: Fri, 5 Jul 2024 07:11:16 +0000 Subject: [PATCH 150/329] 8296812: sprintf is deprecated in Xcode 14 Reviewed-by: sgehwolf Backport-of: 478ef389dc3767edfbe21d10a7f7f1522c648c2e --- .../cpu/aarch64/vm_version_aarch64.cpp | 4 +- src/hotspot/os/bsd/attachListener_bsd.cpp | 12 ++-- src/hotspot/os/bsd/os_bsd.cpp | 25 ++++---- src/hotspot/share/adlc/adlc.hpp | 4 ++ src/hotspot/share/adlc/adlparse.cpp | 25 ++++---- src/hotspot/share/adlc/archDesc.cpp | 4 +- src/hotspot/share/adlc/dfa.cpp | 6 +- src/hotspot/share/adlc/formssel.cpp | 11 ++-- src/hotspot/share/adlc/main.cpp | 2 +- src/hotspot/share/adlc/output_c.cpp | 57 ++++++++++++------- src/hotspot/share/c1/c1_Runtime1.cpp | 4 +- src/hotspot/share/cds/filemap.cpp | 2 +- src/hotspot/share/classfile/javaClasses.cpp | 17 +++--- src/hotspot/share/code/dependencies.cpp | 3 +- src/hotspot/share/compiler/compileBroker.cpp | 8 +-- .../share/interpreter/bootstrapInfo.cpp | 8 +-- .../share/jvmci/jvmciCompilerToVMInit.cpp | 6 +- .../share/prims/wbtestmethods/parserTests.cpp | 2 +- src/hotspot/share/runtime/deoptimization.cpp | 6 +- src/hotspot/share/runtime/os.cpp | 12 +++- src/hotspot/share/runtime/os.hpp | 4 ++ src/hotspot/share/runtime/perfData.cpp | 7 ++- src/hotspot/share/utilities/debug.cpp | 2 +- src/hotspot/share/utilities/utf8.cpp | 5 +- .../libjsound/PLATFORM_API_MacOSX_Ports.cpp | 2 +- 25 files changed, 140 insertions(+), 98 deletions(-) diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 1b115263f9e..0d53be49de5 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -237,8 +237,8 @@ void VM_Version::initialize() { if (_cpu == CPU_ARM && (_model == 0xd07 || _model2 == 0xd07)) _features |= CPU_STXR_PREFETCH; char buf[512]; - sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision); - if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2); + int buf_used_len = os::snprintf_checked(buf, sizeof(buf), "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision); + if (_model2) os::snprintf_checked(buf + buf_used_len, sizeof(buf) - buf_used_len, "(0x%03x)", _model2); #define ADD_FEATURE_IF_SUPPORTED(id, name, bit) if (_features & CPU_##id) strcat(buf, ", " name); CPU_FEATURE_FLAGS(ADD_FEATURE_IF_SUPPORTED) #undef ADD_FEATURE_IF_SUPPORTED diff --git a/src/hotspot/os/bsd/attachListener_bsd.cpp b/src/hotspot/os/bsd/attachListener_bsd.cpp index b8702c5aa76..a79df5dbdd4 100644 --- a/src/hotspot/os/bsd/attachListener_bsd.cpp +++ b/src/hotspot/os/bsd/attachListener_bsd.cpp @@ -247,7 +247,7 @@ int BsdAttachListener::init() { // BsdAttachOperation* BsdAttachListener::read_request(int s) { char ver_str[8]; - sprintf(ver_str, "%d", ATTACH_PROTOCOL_VER); + size_t ver_str_len = os::snprintf_checked(ver_str, sizeof(ver_str), "%d", ATTACH_PROTOCOL_VER); // The request is a sequence of strings so we first figure out the // expected count and the maximum possible length of the request. @@ -287,11 +287,11 @@ BsdAttachOperation* BsdAttachListener::read_request(int s) { // The first string is so check it now to // check for protocol mis-match if (str_count == 1) { - if ((strlen(buf) != strlen(ver_str)) || + if ((strlen(buf) != ver_str_len) || (atoi(buf) != ATTACH_PROTOCOL_VER)) { char msg[32]; - sprintf(msg, "%d\n", ATTACH_ERROR_BADVERSION); - write_fully(s, msg, strlen(msg)); + int msg_len = os::snprintf_checked(msg, sizeof(msg), "%d\n", ATTACH_ERROR_BADVERSION); + write_fully(s, msg, msg_len); return NULL; } } @@ -410,8 +410,8 @@ void BsdAttachOperation::complete(jint result, bufferedStream* st) { // write operation result char msg[32]; - sprintf(msg, "%d\n", result); - int rc = BsdAttachListener::write_fully(this->socket(), msg, strlen(msg)); + int msg_len = os::snprintf_checked(msg, sizeof(msg), "%d\n", result); + int rc = BsdAttachListener::write_fully(this->socket(), msg, msg_len); // write any result data if (rc == 0) { diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index e8322c21bc4..65101650372 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -338,7 +338,7 @@ void os::init_system_properties_values() { #ifndef __APPLE__ - // Buffer that fits several sprintfs. + // Buffer that fits several snprintfs. // Note that the space for the colon and the trailing null are provided // by the nulls included by the sizeof operator. const size_t bufsize = @@ -394,17 +394,16 @@ void os::init_system_properties_values() { const char *v_colon = ":"; if (v == NULL) { v = ""; v_colon = ""; } // That's +1 for the colon and +1 for the trailing '\0'. - char *ld_library_path = NEW_C_HEAP_ARRAY(char, - strlen(v) + 1 + - sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch) + sizeof(DEFAULT_LIBPATH) + 1, - mtInternal); - sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch); + const size_t ld_library_path_size = strlen(v) + 1 + sizeof(SYS_EXT_DIR) + + sizeof("/lib/") + strlen(cpu_arch) + sizeof(DEFAULT_LIBPATH) + 1; + char *ld_library_path = NEW_C_HEAP_ARRAY(char, ld_library_path_size, mtInternal); + os::snprintf_checked(ld_library_path, ld_library_path_size, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch); Arguments::set_library_path(ld_library_path); FREE_C_HEAP_ARRAY(char, ld_library_path); } // Extensions directories. - sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home()); + os::snprintf_checked(buf, bufsize, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home()); Arguments::set_ext_dirs(buf); FREE_C_HEAP_ARRAY(char, buf); @@ -419,7 +418,7 @@ void os::init_system_properties_values() { size_t system_ext_size = strlen(user_home_dir) + sizeof(SYS_EXTENSIONS_DIR) + sizeof(SYS_EXTENSIONS_DIRS); - // Buffer that fits several sprintfs. + // Buffer that fits several snprintfs. // Note that the space for the colon and the trailing null are provided // by the nulls included by the sizeof operator. const size_t bufsize = @@ -489,11 +488,9 @@ void os::init_system_properties_values() { // could cause a change in behavior, but Apple's Java6 behavior // can be achieved by putting "." at the beginning of the // JAVA_LIBRARY_PATH environment variable. - char *ld_library_path = NEW_C_HEAP_ARRAY(char, - strlen(v) + 1 + strlen(l) + 1 + - system_ext_size + 3, - mtInternal); - sprintf(ld_library_path, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.", + const size_t ld_library_path_size = strlen(v) + 1 + strlen(l) + 1 + system_ext_size + 3; + char *ld_library_path = NEW_C_HEAP_ARRAY(char, ld_library_path_size, mtInternal); + os::snprintf_checked(ld_library_path, ld_library_path_size, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.", v, v_colon, l, l_colon, user_home_dir); Arguments::set_library_path(ld_library_path); FREE_C_HEAP_ARRAY(char, ld_library_path); @@ -504,7 +501,7 @@ void os::init_system_properties_values() { // Note that the space for the colon and the trailing null are provided // by the nulls included by the sizeof operator (so actually one byte more // than necessary is allocated). - sprintf(buf, "%s" SYS_EXTENSIONS_DIR ":%s" EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS, + os::snprintf_checked(buf, bufsize, "%s" SYS_EXTENSIONS_DIR ":%s" EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS, user_home_dir, Arguments::get_java_home()); Arguments::set_ext_dirs(buf); diff --git a/src/hotspot/share/adlc/adlc.hpp b/src/hotspot/share/adlc/adlc.hpp index 19567f05d40..ec3a0c4e153 100644 --- a/src/hotspot/share/adlc/adlc.hpp +++ b/src/hotspot/share/adlc/adlc.hpp @@ -108,4 +108,8 @@ typedef unsigned int uintptr_t; // it everywhere it needs to be available. extern ArchDesc* globalAD; +// Performs snprintf and asserts the result is non-negative (so there was not +// an encoding error) and that the output was not truncated. +extern int snprintf_checked(char* buf, size_t len, const char* fmt, ...); + #endif // SHARE_ADLC_ADLC_HPP diff --git a/src/hotspot/share/adlc/adlparse.cpp b/src/hotspot/share/adlc/adlparse.cpp index 283713bb1f8..bcbf3ab7e1b 100644 --- a/src/hotspot/share/adlc/adlparse.cpp +++ b/src/hotspot/share/adlc/adlparse.cpp @@ -211,8 +211,9 @@ void ADLParser::instr_parse(void) { return; } assert(match_rules_cnt < 100," too many match rule clones"); - char* buf = (char*) AdlAllocateHeap(strlen(instr->_ident) + 4); - sprintf(buf, "%s_%d", instr->_ident, match_rules_cnt++); + const size_t buf_size = strlen(instr->_ident) + 4; + char* buf = (char*) AdlAllocateHeap(buf_size); + snprintf_checked(buf, buf_size, "%s_%d", instr->_ident, match_rules_cnt++); rule->_result = buf; // Check for commutative operations with tree operands. matchrule_clone_and_swap(rule, instr->_ident, match_rules_cnt); @@ -2805,8 +2806,9 @@ void ADLParser::ins_encode_parse_block(InstructForm& inst) { // Create a new encoding name based on the name of the instruction // definition, which should be unique. const char* prefix = "__ins_encode_"; - char* ec_name = (char*) AdlAllocateHeap(strlen(inst._ident) + strlen(prefix) + 1); - sprintf(ec_name, "%s%s", prefix, inst._ident); + const size_t ec_name_size = strlen(inst._ident) + strlen(prefix) + 1; + char* ec_name = (char*) AdlAllocateHeap(ec_name_size); + snprintf_checked(ec_name, ec_name_size, "%s%s", prefix, inst._ident); assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist"); EncClass* encoding = _AD._encode->add_EncClass(ec_name); @@ -3276,8 +3278,9 @@ void ADLParser::constant_parse(InstructForm& inst) { // Create a new encoding name based on the name of the instruction // definition, which should be unique. const char* prefix = "__constant_"; - char* ec_name = (char*) AdlAllocateHeap(strlen(inst._ident) + strlen(prefix) + 1); - sprintf(ec_name, "%s%s", prefix, inst._ident); + const size_t ec_name_size = strlen(inst._ident) + strlen(prefix) + 1; + char* ec_name = (char*) AdlAllocateHeap(ec_name_size); + snprintf_checked(ec_name, ec_name_size, "%s%s", prefix, inst._ident); assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist"); EncClass* encoding = _AD._encode->add_EncClass(ec_name); @@ -4596,8 +4599,9 @@ char *ADLParser::get_ident_or_literal_constant(const char* description) { // Grab a constant expression. param = get_paren_expr(description); if (param[0] != '(') { - char* buf = (char*) AdlAllocateHeap(strlen(param) + 3); - sprintf(buf, "(%s)", param); + const size_t buf_size = strlen(param) + 3; + char* buf = (char*) AdlAllocateHeap(buf_size); + snprintf_checked(buf, buf_size, "(%s)", param); param = buf; } assert(is_literal_constant(param), @@ -5204,8 +5208,9 @@ void ADLParser::next_line() { char* ADLParser::get_line_string(int linenum) { const char* file = _AD._ADL_file._name; int line = linenum ? linenum : this->linenum(); - char* location = (char *)AdlAllocateHeap(strlen(file) + 100); - sprintf(location, "\n#line %d \"%s\"\n", line, file); + const size_t location_size = strlen(file) + 100; + char* location = (char *)AdlAllocateHeap(location_size); + snprintf_checked(location, location_size, "\n#line %d \"%s\"\n", line, file); return location; } diff --git a/src/hotspot/share/adlc/archDesc.cpp b/src/hotspot/share/adlc/archDesc.cpp index cd9aab9e2ed..1d83cb18117 100644 --- a/src/hotspot/share/adlc/archDesc.cpp +++ b/src/hotspot/share/adlc/archDesc.cpp @@ -815,7 +815,7 @@ static const char *getRegMask(const char *reg_class_name) { const char *mask = "_mask"; int length = (int)strlen(rc_name) + (int)strlen(mask) + 5; char *regMask = new char[length]; - sprintf(regMask,"%s%s()", rc_name, mask); + snprintf_checked(regMask, length, "%s%s()", rc_name, mask); delete[] rc_name; return regMask; } @@ -908,7 +908,7 @@ char *ArchDesc::stack_or_reg_mask(OperandForm &opForm) { const char *stack_or = "STACK_OR_"; int length = (int)strlen(stack_or) + (int)strlen(reg_mask_name) + 1; char *result = new char[length]; - sprintf(result,"%s%s", stack_or, reg_mask_name); + snprintf_checked(result, length, "%s%s", stack_or, reg_mask_name); return result; } diff --git a/src/hotspot/share/adlc/dfa.cpp b/src/hotspot/share/adlc/dfa.cpp index 5abc4365297..b277c5c63f0 100644 --- a/src/hotspot/share/adlc/dfa.cpp +++ b/src/hotspot/share/adlc/dfa.cpp @@ -207,13 +207,13 @@ Expr *ArchDesc::calc_cost(FILE *fp, const char *spaces, MatchList &mList, Produc Expr *c = new Expr("0"); if (mList._lchild) { // If left child, add it in const char* lchild_to_upper = ArchDesc::getMachOperEnum(mList._lchild); - sprintf(Expr::buffer(), "_kids[0]->_cost[%s]", lchild_to_upper); + snprintf_checked(Expr::buffer(), STRING_BUFFER_LENGTH, "_kids[0]->_cost[%s]", lchild_to_upper); c->add(Expr::buffer()); delete[] lchild_to_upper; } if (mList._rchild) { // If right child, add it in const char* rchild_to_upper = ArchDesc::getMachOperEnum(mList._rchild); - sprintf(Expr::buffer(), "_kids[1]->_cost[%s]", rchild_to_upper); + snprintf_checked(Expr::buffer(), STRING_BUFFER_LENGTH, "_kids[1]->_cost[%s]", rchild_to_upper); c->add(Expr::buffer()); delete[] rchild_to_upper; } @@ -730,7 +730,7 @@ const char *Expr::compute_expr(const Expr *c1, const Expr *c2) { snprintf(string_buffer, STRING_BUFFER_LENGTH, "%s", c2->_expr); } else { - sprintf( string_buffer, "0"); + snprintf_checked(string_buffer, STRING_BUFFER_LENGTH, "0"); } string_buffer[STRING_BUFFER_LENGTH - 1] = '\0'; char *cost = strdup(string_buffer); diff --git a/src/hotspot/share/adlc/formssel.cpp b/src/hotspot/share/adlc/formssel.cpp index 854b1b310e4..bcedd6b32da 100644 --- a/src/hotspot/share/adlc/formssel.cpp +++ b/src/hotspot/share/adlc/formssel.cpp @@ -25,6 +25,8 @@ // FORMS.CPP - Definitions for ADL Parser Forms Classes #include "adlc.hpp" +#define remaining_buflen(buffer, position) (sizeof(buffer) - ((position) - (buffer))) + //==============================Instructions=================================== //------------------------------InstructForm----------------------------------- InstructForm::InstructForm(const char *id, bool ideal_only) @@ -1538,7 +1540,7 @@ Predicate *InstructForm::build_predicate() { s += strlen(s); } // Add predicate to working buffer - sprintf(s,"/*%s*/(",(char*)i._key); + snprintf_checked(s, remaining_buflen(buf, s), "/*%s*/(",(char*)i._key); s += strlen(s); mnode->build_instr_pred(s,(char*)i._key, 0, path_bitmask, 0); s += strlen(s); @@ -3476,7 +3478,7 @@ void MatchNode::build_internalop( ) { _rChild->_internalop : _rChild->_opType) : ""; len += (int)strlen(lstr) + (int)strlen(rstr); subtree = (char *)AdlAllocateHeap(len); - sprintf(subtree,"_%s_%s_%s", _opType, lstr, rstr); + snprintf_checked(subtree, len, "_%s_%s_%s", _opType, lstr, rstr); // Hash the subtree string in _internalOps; if a name exists, use it iop = (char *)_AD._internalOps[subtree]; // Else create a unique name, and add it to the hash table @@ -3898,8 +3900,9 @@ void MatchRule::matchrule_swap_commutative_op(const char* instr_ident, int count MatchRule* clone = new MatchRule(_AD, this); // Swap operands of commutative operation ((MatchNode*)clone)->swap_commutative_op(true, count); - char* buf = (char*) AdlAllocateHeap(strlen(instr_ident) + 4); - sprintf(buf, "%s_%d", instr_ident, match_rules_cnt++); + const size_t buf_size = strlen(instr_ident) + 4; + char* buf = (char*) AdlAllocateHeap(buf_size); + snprintf_checked(buf, buf_size, "%s_%d", instr_ident, match_rules_cnt++); clone->_result = buf; clone->_next = this->_next; diff --git a/src/hotspot/share/adlc/main.cpp b/src/hotspot/share/adlc/main.cpp index 6f6c1bc6e30..5ffd258dc96 100644 --- a/src/hotspot/share/adlc/main.cpp +++ b/src/hotspot/share/adlc/main.cpp @@ -467,7 +467,7 @@ static char *base_plus_suffix(const char* base, const char *suffix) int len = (int)strlen(base) + (int)strlen(suffix) + 1; char* fname = new char[len]; - sprintf(fname,"%s%s",base,suffix); + snprintf_checked(fname,len,"%s%s",base,suffix); return fname; } diff --git a/src/hotspot/share/adlc/output_c.cpp b/src/hotspot/share/adlc/output_c.cpp index 0a183ab2602..5c7d7ab7e31 100644 --- a/src/hotspot/share/adlc/output_c.cpp +++ b/src/hotspot/share/adlc/output_c.cpp @@ -26,6 +26,8 @@ #include "adlc.hpp" +#define remaining_buflen(buffer, position) (sizeof(buffer) - (position - buffer)) + // Utilities to characterize effect statements static bool is_def(int usedef) { switch(usedef) { @@ -35,6 +37,16 @@ static bool is_def(int usedef) { return false; } +int snprintf_checked(char* buf, size_t len, const char* fmt, ...) { + va_list args; + va_start(args, fmt); + int result = vsnprintf(buf, len, fmt, args); + va_end(args); + assert(result >= 0, "snprintf error"); + assert(static_cast(result) < len, "snprintf truncated"); + return result; +} + // Define an array containing the machine register names, strings. static void defineRegNames(FILE *fp, RegisterForm *registers) { if (registers) { @@ -197,7 +209,8 @@ static int pipeline_reads_initializer(FILE *fp_cpp, NameList &pipeline_reads, Pi return -1; } - char *operand_stages = new char [templen]; + const size_t operand_stages_size = templen; + char *operand_stages = new char [operand_stages_size]; operand_stages[0] = 0; int i = 0; templen = 0; @@ -211,7 +224,7 @@ static int pipeline_reads_initializer(FILE *fp_cpp, NameList &pipeline_reads, Pi while ( (paramname = pipeclass->_parameters.iter()) != NULL ) { const PipeClassOperandForm *tmppipeopnd = (const PipeClassOperandForm *)pipeclass->_localUsage[paramname]; - templen += sprintf(&operand_stages[templen], " stage_%s%c\n", + templen += snprintf_checked(&operand_stages[templen], operand_stages_size - templen, " stage_%s%c\n", tmppipeopnd ? tmppipeopnd->_stage : "undefined", (++i < paramcount ? ',' : ' ') ); } @@ -278,6 +291,7 @@ static int pipeline_res_stages_initializer( int templen = 1 + commentlen + pipeline->_rescount * (max_stage + 14); // Allocate space for the resource list + const size_t resource_stages_size = templen; char * resource_stages = new char [templen]; templen = 0; @@ -285,7 +299,7 @@ static int pipeline_res_stages_initializer( const char * const resname = res_stages[i] == 0 ? "undefined" : pipeline->_stages.name(res_stages[i]-1); - templen += sprintf(&resource_stages[templen], " stage_%s%-*s // %s\n", + templen += snprintf_checked(&resource_stages[templen], resource_stages_size - templen, " stage_%s%-*s // %s\n", resname, max_stage - (int)strlen(resname) + 1, (i < pipeline->_rescount-1) ? "," : "", pipeline->_reslist.name(i)); @@ -344,7 +358,7 @@ static int pipeline_res_cycles_initializer( for (i = 0; i < pipeline->_rescount; i++) { if (max_cycles < res_cycles[i]) max_cycles = res_cycles[i]; - templen = sprintf(temp, "%d", res_cycles[i]); + templen = snprintf_checked(temp, sizeof(temp), "%d", res_cycles[i]); if (cyclelen < templen) cyclelen = templen; commentlen += (int)strlen(pipeline->_reslist.name(i)); @@ -353,12 +367,13 @@ static int pipeline_res_cycles_initializer( templen = 1 + commentlen + (cyclelen + 8) * pipeline->_rescount; // Allocate space for the resource list - char * resource_cycles = new char [templen]; + const size_t resource_cycles_size = templen; + char * resource_cycles = new char [resource_cycles_size]; templen = 0; for (i = 0; i < pipeline->_rescount; i++) { - templen += sprintf(&resource_cycles[templen], " %*d%c // %s\n", + templen += snprintf_checked(&resource_cycles[templen], resource_cycles_size - templen, " %*d%c // %s\n", cyclelen, res_cycles[i], (i < pipeline->_rescount-1) ? ',' : ' ', pipeline->_reslist.name(i)); } @@ -431,7 +446,8 @@ static int pipeline_res_mask_initializer( (cyclemasksize * 12) + masklen + (cycledigit * 2) + 30) * element_count; // Allocate space for the resource list - char * resource_mask = new char [templen]; + const size_t resource_mask_size = templen; + char * resource_mask = new char [resource_mask_size]; char * last_comma = NULL; templen = 0; @@ -456,7 +472,7 @@ static int pipeline_res_mask_initializer( } int formatlen = - sprintf(&resource_mask[templen], " %s(0x%0*x, %*d, %*d, %s %s(", + snprintf_checked(&resource_mask[templen], resource_mask_size - templen, " %s(0x%0*x, %*d, %*d, %s %s(", pipeline_use_element, masklen, used_mask, cycledigit, lb, cycledigit, ub, @@ -496,7 +512,7 @@ static int pipeline_res_mask_initializer( for (j = cyclemasksize-1; j >= 0; j--) { formatlen = - sprintf(&resource_mask[templen], "0x%08x%s", res_mask[j], j > 0 ? ", " : ""); + snprintf_checked(&resource_mask[templen], resource_mask_size - templen, "0x%08x%s", res_mask[j], j > 0 ? ", " : ""); templen += formatlen; } @@ -527,9 +543,8 @@ static int pipeline_res_mask_initializer( // "0x012345678, 0x012345678, 4294967295" char* args = new char [36 + 1]; - int printed = sprintf(args, "0x%x, 0x%x, %u", - resources_used, resources_used_exclusively, element_count); - assert(printed <= 36, "overflow"); + snprintf_checked(args, 36 + 1, "0x%x, 0x%x, %u", + resources_used, resources_used_exclusively, element_count); pipeline_res_args.addName(args); } @@ -1066,9 +1081,9 @@ static void build_instruction_index_mapping( FILE *fp, FormDict &globals, PeepMa InstructForm *inst = globals[inst_name]->is_instruction(); if( inst != NULL ) { char inst_prefix[] = "instXXXX_"; - sprintf(inst_prefix, "inst%d_", inst_position); + snprintf_checked(inst_prefix, sizeof(inst_prefix), "inst%d_", inst_position); char receiver[] = "instXXXX->"; - sprintf(receiver, "inst%d->", inst_position); + snprintf_checked(receiver, sizeof(receiver), "inst%d->", inst_position); inst->index_temps( fp, globals, inst_prefix, receiver ); } } @@ -1162,7 +1177,7 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch char left_reg_index[] = ",inst4294967295_idx4294967295"; if( left_op_index != 0 ) { // Must have index into operands - sprintf(left_reg_index,",inst%u_idx%u", (unsigned)left_index, (unsigned)left_op_index); + snprintf_checked(left_reg_index, sizeof(left_reg_index), ",inst%u_idx%u", (unsigned)left_index, (unsigned)left_op_index); } else { strcpy(left_reg_index, ""); } @@ -1174,7 +1189,7 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch char right_reg_index[] = ",inst4294967295_idx4294967295"; if( right_op_index != 0 ) { // Must have index into operands - sprintf(right_reg_index,",inst%u_idx%u", (unsigned)right_index, (unsigned)right_op_index); + snprintf_checked(right_reg_index, sizeof(right_reg_index), ",inst%u_idx%u", (unsigned)right_index, (unsigned)right_op_index); } else { strcpy(right_reg_index, ""); } @@ -2516,19 +2531,19 @@ void ArchDesc::define_postalloc_expand(FILE *fp, InstructForm &inst) { const char* arg_name = ins_encode->rep_var_name(inst, param_no); int idx = inst.operand_position_format(arg_name); if (strcmp(arg_name, "constanttablebase") == 0) { - ib += sprintf(ib, " unsigned idx_%-5s = mach_constant_base_node_input(); \t// %s, \t%s\n", + ib += snprintf_checked(ib, remaining_buflen(idxbuf, ib), " unsigned idx_%-5s = mach_constant_base_node_input(); \t// %s, \t%s\n", name, type, arg_name); - nb += sprintf(nb, " Node *n_%-7s = lookup(idx_%s);\n", name, name); + nb += snprintf_checked(nb, remaining_buflen(nbuf, nb), " Node *n_%-7s = lookup(idx_%s);\n", name, name); // There is no operand for the constanttablebase. } else if (inst.is_noninput_operand(idx)) { globalAD->syntax_err(inst._linenum, "In %s: you can not pass the non-input %s to a postalloc expand encoding.\n", inst._ident, arg_name); } else { - ib += sprintf(ib, " unsigned idx_%-5s = idx%d; \t// %s, \t%s\n", + ib += snprintf_checked(ib, remaining_buflen(idxbuf, ib), " unsigned idx_%-5s = idx%d; \t// %s, \t%s\n", name, idx, type, arg_name); - nb += sprintf(nb, " Node *n_%-7s = lookup(idx_%s);\n", name, name); - ob += sprintf(ob, " %sOper *op_%s = (%sOper *)opnd_array(%d);\n", type, name, type, idx); + nb += snprintf_checked(nb, remaining_buflen(nbuf, nb), " Node *n_%-7s = lookup(idx_%s);\n", name, name); + ob += snprintf_checked(ob, remaining_buflen(opbuf, ob), " %sOper *op_%s = (%sOper *)opnd_array(%d);\n", type, name, type, idx); } param_no++; } diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index fb178432d8b..14cf71eb09a 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -657,7 +657,7 @@ JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* current, int i const int len = 35; assert(len < strlen("Index %d out of bounds for length %d"), "Must allocate more space for message."); char message[2 * jintAsStringSize + len]; - sprintf(message, "Index %d out of bounds for length %d", index, a->length()); + os::snprintf_checked(message, sizeof(message), "Index %d out of bounds for length %d", index, a->length()); SharedRuntime::throw_and_post_jvmti_exception(current, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message); JRT_END @@ -665,7 +665,7 @@ JRT_END JRT_ENTRY(void, Runtime1::throw_index_exception(JavaThread* current, int index)) NOT_PRODUCT(_throw_index_exception_count++;) char message[16]; - sprintf(message, "%d", index); + os::snprintf_checked(message, sizeof(message), "%d", index); SharedRuntime::throw_and_post_jvmti_exception(current, vmSymbols::java_lang_IndexOutOfBoundsException(), message); JRT_END diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index fdad263a316..a045b18e41c 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -158,7 +158,7 @@ template static void get_header_version(char (&header_version) [N]) { strncpy(header_version, vm_version, JVM_IDENT_MAX-9); // Append the hash code as eight hex digits. - sprintf(&header_version[JVM_IDENT_MAX-9], "%08x", hash); + os::snprintf_checked(&header_version[JVM_IDENT_MAX-9], 9, "%08x", hash); header_version[JVM_IDENT_MAX-1] = 0; // Null terminate. } diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index bf817989dc1..cac737125f1 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -2375,17 +2375,18 @@ static void print_stack_element_to_stream(outputStream* st, Handle mirror, int m } // Allocate temporary buffer with extra space for formatting and line number - char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64); + const size_t buf_size = buf_len + 64; + char* buf = NEW_RESOURCE_ARRAY(char, buf_size); // Print stack trace line in buffer - sprintf(buf, "\tat %s.%s(", klass_name, method_name); + size_t buf_off = os::snprintf_checked(buf, buf_size, "\tat %s.%s(", klass_name, method_name); // Print module information if (module_name != NULL) { if (module_version != NULL) { - sprintf(buf + (int)strlen(buf), "%s@%s/", module_name, module_version); + buf_off += os::snprintf_checked(buf + buf_off, buf_size - buf_off, "%s@%s/", module_name, module_version); } else { - sprintf(buf + (int)strlen(buf), "%s/", module_name); + buf_off += os::snprintf_checked(buf + buf_off, buf_size - buf_off, "%s/", module_name); } } @@ -2400,17 +2401,17 @@ static void print_stack_element_to_stream(outputStream* st, Handle mirror, int m } else { if (source_file_name != NULL && (line_number != -1)) { // Sourcename and linenumber - sprintf(buf + (int)strlen(buf), "%s:%d)", source_file_name, line_number); + buf_off += os::snprintf_checked(buf + buf_off, buf_size - buf_off, "%s:%d)", source_file_name, line_number); } else if (source_file_name != NULL) { // Just sourcename - sprintf(buf + (int)strlen(buf), "%s)", source_file_name); + buf_off += os::snprintf_checked(buf + buf_off, buf_size - buf_off, "%s)", source_file_name); } else { // Neither sourcename nor linenumber - sprintf(buf + (int)strlen(buf), "Unknown Source)"); + buf_off += os::snprintf_checked(buf + buf_off, buf_size - buf_off, "Unknown Source)"); } CompiledMethod* nm = method->code(); if (WizardMode && nm != NULL) { - sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm); + os::snprintf_checked(buf + buf_off, buf_size - buf_off, "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm); } } } diff --git a/src/hotspot/share/code/dependencies.cpp b/src/hotspot/share/code/dependencies.cpp index 306280dfc43..bb597e50106 100644 --- a/src/hotspot/share/code/dependencies.cpp +++ b/src/hotspot/share/code/dependencies.cpp @@ -769,7 +769,8 @@ void Dependencies::write_dependency_to(xmlStream* xtty, xtty->object("x", arg.metadata_value()); } } else { - char xn[12]; sprintf(xn, "x%d", j); + char xn[12]; + os::snprintf_checked(xn, sizeof(xn), "x%d", j); if (arg.is_oop()) { xtty->object(xn, Handle(thread, arg.oop_value())); } else { diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index db5f2b5e42f..f54308944e2 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -998,7 +998,7 @@ void CompileBroker::init_compiler_sweeper_threads() { // for JVMCI compiler which can create further ones on demand. JVMCI_ONLY(if (!UseJVMCICompiler || !UseDynamicNumberOfCompilerThreads || i == 0) {) // Create a name for our thread. - sprintf(name_buffer, "%s CompilerThread%d", _compilers[1]->name(), i); + os::snprintf_checked(name_buffer, sizeof(name_buffer), "%s CompilerThread%d", _compilers[1]->name(), i); Handle thread_oop = create_thread_oop(name_buffer, CHECK); thread_handle = JNIHandles::make_global(thread_oop); JVMCI_ONLY(}) @@ -1022,7 +1022,7 @@ void CompileBroker::init_compiler_sweeper_threads() { for (int i = 0; i < _c1_count; i++) { // Create a name for our thread. - sprintf(name_buffer, "C1 CompilerThread%d", i); + os::snprintf_checked(name_buffer, sizeof(name_buffer), "C1 CompilerThread%d", i); Handle thread_oop = create_thread_oop(name_buffer, CHECK); jobject thread_handle = JNIHandles::make_global(thread_oop); _compiler1_objects[i] = thread_handle; @@ -1095,7 +1095,7 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) { // transitions if we bind them to new JavaThreads. if (!THREAD->can_call_java()) break; char name_buffer[256]; - sprintf(name_buffer, "%s CompilerThread%d", _compilers[1]->name(), i); + os::snprintf_checked(name_buffer, sizeof(name_buffer), "%s CompilerThread%d", _compilers[1]->name(), i); Handle thread_oop; { // We have to give up the lock temporarily for the Java calls. @@ -2731,7 +2731,7 @@ void CompileBroker::print_times(bool per_compiler, bool aggregate) { char tier_name[256]; for (int tier = CompLevel_simple; tier <= CompilationPolicy::highest_compile_level(); tier++) { CompilerStatistics* stats = &_stats_per_level[tier-1]; - sprintf(tier_name, "Tier%d", tier); + os::snprintf_checked(tier_name, sizeof(tier_name), "Tier%d", tier); print_times(tier_name, stats); } } diff --git a/src/hotspot/share/interpreter/bootstrapInfo.cpp b/src/hotspot/share/interpreter/bootstrapInfo.cpp index 830c015cc39..4070a68e1f9 100644 --- a/src/hotspot/share/interpreter/bootstrapInfo.cpp +++ b/src/hotspot/share/interpreter/bootstrapInfo.cpp @@ -230,9 +230,9 @@ void BootstrapInfo::print_msg_on(outputStream* st, const char* msg) { st = st ? st : tty; if (_indy_index != -1) - sprintf(what, "indy#%d", decode_indy_index()); + os::snprintf_checked(what, sizeof(what), "indy#%d", decode_indy_index()); else - sprintf(what, "condy"); + os::snprintf_checked(what, sizeof(what), "condy"); bool have_msg = (msg != NULL && strlen(msg) > 0); st->print_cr("%s%sBootstrap in %s %s@CP[%d] %s:%s%s BSMS[%d] BSM@CP[%d]%s argc=%d%s", (have_msg ? msg : ""), (have_msg ? " " : ""), @@ -251,11 +251,11 @@ void BootstrapInfo::print_msg_on(outputStream* st, const char* msg) { for (int i = 0; i < _argc; i++) { int pos = (int) strlen(argbuf); if (pos + 20 > (int)sizeof(argbuf)) { - sprintf(argbuf + pos, "..."); + os::snprintf_checked(argbuf + pos, sizeof(argbuf) - pos, "..."); break; } if (i > 0) argbuf[pos++] = ','; - sprintf(argbuf+pos, "%d", arg_index(i)); + os::snprintf_checked(argbuf+pos, sizeof(argbuf) - pos, "%d", arg_index(i)); } st->print_cr(" argument indexes: {%s}", argbuf); } diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp index 41478060acc..82fc404c166 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp @@ -303,9 +303,9 @@ jobjectArray readConfiguration0(JNIEnv *env, JVMCI_TRAPS) { JVMCIObjectArray vmFields = JVMCIENV->new_VMField_array(len, JVMCI_CHECK_NULL); for (int i = 0; i < len ; i++) { VMStructEntry vmField = JVMCIVMStructs::localHotSpotVMStructs[i]; - size_t name_buf_len = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 /* "::" */; - char* name_buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, name_buf_len + 1); - sprintf(name_buf, "%s::%s", vmField.typeName, vmField.fieldName); + const size_t name_buf_size = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 + 1 /* "::" */; + char* name_buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, name_buf_size); + os::snprintf_checked(name_buf, name_buf_size, "%s::%s", vmField.typeName, vmField.fieldName); CSTRING_TO_JSTRING(name, name_buf); CSTRING_TO_JSTRING(type, vmField.typeString); JVMCIObject box; diff --git a/src/hotspot/share/prims/wbtestmethods/parserTests.cpp b/src/hotspot/share/prims/wbtestmethods/parserTests.cpp index c6ef6cf8296..9f9afaf2761 100644 --- a/src/hotspot/share/prims/wbtestmethods/parserTests.cpp +++ b/src/hotspot/share/prims/wbtestmethods/parserTests.cpp @@ -174,7 +174,7 @@ WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmd if (arg) { arg->value_as_str(buf, sizeof(buf)); } else { - sprintf(buf, ""); + os::snprintf_checked(buf, sizeof(buf), ""); } oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL); returnvalue_array_ah->obj_at_put(i*2+1, parsedValue); diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 46a90b678c3..f02f921ad81 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -2657,7 +2657,7 @@ const char* Deoptimization::trap_reason_name(int reason) { if ((uint)reason < Reason_LIMIT) return _trap_reason_name[reason]; static char buf[20]; - sprintf(buf, "reason%d", reason); + os::snprintf_checked(buf, sizeof(buf), "reason%d", reason); return buf; } const char* Deoptimization::trap_action_name(int action) { @@ -2667,7 +2667,7 @@ const char* Deoptimization::trap_action_name(int action) { if ((uint)action < Action_LIMIT) return _trap_action_name[action]; static char buf[20]; - sprintf(buf, "action%d", action); + os::snprintf_checked(buf, sizeof(buf), "action%d", action); return buf; } @@ -2766,7 +2766,7 @@ void Deoptimization::print_statistics() { Bytecodes::Code bc = (Bytecodes::Code)(counter & LSB_MASK); if (bc_case == BC_CASE_LIMIT && (int)bc == 0) bc = Bytecodes::_illegal; - sprintf(name, "%s/%s/%s", + os::snprintf_checked(name, sizeof(name), "%s/%s/%s", trap_reason_name(reason), trap_action_name(action), Bytecodes::is_defined(bc)? Bytecodes::name(bc): "other"); diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 4e1a30a7302..e786b057262 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -94,6 +94,16 @@ int os::snprintf(char* buf, size_t len, const char* fmt, ...) { return result; } +int os::snprintf_checked(char* buf, size_t len, const char* fmt, ...) { + va_list args; + va_start(args, fmt); + int result = os::vsnprintf(buf, len, fmt, args); + va_end(args); + assert(result >= 0, "os::snprintf error"); + assert(static_cast(result) < len, "os::snprintf truncated"); + return result; +} + // Fill in buffer with current local time as an ISO-8601 string. // E.g., YYYY-MM-DDThh:mm:ss.mmm+zzzz. // Returns buffer, or NULL if it failed. @@ -1294,7 +1304,7 @@ char* os::format_boot_path(const char* format_string, FILE* os::fopen(const char* path, const char* mode) { char modified_mode[20]; assert(strlen(mode) + 1 < sizeof(modified_mode), "mode chars plus one extra must fit in buffer"); - sprintf(modified_mode, "%s" LINUX_ONLY("e") BSD_ONLY("e") WINDOWS_ONLY("N"), mode); + os::snprintf_checked(modified_mode, sizeof(modified_mode), "%s" LINUX_ONLY("e") BSD_ONLY("e") WINDOWS_ONLY("N"), mode); FILE* file = ::fopen(path, modified_mode); #if !(defined LINUX || defined BSD || defined _WINDOWS) diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index ad047b91932..c6e0770ed66 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -683,6 +683,10 @@ class os: AllStatic { static int vsnprintf(char* buf, size_t len, const char* fmt, va_list args) ATTRIBUTE_PRINTF(3, 0); static int snprintf(char* buf, size_t len, const char* fmt, ...) ATTRIBUTE_PRINTF(3, 4); + // Performs snprintf and asserts the result is non-negative (so there was not + // an encoding error) and that the output was not truncated. + static int snprintf_checked(char* buf, size_t len, const char* fmt, ...) ATTRIBUTE_PRINTF(3, 4); + // Get host name in buffer provided static bool get_host_name(char* buf, size_t buflen); diff --git a/src/hotspot/share/runtime/perfData.cpp b/src/hotspot/share/runtime/perfData.cpp index 9ce8f3fff93..741e7e73e9c 100644 --- a/src/hotspot/share/runtime/perfData.cpp +++ b/src/hotspot/share/runtime/perfData.cpp @@ -84,7 +84,8 @@ PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v) const char* prefix = PerfDataManager::ns_to_string(ns); - _name = NEW_C_HEAP_ARRAY(char, strlen(name) + strlen(prefix) + 2, mtInternal); + const size_t _name_size = strlen(name) + strlen(prefix) + 2; + _name = NEW_C_HEAP_ARRAY(char, _name_size, mtInternal); assert(strlen(name) != 0, "invalid name"); if (ns == NULL_NS) { @@ -100,7 +101,7 @@ PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v) } } else { - sprintf(_name, "%s.%s", prefix, name); + os::snprintf_checked(_name, _name_size, "%s.%s", prefix, name); // set the F_Supported flag based on the given namespace. if (PerfDataManager::is_stable_supported(ns) || PerfDataManager::is_unstable_supported(ns)) { @@ -363,7 +364,7 @@ char* PerfDataManager::counter_name(const char* ns, const char* name) { size_t len = strlen(ns) + strlen(name) + 2; char* result = NEW_RESOURCE_ARRAY(char, len); - sprintf(result, "%s.%s", ns, name); + os::snprintf_checked(result, len, "%s.%s", ns, name); return result; } diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index ddb551dd004..c40dfc7de10 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -440,7 +440,7 @@ extern "C" JNIEXPORT void disnm(intptr_t p) { extern "C" JNIEXPORT void printnm(intptr_t p) { char buffer[256]; - sprintf(buffer, "printnm: " INTPTR_FORMAT, p); + os::snprintf_checked(buffer, sizeof(buffer), "printnm: " INTPTR_FORMAT, p); Command c(buffer); CodeBlob* cb = CodeCache::find_blob((address) p); if (cb->is_nmethod()) { diff --git a/src/hotspot/share/utilities/utf8.cpp b/src/hotspot/share/utilities/utf8.cpp index 6ebeb9a6c9b..922c4a76ec7 100644 --- a/src/hotspot/share/utilities/utf8.cpp +++ b/src/hotspot/share/utilities/utf8.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "utilities/utf8.hpp" +#include "runtime/os.hpp" // Assume the utf8 string is in legal form and has been // checked in the class file parser/format checker. @@ -220,7 +221,7 @@ void UTF8::as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int *p++ = (char)c; } else { if (p + 6 >= end) break; // string is truncated - sprintf(p, "\\u%04x", c); + os::snprintf_checked(p, 7, "\\u%04x", c); // counting terminating zero in p += 6; } } @@ -514,7 +515,7 @@ void UNICODE::as_quoted_ascii(const T* base, int length, char* buf, int buflen) *p++ = (char)c; } else { if (p + 6 >= end) break; // string is truncated - sprintf(p, "\\u%04x", c); + os::snprintf_checked(p, 7, "\\u%04x", c); p += 6; } } diff --git a/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp b/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp index ed2de311c22..5f868f6e408 100644 --- a/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp +++ b/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp @@ -635,7 +635,7 @@ void PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator) { if (channelName == NULL) { return; } - sprintf(channelName, "Ch %d", ch); + snprintf(channelName, 16, "Ch %d", ch); } void* jControls[2]; From f87aa3013ae926a079bde0ba88157e7590ac4a56 Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Fri, 5 Jul 2024 08:36:52 +0000 Subject: [PATCH 151/329] 8328238: Convert few closed manual applet tests to main Backport-of: 68170ae22233462e8925c75c4737be7f0ba9353d --- test/jdk/javax/swing/JFrame/bug4419914.java | 81 +++++++++++++ test/jdk/javax/swing/text/PaintTest.java | 108 +++++++++++++++++ test/jdk/javax/swing/text/bug4148489.java | 109 ++++++++++++++++++ .../text/html/StyleSheet/bug4803145.java | 97 ++++++++++++++++ 4 files changed, 395 insertions(+) create mode 100644 test/jdk/javax/swing/JFrame/bug4419914.java create mode 100644 test/jdk/javax/swing/text/PaintTest.java create mode 100644 test/jdk/javax/swing/text/bug4148489.java create mode 100644 test/jdk/javax/swing/text/html/StyleSheet/bug4803145.java diff --git a/test/jdk/javax/swing/JFrame/bug4419914.java b/test/jdk/javax/swing/JFrame/bug4419914.java new file mode 100644 index 00000000000..5e15d3c8f91 --- /dev/null +++ b/test/jdk/javax/swing/JFrame/bug4419914.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2001, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4419914 + * @summary Tests that tab movement is correct in RTL component orientation. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4419914 +*/ + +import java.awt.BorderLayout; +import java.awt.ComponentOrientation; +import javax.swing.JButton; +import javax.swing.JFrame; +import java.util.Locale; + +public class bug4419914 { + private static final String INSTRUCTIONS = """ + 1. You will see a frame with five buttons. + 2. Confirm that each button is placed as follows: + NORTH + END CENTER START + SOUTH + 3. Press the "NORTH" button and confirm the button is focused. + 4. Press TAB repeatedly and confirm that the TAB focus moves from right to left. + (NORTH - START - CENTER - END - SOUTH - NORTH - START - CENTER - ...) + + If there's anything different from the above items, click Fail else click Pass."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Tab movement Instructions") + .instructions(INSTRUCTIONS) + .rows(12) + .columns(42) + .testUI(bug4419914::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("bug4419914"); + frame.setFocusCycleRoot(true); + frame.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + frame.setLocale(Locale.ENGLISH); + + frame.enableInputMethods(false); + frame.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + frame.setLocale(Locale.ENGLISH); + frame.setLayout(new BorderLayout()); + frame.add(new JButton("SOUTH"), BorderLayout.SOUTH); + frame.add(new JButton("CENTER"), BorderLayout.CENTER); + frame.add(new JButton("END"), BorderLayout.LINE_END); + frame.add(new JButton("START"), BorderLayout.LINE_START); + frame.add(new JButton("NORTH"), BorderLayout.NORTH); + frame.setSize(300, 150); + return frame; + } +} diff --git a/test/jdk/javax/swing/text/PaintTest.java b/test/jdk/javax/swing/text/PaintTest.java new file mode 100644 index 00000000000..9df7e54b22e --- /dev/null +++ b/test/jdk/javax/swing/text/PaintTest.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 1999, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4210250 + * @summary Tests that PlainView repaints the necessary lines of text. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PaintTest + */ + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class PaintTest { + + private static final String INSTRUCTIONS = """ + Click the paint button. + If half of the second line is erased, + that is you can only see the bottom half of the second line + with the top half painted over in white, click fail, else click pass."""; + + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("PlainView Repaint Instructions") + .instructions(INSTRUCTIONS) + .rows(7) + .columns(35) + .testUI(PaintTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("PaintTest"); + + new PaintTest().create(frame.getContentPane()); + frame.pack(); + return frame; + } + + + void create(Container parent) { + parent.setLayout(new FlowLayout()); + + final JTextArea ta = new JTextArea + ("A sample textarea\nwith a couple of lines\nof text") { + public Dimension getPreferredSize() { + Dimension size = super.getPreferredSize(); + if (getFont() != null) { + size.height += getFontMetrics(getFont()) + .getHeight() / 2; + } + return size; + } + }; + JButton button = new JButton("paint"); + + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + Rectangle taBounds = ta.getBounds(); + int fontHeight = + ta.getFontMetrics(ta.getFont()).getHeight(); + + taBounds.height = fontHeight + fontHeight / 2; + ta.repaint(taBounds); + } + }); + } + }); + + parent.add(new JScrollPane(ta)); + parent.add(button); + } +} diff --git a/test/jdk/javax/swing/text/bug4148489.java b/test/jdk/javax/swing/text/bug4148489.java new file mode 100644 index 00000000000..12fc5849d47 --- /dev/null +++ b/test/jdk/javax/swing/text/bug4148489.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1999, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4148489 + * @summary Text gets deleted with negative values for setFirstLineIndent. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4148489 + */ + +import java.awt.BorderLayout; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.text.JTextComponent; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; +import javax.swing.text.Style; + +public class bug4148489 { + + static StyleContext sc; + static DefaultStyledDocument doc; + + private static final String INSTRUCTIONS = """ + Put the cursor at the beginning of the first text line and move the + cursor to the right using arrow key. + If the text is not corrupted then click Pass + If the text disappear while cursor moves click Fail."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Text traversal Instructions") + .instructions(INSTRUCTIONS) + .rows(5) + .columns(35) + .testUI(bug4148489::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + try { + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + } catch (Exception e) { + System.err.println("Error loading L&F: " + e); + } + JPanel testPanel = new JPanel(); + testPanel.setLayout(new BorderLayout()); + sc = new StyleContext(); + doc = new DefaultStyledDocument(sc); + + setParagraph(); + JTextComponent editor = new JTextPane(doc); + JScrollPane scroller = new JScrollPane(); + scroller.getViewport().add(editor); + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + panel.add("Center", scroller); + testPanel.add("Center", panel); + JFrame frame = new JFrame("Styled Document"); + frame.add(testPanel); + frame.pack(); + return frame; + } + + static void setParagraph() { + Style sty = sc.addStyle("normal", sc.getStyle(StyleContext.DEFAULT_STYLE)); + //here sets the negative value for setFirstLineIndent + StyleConstants.setFirstLineIndent(sty, -50); + StyleConstants.setLeftIndent(sty, 50); + String data = "Here I wrote some text for test. You can ignore this text because of it's a senseless text."; + try { + Style s = null; + doc.insertString(doc.getLength(), data, s); + Style ls = sc.getStyle("normal"); + doc.setLogicalStyle(doc.getLength() - 1, ls); + doc.insertString(doc.getLength(), "\n", null); + } catch (BadLocationException e) { + throw new RuntimeException("BadLocationException occures while calls insertString()...", e); + } + } +} diff --git a/test/jdk/javax/swing/text/html/StyleSheet/bug4803145.java b/test/jdk/javax/swing/text/html/StyleSheet/bug4803145.java new file mode 100644 index 00000000000..2d701657234 --- /dev/null +++ b/test/jdk/javax/swing/text/html/StyleSheet/bug4803145.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2003, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4803145 + * @summary Tests if bullets for HTML