2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-26 00:37:10 -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
*/
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
*/
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
*/
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
* @since 1.5.18
*/
public JavaOptions enableNativeAccess(List... modules) {
return enableNativeAccess(Arrays.asList(modules));
public JavaOptions enableNativeAccess(String... modules) {
return enableNativeAccess(List.of(modules));
}
/**
@ -215,7 +215,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
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;
}
/**
* 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.
*
@ -236,7 +257,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
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;
}
/**
* 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.
*
@ -257,7 +299,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
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;
}
/**
* 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
*