-
Notifications
You must be signed in to change notification settings - Fork 440
Closed
Labels
Milestone
Description
Upgraded my project to the use "execute" commandline and it works, but I get some warnings in the beginning.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by picocli.CommandLine$Help$Ansi (file:/C:/Users/.../ext/picocli/picocli.jar) to field java.io.FilterOutputStream.out
WARNING: Please consider reporting this to the maintainers of picocli.CommandLine$Help$Ansi
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
For reference:
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.2+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.2+9, mixed mode)
With jdk1.8.0_181 in eclipse these warnings do not show up!
public class Tool implements Runnable {
@Option(names = { "-h", "--help" }, usageHelp = true, description = "Display this help message")
private boolean usageHelpRequested = false;
@Option(names = { "-v", "--verbose" }, description = { "Enable verbose output" })
boolean verboseMode = false;
public void run() {
...
}
public static void main(String[] args) {
// Prepare PrintWriter with auto-flush option
PrintWriter out = new PrintWriter(System.out, true);
PrintWriter err = new PrintWriter(System.err, true);
// ColorScheme auto-detection of ANSI terminals
Ansi ansi = Help.Ansi.AUTO;
CommandLine cmd = new CommandLine(new Tool())
// set output
.setOut(out).setErr(err)
// disable clustering support for short options (e.g. -hv)
.setPosixClusteredShortOptionsAllowed(false)
// set color scheme
.setColorScheme(Help.defaultColorScheme(ansi));
// Register default result handler and default exception handler.
int exitCode = cmd.execute(args);
System.exit(exitCode);
}
}
Thank you for providing this great framework.