Skip to content

Commit

Permalink
Fix forbiddenapis on java 11 (#33116)
Browse files Browse the repository at this point in the history
Cap forbiddenapis to java version 10
  • Loading branch information
alpar-t authored Aug 27, 2018
1 parent 30c3b36 commit 974f839
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.gradle.api.DefaultTask;
import org.gradle.api.JavaVersion;
import org.gradle.api.file.FileCollection;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputFile;
Expand All @@ -41,6 +43,7 @@

public class ForbiddenApisCliTask extends DefaultTask {

private final Logger logger = Logging.getLogger(ForbiddenApisCliTask.class);
private FileCollection signaturesFiles;
private List<String> signatures = new ArrayList<>();
private Set<String> bundledSignatures = new LinkedHashSet<>();
Expand All @@ -49,12 +52,21 @@ public class ForbiddenApisCliTask extends DefaultTask {
private FileCollection classesDirs;
private Action<JavaExecSpec> execAction;

@Input
public JavaVersion getTargetCompatibility() {
return targetCompatibility;
}

public void setTargetCompatibility(JavaVersion targetCompatibility) {
this.targetCompatibility = targetCompatibility;
if (targetCompatibility.compareTo(JavaVersion.VERSION_1_10) > 0) {
logger.warn(
"Target compatibility is set to {} but forbiddenapis only supports up to 10. Will cap at 10.",
targetCompatibility
);
this.targetCompatibility = JavaVersion.VERSION_1_10;
} else {
this.targetCompatibility = targetCompatibility;
}
}

public Action<JavaExecSpec> getExecAction() {
Expand Down

0 comments on commit 974f839

Please sign in to comment.