Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ <h1 class="title">Testing the JDK</h1>
<li><a href="#non-us-locale" id="toc-non-us-locale">Non-US
locale</a></li>
<li><a href="#pkcs11-tests" id="toc-pkcs11-tests">PKCS11 Tests</a></li>
<li><a href="#testing-with-alternative-security-providers"
id="toc-testing-with-alternative-security-providers">Testing with
alternative security providers</a></li>
<li><a href="#client-ui-tests" id="toc-client-ui-tests">Client UI
Tests</a></li>
</ul></li>
Expand Down Expand Up @@ -589,6 +592,18 @@ <h3 id="pkcs11-tests">PKCS11 Tests</h3>
JTREG=&quot;JAVA_OPTIONS=-Djdk.test.lib.artifacts.nsslib-linux_aarch64=/path/to/NSS-libs&quot;</code></pre>
<p>For more notes about the PKCS11 tests, please refer to
test/jdk/sun/security/pkcs11/README.</p>
<h3 id="testing-with-alternative-security-providers">Testing with
alternative security providers</h3>
<p>Some security tests use a hardcoded provider for
<code>KeyFactory</code>, <code>Cipher</code>,
<code>KeyPairGenerator</code>, <code>KeyGenerator</code>,
<code>AlgorithmParameterGenerator</code>, <code>KeyAgreement</code>,
<code>Mac</code>, <code>MessageDigest</code>, <code>SecureRandom</code>,
<code>Signature</code>, <code>AlgorithmParameters</code>,
<code>Configuration</code>, <code>Policy</code>, or
<code>SecretKeyFactory</code> objects. Specify the
<code>-Dtest.provider.name=NAME</code> property to use a different
provider for the service(s).</p>
<h3 id="client-ui-tests">Client UI Tests</h3>
<h4 id="system-key-shortcuts">System key shortcuts</h4>
<p>Some Client UI tests use key sequences which may be reserved by the
Expand Down
9 changes: 9 additions & 0 deletions doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,15 @@ $ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" \
For more notes about the PKCS11 tests, please refer to
test/jdk/sun/security/pkcs11/README.

### Testing with alternative security providers

Some security tests use a hardcoded provider for `KeyFactory`, `Cipher`,
`KeyPairGenerator`, `KeyGenerator`, `AlgorithmParameterGenerator`,
`KeyAgreement`, `Mac`, `MessageDigest`, `SecureRandom`, `Signature`,
`AlgorithmParameters`, `Configuration`, `Policy`, or `SecretKeyFactory` objects.
Specify the `-Dtest.provider.name=NAME` property to use a different provider for
the service(s).

### Client UI Tests

#### System key shortcuts
Expand Down
38 changes: 25 additions & 13 deletions src/java.base/share/classes/java/lang/reflect/Executable.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,22 +334,34 @@ Type[] getAllGenericParameterTypes() {
// If we have real parameter data, then we use the
// synthetic and mandate flags to our advantage.
if (realParamData) {
final Type[] out = new Type[nonGenericParamTypes.length];
final Parameter[] params = getParameters();
int fromidx = 0;
for (int i = 0; i < out.length; i++) {
final Parameter param = params[i];
if (param.isSynthetic() || param.isImplicit()) {
// If we hit a synthetic or mandated parameter,
// use the non generic parameter info.
out[i] = nonGenericParamTypes[i];
if (getDeclaringClass().isRecord() && this instanceof Constructor) {
/* we could be seeing a compact constructor of a record class
* its parameters are mandated but we should be able to retrieve
* its generic information if present
*/
if (genericParamTypes.length == nonGenericParamTypes.length) {
return genericParamTypes;
} else {
// Otherwise, use the generic parameter info.
out[i] = genericParamTypes[fromidx];
fromidx++;
return nonGenericParamTypes.clone();
}
} else {
final Type[] out = new Type[nonGenericParamTypes.length];
final Parameter[] params = getParameters();
int fromidx = 0;
for (int i = 0; i < out.length; i++) {
final Parameter param = params[i];
if (param.isSynthetic() || param.isImplicit()) {
// If we hit a synthetic or mandated parameter,
// use the non generic parameter info.
out[i] = nonGenericParamTypes[i];
} else {
// Otherwise, use the generic parameter info.
out[i] = genericParamTypes[fromidx];
fromidx++;
}
}
return out;
}
return out;
} else {
// Otherwise, use the non-generic parameter data.
// Without method parameter reflection data, we have
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/compiler/c1/TestTraceLinearScanLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @bug 8251093
* @summary Sanity check the flag TraceLinearScanLevel with the highest level in a silent HelloWorld program.
*
* @requires vm.debug == true & vm.compiler1.enabled
* @run main/othervm -XX:TraceLinearScanLevel=4 compiler.c1.TestTraceLinearScanLevel
* @requires vm.debug == true & vm.compiler1.enabled & vm.compMode != "Xcomp"
* @run main/othervm -Xbatch -XX:TraceLinearScanLevel=4 compiler.c1.TestTraceLinearScanLevel
*/
package compiler.c1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void main(String[] args) throws Exception {
// will be ignored during dumping.
TestCommon.dump(appJar, classlist, "-Xlog:cds")
.shouldContain("Dumping")
.shouldContain("[cds] Prohibited package for non-bootstrap classes: java/lang/Prohibited.class")
.shouldContain("Prohibited package for non-bootstrap classes: java/lang/Prohibited.class")
.shouldHaveExitValue(0);
}

Expand Down
17 changes: 14 additions & 3 deletions test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
Expand Down Expand Up @@ -141,6 +141,16 @@ public MyThread(String n, Throwable e) {
expectedException = e;
}


static public int[] trash;

void methodForException() {
trash = new int[10];
for (int i = 0; ;i++) {
trash[i % trash.length] = i;
}
}

public void run() {
// Concatenate strings in advance to avoid lambda calculations later
String ThreadFinished = "Thread finished: " + this.name;
Expand All @@ -156,8 +166,9 @@ public void run() {
try {
synchronized (kill001a.lock) { }
// We need some code that does an invoke here to make sure the async exception
// gets thrown before we leave the try block. Printing a log message works well.
kill001a.log.display("exited synchronized");
// gets thrown before we leave the try block.
// The methodForException should work until exception is thrown.
methodForException();
} catch (Throwable t) {
if (t == expectedException) {
kill001a.log.display(CaughtExpected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ private int runIt(String argv[], PrintStream out) {
this.out = out;
log = new Log(out, argHandler);

Map<String,? extends com.sun.jdi.connect.Connector.Argument> cArgs1 = initConnector(argHandler.getTransportPort());
Map<String,? extends com.sun.jdi.connect.Connector.Argument> cArgs2 = initConnector(null);
if ((addr = startListen(cArgs2)) == null) {
log.complain("FAILURE: unable to start listening the address " +
Expand All @@ -93,6 +92,12 @@ private int runIt(String argv[], PrintStream out) {
else
log.display("TEST: start listening the address " + addr);

// argHandler.getTransportPort() returns a free port (different from the port allocated by startListen(cArgs2))
Map<String,? extends com.sun.jdi.connect.Connector.Argument> cArgs1 = initConnector(argHandler.getTransportPort());

log.display("cArgs1: " + cArgs1);
log.display("cArgs2: " + cArgs2);

/* Check that an Exception is thrown if ListeningConnector.stopListening
has been invoked with argument map different from the one given for
a previous ListeningConnector.startListening() invocation */
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
* argument map is the same with the one given for the previous
* ListeningConnector.startListening() invocation.
*
* NOTE: this test is tagged "nonconcurrent" because it uses the default
* "javadebug" shmem file, as do some other tests.
*
* @library /vmTestbase
* /test/lib
* @build nsk.jdi.ListeningConnector.stopListening.stoplis001
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -147,7 +147,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

String expectedPlugAttachConnectorName = "PlugAttachConnector001_Name";
String expectedPlugAttachConnectorDescription = "PlugAttachConnector001_Description";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -165,7 +165,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

String checkedPlugAttachConnectorName = "PlugAttachConnector002_Name";
String checkedPlugAttachConnectorDescription = "PlugAttachConnector002_Description";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -133,7 +133,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test...");
logOnVerbose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -149,7 +149,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

String expectedPlugLaunchConnectorName = "PlugLaunchConnector001_Name";
String expectedPlugLaunchConnectorDescription = "PlugLaunchConnector001_Description";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -165,7 +165,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

String checkedPlugLaunchConnectorName = "PlugLaunchConnector002_Name";
String checkedPlugLaunchConnectorDescription = "PlugLaunchConnector002_Description";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -133,7 +133,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test...");
logOnVerbose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -149,7 +149,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

String expectedPlugListenConnectorName = "PlugListenConnector001_Name";
String expectedPlugListenConnectorDescription = "PlugListenConnector001_Description";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -165,7 +165,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

String checkedPlugListenConnectorName = "PlugListenConnector002_Name";
String checkedPlugListenConnectorDescription = "PlugListenConnector002_Description";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -133,7 +133,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test...");
logOnVerbose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -176,7 +176,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test...");
logOnVerbose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -201,7 +201,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test...");
logOnVerbose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -214,7 +214,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test...");
logOnVerbose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, 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
Expand Down Expand Up @@ -233,7 +233,6 @@ private int runThis (String argv[], PrintStream out) {

argsHandler = new ArgumentHandler(argv);
logHandler = new Log(out, argsHandler);
logHandler.enableErrorsSummary(false);

logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test...");
logOnVerbose
Expand Down
Loading