Skip to content

Commit

Permalink
Add missing requireNonNull to matching related constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Feb 1, 2019
1 parent 642330b commit 68e22ec
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Expand Up @@ -20,6 +20,8 @@
import java.util.function.Function;
import java.util.function.Predicate;

import static java.util.Objects.requireNonNull;

public class Property<F, T>
{
private final String name;
Expand All @@ -37,8 +39,8 @@ public static <F, T> Property<F, T> optionalProperty(String name, Function<F, Op

public Property(String name, Function<F, Optional<T>> function)
{
this.name = name;
this.function = function;
this.name = requireNonNull(name, "name is null");
this.function = requireNonNull(function, "function is null");
}

public String getName()
Expand Down
Expand Up @@ -13,6 +13,8 @@
*/
package io.prestosql.matching;

import static java.util.Objects.requireNonNull;

public class PropertyPattern<F, R>
{
private final Property<F, ?> property;
Expand All @@ -25,8 +27,8 @@ public static <F, T, R> PropertyPattern<F, R> of(Property<F, T> property, Patter

private PropertyPattern(Property<F, ?> property, Pattern<R> pattern)
{
this.property = property;
this.pattern = pattern;
this.property = requireNonNull(property, "property is null");
this.pattern = requireNonNull(pattern, "pattern is null");
}

public Property<F, ?> getProperty()
Expand Down
Expand Up @@ -20,6 +20,8 @@
import io.prestosql.matching.Pattern;
import io.prestosql.matching.PatternVisitor;

import static java.util.Objects.requireNonNull;

public class CapturePattern<T>
extends Pattern<T>
{
Expand All @@ -28,7 +30,7 @@ public class CapturePattern<T>
public CapturePattern(Capture<T> capture, Pattern<T> previous)
{
super(previous);
this.capture = capture;
this.capture = requireNonNull(capture, "capture is null");
}

public Capture<T> capture()
Expand Down
Expand Up @@ -22,6 +22,8 @@
import java.util.Optional;
import java.util.function.Predicate;

import static java.util.Objects.requireNonNull;

public class FilterPattern<T>
extends Pattern<T>
{
Expand All @@ -30,7 +32,7 @@ public class FilterPattern<T>
public FilterPattern(Predicate<? super T> predicate, Optional<Pattern<?>> previous)
{
super(previous);
this.predicate = predicate;
this.predicate = requireNonNull(predicate, "predicate is null");
}

public Predicate<? super T> predicate()
Expand Down
Expand Up @@ -21,6 +21,8 @@
import io.prestosql.matching.Property;
import io.prestosql.matching.PropertyPattern;

import static java.util.Objects.requireNonNull;

public class WithPattern<T>
extends Pattern<T>
{
Expand All @@ -29,7 +31,7 @@ public class WithPattern<T>
public WithPattern(PropertyPattern<? super T, ?> propertyPattern, Pattern<T> previous)
{
super(previous);
this.propertyPattern = propertyPattern;
this.propertyPattern = requireNonNull(propertyPattern, "propertyPattern is null");
}

public Pattern<?> getPattern()
Expand Down

0 comments on commit 68e22ec

Please sign in to comment.