Skip to content

Commit

Permalink
Use Objects.requireNonNull (supported since Java 7)
Browse files Browse the repository at this point in the history
  • Loading branch information
uschindler committed Apr 10, 2020
1 parent 9c26abb commit 4416a82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/main/java/de/thetaphi/forbiddenapis/ClassPatternRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package de.thetaphi.forbiddenapis;

import java.util.Objects;
import java.util.regex.Pattern;

public final class ClassPatternRule {
Expand All @@ -25,9 +26,7 @@ public final class ClassPatternRule {

/** Create new rule for class glob and given printout */
public ClassPatternRule(String glob, String message) {
if (glob == null) {
throw new NullPointerException("glob");
}
Objects.requireNonNull(glob, "glob");
this.glob = glob;
this.pattern = AsmUtils.glob2Pattern(glob);
this.message = message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;

import org.gradle.api.DefaultTask;
Expand Down Expand Up @@ -128,7 +129,7 @@ public FileCollection getClassesDirs() {

/** @see #getClassesDirs */
public void setClassesDirs(FileCollection classesDirs) {
if (classesDirs == null) throw new NullPointerException("classesDirs");
Objects.requireNonNull(classesDirs, "classesDirs");
this.classesDirs = classesDirs;
}

Expand All @@ -155,7 +156,7 @@ public FileCollection getClasspath() {

/** @see #getClasspath */
public void setClasspath(FileCollection classpath) {
if (classpath == null) throw new NullPointerException("classpath");
Objects.requireNonNull(classpath, "classpath");
this.classpath = classpath;
}

Expand Down

0 comments on commit 4416a82

Please sign in to comment.