Don't add -Xverify:none to JVM args when running on Java 13

Closes gh-17008
pull/18281/head
Andy Wilkinson 5 years ago
parent ce2c26e934
commit d2b28ceba5

@ -16,6 +16,9 @@
package org.springframework.boot.gradle.tasks.run;
import java.lang.reflect.Method;
import org.gradle.api.JavaVersion;
import org.gradle.api.file.SourceDirectorySet;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.JavaExec;
@ -69,7 +72,11 @@ public class BootRun extends JavaExec {
public void exec() {
if (this.optimizedLaunch) {
setJvmArgs(getJvmArgs());
jvmArgs("-Xverify:none", "-XX:TieredStopAtLevel=1");
JavaVersion.current();
if (!isJava13OrLater()) {
jvmArgs("-Xverify:none");
}
jvmArgs("-XX:TieredStopAtLevel=1");
}
if (System.console() != null) {
// Record that the console is available here for AnsiOutput to detect later
@ -78,4 +85,13 @@ public class BootRun extends JavaExec {
super.exec();
}
private boolean isJava13OrLater() {
for (Method method : String.class.getMethods()) {
if (method.getName().equals("stripIndent")) {
return true;
}
}
return false;
}
}

@ -17,6 +17,7 @@
package org.springframework.boot.maven;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.List;
@ -81,11 +82,22 @@ public class RunMojo extends AbstractRunMojo {
RunArguments jvmArguments = super.resolveJvmArguments();
if (isFork() && this.optimizedLaunch) {
jvmArguments.getArgs().addFirst("-XX:TieredStopAtLevel=1");
jvmArguments.getArgs().addFirst("-Xverify:none");
if (!isJava13OrLater()) {
jvmArguments.getArgs().addFirst("-Xverify:none");
}
}
return jvmArguments;
}
private boolean isJava13OrLater() {
for (Method method : String.class.getMethods()) {
if (method.getName().equals("stripIndent")) {
return true;
}
}
return false;
}
@Override
protected void runWithForkedJvm(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
throws MojoExecutionException {

Loading…
Cancel
Save