Skip to content

Commit

Permalink
Added more methods to the JavaOptions API.
Browse files Browse the repository at this point in the history
Some cleanups.
  • Loading branch information
gbevin committed Aug 11, 2023
1 parent d95a26e commit cdaea73
Showing 1 changed file with 71 additions and 8 deletions.
79 changes: 71 additions & 8 deletions src/main/java/rife/bld/operations/JavaOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public JavaOptions truffle() {
* @since 1.5.18
*/
public JavaOptions modulePath(File... modules) {
return modulePath(Arrays.asList(modules));
return modulePath(List.of(modules));
}

/**
Expand All @@ -63,7 +63,7 @@ public JavaOptions modulePath(List<File> modules) {
* @since 1.5.18
*/
public JavaOptions upgradeModulePath(File... modulePath) {
return upgradeModulePath(Arrays.asList(modulePath));
return upgradeModulePath(List.of(modulePath));
}

/**
Expand All @@ -88,7 +88,7 @@ public JavaOptions upgradeModulePath(List<File> modulePath) {
* @since 1.5.18
*/
public JavaOptions addModules(String... modules) {
return addModules(Arrays.asList(modules));
return addModules(List.of(modules));
}

/**
Expand All @@ -112,8 +112,8 @@ public JavaOptions addModules(List<String> modules) {
* @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));
}

/**
Expand Down Expand Up @@ -215,7 +215,7 @@ public JavaOptions disableSystemAssertions() {
* @since 1.5.18
*/
public JavaOptions agentLib(String libName) {
return agentLib(libName, null);
return agentLib(libName, (String)null);
}

/**
Expand All @@ -229,14 +229,35 @@ public JavaOptions agentLib(String libName, String options) {
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.
*
* @return this list of options
* @since 1.5.18
*/
public JavaOptions agentPath(File pathName) {
return agentPath(pathName, null);
return agentPath(pathName, (String)null);
}

/**
Expand All @@ -250,14 +271,35 @@ public JavaOptions agentPath(File pathName, String options) {
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.
*
* @return this list of options
* @since 1.5.18
*/
public JavaOptions javaAgent(File jarPath) {
return javaAgent(jarPath, null);
return javaAgent(jarPath, (String)null);
}

/**
Expand All @@ -271,6 +313,27 @@ public JavaOptions javaAgent(File jarPath, String options) {
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
*
Expand Down

0 comments on commit cdaea73

Please sign in to comment.