2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 16:27:11 -07:00

Added more methods to the JavaOptions API.

Some cleanups.
This commit is contained in:
Geert Bevin 2023-08-11 00:29:15 -04:00
parent d95a26e8d6
commit cdaea733b2

View file

@ -40,7 +40,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions modulePath(File... modules) { public JavaOptions modulePath(File... modules) {
return modulePath(Arrays.asList(modules)); return modulePath(List.of(modules));
} }
/** /**
@ -63,7 +63,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions upgradeModulePath(File... modulePath) { public JavaOptions upgradeModulePath(File... modulePath) {
return upgradeModulePath(Arrays.asList(modulePath)); return upgradeModulePath(List.of(modulePath));
} }
/** /**
@ -88,7 +88,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions addModules(String... modules) { public JavaOptions addModules(String... modules) {
return addModules(Arrays.asList(modules)); return addModules(List.of(modules));
} }
/** /**
@ -112,8 +112,8 @@ public class JavaOptions extends ArrayList<String> {
* @return this list of options * @return this list of options
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions enableNativeAccess(List... modules) { public JavaOptions enableNativeAccess(String... modules) {
return enableNativeAccess(Arrays.asList(modules)); return enableNativeAccess(List.of(modules));
} }
/** /**
@ -215,7 +215,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions agentLib(String libName) { public JavaOptions agentLib(String libName) {
return agentLib(libName, null); return agentLib(libName, (String)null);
} }
/** /**
@ -229,6 +229,27 @@ public class JavaOptions extends ArrayList<String> {
return this; return this;
} }
/**
* Load native agent library.
*
* @return this list of options
* @since 1.7.1
*/
public JavaOptions agentLib(String libName, String... options) {
return agentLib(libName, List.of(options));
}
/**
* Load native agent library.
*
* @return this list of options
* @since 1.7.1
*/
public JavaOptions agentLib(String libName, List<String> options) {
add("-agentlib:" + libName + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
return this;
}
/** /**
* Load native agent library by full pathname. * Load native agent library by full pathname.
* *
@ -236,7 +257,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions agentPath(File pathName) { public JavaOptions agentPath(File pathName) {
return agentPath(pathName, null); return agentPath(pathName, (String)null);
} }
/** /**
@ -250,6 +271,27 @@ public class JavaOptions extends ArrayList<String> {
return this; return this;
} }
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 1.7.1
*/
public JavaOptions agentPath(File pathName, String... options) {
return agentPath(pathName, List.of(options));
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 1.7.1
*/
public JavaOptions agentPath(File pathName, List<String> options) {
add("-agentpath:" + pathName + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
return this;
}
/** /**
* Load Java programming language agent. * Load Java programming language agent.
* *
@ -257,7 +299,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18 * @since 1.5.18
*/ */
public JavaOptions javaAgent(File jarPath) { public JavaOptions javaAgent(File jarPath) {
return javaAgent(jarPath, null); return javaAgent(jarPath, (String)null);
} }
/** /**
@ -271,6 +313,27 @@ public class JavaOptions extends ArrayList<String> {
return this; return this;
} }
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 1.7.1
*/
public JavaOptions javaAgent(File jarPath, String... options) {
return javaAgent(jarPath, List.of(options));
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 1.7.1
*/
public JavaOptions javaAgent(File jarPath, List<String> options) {
add("-javaagent:" + jarPath + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
return this;
}
/** /**
* Allow classes to depend on preview features of this release * Allow classes to depend on preview features of this release
* *