Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 28 changed files with 40 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.bugpatterns.util.AnnotationAttributeMatcher;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.sun.tools.javac.code.TypeAnnotations.AnnotationType;
import java.util.Comparator;
import java.util.List;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Formattable;
import java.util.Iterator;
import java.util.List;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Picnic Error Prone Contrib checks. */
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.bugpatterns;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.NewArrayTree;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;

/**
* A collection of JUnit-specific helper methods and {@link Matcher}s.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Auxiliary utilities for use by Error Prone checks. */
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.bugpatterns.util;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;

/**
Expand Down Expand Up @@ -103,7 +103,8 @@ T before(Iterator<T> iterator, T defaultValue) {
}

@AfterTemplate
@Nullable T after(Iterator<T> iterator, T defaultValue) {
@Nullable
T after(Iterator<T> iterator, T defaultValue) {
return Iterators.getNext(iterator, defaultValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;

/** Refaster rules related to expressions dealing with {@link Map} instances. */
Expand All @@ -31,12 +31,14 @@ Map<K, V> after() {

static final class MapGetOrNull<K, V, T> {
@BeforeTemplate
@Nullable V before(Map<K, V> map, T key) {
@Nullable
V before(Map<K, V> map, T key) {
return map.getOrDefault(key, null);
}

@AfterTemplate
@Nullable V after(Map<K, V> map, T key) {
@Nullable
V after(Map<K, V> map, T key) {
return map.get(key);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import java.util.Collection;
import java.util.Set;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;

/** Refaster rules related to expressions dealing with {@link Multimap}s. */
Expand Down Expand Up @@ -50,7 +50,8 @@ int after(Multimap<K, V> multimap) {
*/
static final class MultimapGet<K, V> {
@BeforeTemplate
@Nullable Collection<V> before(Multimap<K, V> multimap, K key) {
@Nullable
Collection<V> before(Multimap<K, V> multimap, K key) {
return Refaster.anyOf(multimap.asMap(), Multimaps.asMap(multimap)).get(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.google.errorprone.refaster.annotation.UseImportPolicy;
import java.util.Objects;
import java.util.function.Predicate;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;

/** Refaster rules related to expressions dealing with (possibly) null values. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Stream;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;

/** Refaster rules related to expressions dealing with {@link Optional}s. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.reactivex.Maybe;
import io.reactivex.Observable;
import io.reactivex.Single;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import reactor.adapter.rxjava.RxJava2Adapter;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;

/** Refaster rules related to expressions dealing with {@link String}s. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Picnic Refaster rules. */
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refasterrules;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void identification() {
"import java.util.List;",
"import java.util.Map;",
"import java.util.Set;",
"import org.jspecify.nullness.Nullable;",
"import org.jspecify.annotations.Nullable;",
"import org.springframework.web.bind.annotation.DeleteMapping;",
"import org.springframework.web.bind.annotation.GetMapping;",
"import org.springframework.web.bind.annotation.PostMapping;",
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
<version>0.2.0</version>
<version>0.3.0</version>
</dependency>
<dependency>
<groupId>org.junit</groupId>
Expand Down Expand Up @@ -611,15 +611,15 @@
</property>
<property name="illegalClasses" value="com.mongodb.lang.Nullable">
<!-- Instead, please use
`org.jspecify.nullness.Nullable`. -->
`org.jspecify.annotations.Nullable`. -->
</property>
<property name="illegalClasses" value="io.micrometer.core.lang.Nullable">
<!-- Instead, please use
`org.jspecify.nullness.Nullable`. -->
`org.jspecify.annotations.Nullable`. -->
</property>
<property name="illegalClasses" value="javax.annotation.Nullable">
<!-- Instead, please use
`org.jspecify.nullness.Nullable`. -->
`org.jspecify.annotations.Nullable`. -->
</property>
<property name="illegalClasses" value="javax.annotation.concurrent.Immutable">
<!-- Instead, please use
Expand All @@ -635,7 +635,7 @@
</property>
<property name="illegalClasses" value="org.springframework.lang.Nullable">
<!-- Instead, please use
`org.jspecify.nullness.Nullable`. -->
`org.jspecify.annotations.Nullable`. -->
</property>
<property name="illegalPkgs" value="com.amazonaws.annotation" />
<property name="illegalPkgs" value="com.beust.jcommander.internal" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
import javax.tools.StandardLocation;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.AnnotatedCompositeCodeTransformer;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* files on the classpath.
*/
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refaster.plugin;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Exposes Refaster rules found on the classpath through a regular Error Prone check. */
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refaster.runner;
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* non-patch mode.
*/
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refaster.annotation;
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* com.google.errorprone.refaster.annotation.NotMatches @NotMatches} annotations.
*/
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refaster.matchers;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Assorted classes that aid the compilation or evaluation of Refaster rules. */
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refaster;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.TreeScanner;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;

/**
* An abstract {@link BugChecker} that reports a match for each expression matched by the given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.regex.Pattern;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.runner.CodeTransformers;
import tech.picnic.errorprone.refaster.runner.Refaster;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Opinionated utilities for the testing of Refaster rules. */
@com.google.errorprone.annotations.CheckReturnValue
@org.jspecify.nullness.NullMarked
@org.jspecify.annotations.NullMarked
package tech.picnic.errorprone.refaster.test;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.google.errorprone.refaster.annotation.Placeholder;
import com.google.errorprone.refaster.annotation.UseImportPolicy;
import java.util.Set;
import org.jspecify.nullness.Nullable;
import org.jspecify.annotations.Nullable;

/** Refaster rule collection to validate that having no violations works as expected. */
final class ValidRules {
Expand Down

0 comments on commit ff2ed6f

Please sign in to comment.