8254261: fix javadocs in jdk.test.lib.Utils

Reviewed-by: shade
This commit is contained in:
Igor Ignatyev 2020-10-09 14:47:25 +00:00
parent d4b5dfd1a2
commit 7e80c9897d

View file

@ -246,6 +246,8 @@ public final class Utils {
return prependTestJavaOpts(userArgs); return prependTestJavaOpts(userArgs);
} }
private static final Pattern useGcPattern = Pattern.compile(
"(?:\\-XX\\:[\\+\\-]Use.+GC)");
/** /**
* Removes any options specifying which GC to use, for example "-XX:+UseG1GC". * Removes any options specifying which GC to use, for example "-XX:+UseG1GC".
* Removes any options matching: -XX:(+/-)Use*GC * Removes any options matching: -XX:(+/-)Use*GC
@ -253,8 +255,6 @@ public final class Utils {
* GC specified by the framework must first be removed. * GC specified by the framework must first be removed.
* @return A copy of given opts with all GC options removed. * @return A copy of given opts with all GC options removed.
*/ */
private static final Pattern useGcPattern = Pattern.compile(
"(?:\\-XX\\:[\\+\\-]Use.+GC)");
public static List<String> removeGcOpts(List<String> opts) { public static List<String> removeGcOpts(List<String> opts) {
List<String> optsWithoutGC = new ArrayList<String>(); List<String> optsWithoutGC = new ArrayList<String>();
for (String opt : opts) { for (String opt : opts) {
@ -564,7 +564,7 @@ public final class Utils {
/** /**
* Wait for condition to be true * Wait for condition to be true
* *
* @param condition, a condition to wait for * @param condition a condition to wait for
*/ */
public static final void waitForCondition(BooleanSupplier condition) { public static final void waitForCondition(BooleanSupplier condition) {
waitForCondition(condition, -1L, 100L); waitForCondition(condition, -1L, 100L);
@ -573,7 +573,7 @@ public final class Utils {
/** /**
* Wait until timeout for condition to be true * Wait until timeout for condition to be true
* *
* @param condition, a condition to wait for * @param condition a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true * @param timeout a time in milliseconds to wait for condition to be true
* specifying -1 will wait forever * specifying -1 will wait forever
* @return condition value, to determine if wait was successful * @return condition value, to determine if wait was successful
@ -586,7 +586,7 @@ public final class Utils {
/** /**
* Wait until timeout for condition to be true for specified time * Wait until timeout for condition to be true for specified time
* *
* @param condition, a condition to wait for * @param condition a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true, * @param timeout a time in milliseconds to wait for condition to be true,
* specifying -1 will wait forever * specifying -1 will wait forever
* @param sleepTime a time to sleep value in milliseconds * @param sleepTime a time to sleep value in milliseconds
@ -619,12 +619,12 @@ public final class Utils {
* Filters out an exception that may be thrown by the given * Filters out an exception that may be thrown by the given
* test according to the given filter. * test according to the given filter.
* *
* @param test - method that is invoked and checked for exception. * @param test method that is invoked and checked for exception.
* @param filter - function that checks if the thrown exception matches * @param filter function that checks if the thrown exception matches
* criteria given in the filter's implementation. * criteria given in the filter's implementation.
* @return - exception that matches the filter if it has been thrown or * @return exception that matches the filter if it has been thrown or
* {@code null} otherwise. * {@code null} otherwise.
* @throws Throwable - if test has thrown an exception that does not * @throws Throwable if test has thrown an exception that does not
* match the filter. * match the filter.
*/ */
public static Throwable filterException(ThrowingRunnable test, public static Throwable filterException(ThrowingRunnable test,
@ -786,19 +786,21 @@ public final class Utils {
/** /**
* Creates an empty file in "user.dir" if the property set. * Creates an empty file in "user.dir" if the property set.
* <p> * <p>
* This method is meant as a replacement for {@code Files#createTempFile(String, String, FileAttribute...)} * This method is meant as a replacement for {@link Files#createTempFile(String, String, FileAttribute...)}
* that doesn't leave files behind in /tmp directory of the test machine * that doesn't leave files behind in /tmp directory of the test machine
* <p> * <p>
* If the property "user.dir" is not set, "." will be used. * If the property "user.dir" is not set, "." will be used.
* *
* @param prefix * @param prefix the prefix string to be used in generating the file's name;
* @param suffix * may be null
* @param attrs * @param suffix the suffix string to be used in generating the file's name;
* may be null, in which case ".tmp" is used
* @param attrs an optional list of file attributes to set atomically when creating the file
* @return the path to the newly created file that did not exist before this * @return the path to the newly created file that did not exist before this
* method was invoked * method was invoked
* @throws IOException * @throws IOException if an I/O error occurs or dir does not exist
* *
* @see {@link Files#createTempFile(String, String, FileAttribute...)} * @see Files#createTempFile(String, String, FileAttribute...)
*/ */
public static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs) throws IOException { public static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs) throws IOException {
Path dir = Paths.get(System.getProperty("user.dir", ".")); Path dir = Paths.get(System.getProperty("user.dir", "."));
@ -808,17 +810,17 @@ public final class Utils {
/** /**
* Creates an empty directory in "user.dir" or "." * Creates an empty directory in "user.dir" or "."
* <p> * <p>
* This method is meant as a replacement for {@code Files#createTempDirectory(String, String, FileAttribute...)} * This method is meant as a replacement for {@link Files#createTempDirectory(Path, String, FileAttribute...)}
* that doesn't leave files behind in /tmp directory of the test machine * that doesn't leave files behind in /tmp directory of the test machine
* <p> * <p>
* If the property "user.dir" is not set, "." will be used. * If the property "user.dir" is not set, "." will be used.
* *
* @param prefix * @param prefix the prefix string to be used in generating the directory's name; may be null
* @param attrs * @param attrs an optional list of file attributes to set atomically when creating the directory
* @return the path to the newly created directory * @return the path to the newly created directory
* @throws IOException * @throws IOException if an I/O error occurs or dir does not exist
* *
* @see {@link Files#createTempDirectory(String, String, FileAttribute...)} * @see Files#createTempDirectory(Path, String, FileAttribute...)
*/ */
public static Path createTempDirectory(String prefix, FileAttribute<?>... attrs) throws IOException { public static Path createTempDirectory(String prefix, FileAttribute<?>... attrs) throws IOException {
Path dir = Paths.get(System.getProperty("user.dir", ".")); Path dir = Paths.get(System.getProperty("user.dir", "."));