Skip to content

Commit

Permalink
Migrate to JSpecify from OpenRewrite JSR-305 meta-annotations (#114)
Browse files Browse the repository at this point in the history
Use this link to re-run the recipe: https://app.moderne.io/builder/gW3xaSLWV?organizationId=T3BlblJld3JpdGU%3D

Co-authored-by: Moderne <[email protected]>
  • Loading branch information
jkschneider and TeamModerne authored Aug 15, 2024
1 parent 95b4599 commit 1bb454d
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.search.UsesType;
import org.openrewrite.java.tree.JavaSourceFile;
import org.openrewrite.maven.MavenIsoVisitor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.openrewrite.java.micronaut;

import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.dependencies.AddDependency;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.openrewrite.java.micronaut;

import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.maven.AddDependency;
import org.openrewrite.maven.MavenIsoVisitor;
import org.openrewrite.maven.search.FindProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Option;
import org.openrewrite.Recipe;
import org.openrewrite.TreeVisitor;
import org.openrewrite.internal.StringUtils;
import org.openrewrite.internal.lang.NonNull;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.maven.MavenVisitor;
import org.openrewrite.semver.DependencyMatcher;
import org.openrewrite.xml.AddOrUpdateChild;
Expand Down Expand Up @@ -146,7 +146,7 @@ private Xml.Tag maybeUpdateAnnotationProcessorPaths(Xml.Tag annotationProcessorP
});
}

private void maybeAddExclusionsToPath(@NonNull Xml.Tag path, @NonNull List<String> exclusionsToAdd) {
private void maybeAddExclusionsToPath(Xml.@NonNull Tag path, @NonNull List<String> exclusionsToAdd) {
if (!exclusionsToAdd.isEmpty()) {
Xml.Tag exclusionsTag = Xml.Tag.build("\n<exclusions>\n" +
MavenExclusions.buildContent(exclusionsToAdd) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
package org.openrewrite.java.micronaut;

import lombok.Data;
import org.jspecify.annotations.Nullable;
import org.openrewrite.ExecutionContext;
import org.openrewrite.ScanningRecipe;
import org.openrewrite.Tree;
import org.openrewrite.TreeVisitor;
import org.openrewrite.internal.ListUtils;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.tree.J;
import org.openrewrite.java.tree.JavaType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.openrewrite.java.micronaut;

import org.openrewrite.internal.lang.Nullable;
import org.jspecify.annotations.Nullable;

import java.util.List;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
package org.openrewrite.java.micronaut;

import lombok.Data;
import org.jspecify.annotations.Nullable;
import org.openrewrite.ExecutionContext;
import org.openrewrite.ScanningRecipe;
import org.openrewrite.Tree;
import org.openrewrite.TreeVisitor;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.AnnotationMatcher;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.JavaParser;
Expand All @@ -42,7 +42,7 @@ public String getDescription() {
return "In Micronaut 2.x a reflection-based strategy was used to retrieve that information if the class was not annotated with `@Introspected`. As of Micronaut 3.x it is required to annotate classes with `@Introspected` that are used in this way.";
}

private static boolean parentRequiresIntrospection(@Nullable JavaType.FullyQualified type) {
private static boolean parentRequiresIntrospection(JavaType.@Nullable FullyQualified type) {
if (type == null) {
return false;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor(Accumulator acc) {
}

private static final class FindParamsAndReturnTypes extends JavaIsoVisitor<Set<JavaType.FullyQualified>> {
private void maybeAddType(@Nullable JavaType.FullyQualified type, Set<JavaType.FullyQualified> foundTypes) {
private void maybeAddType(JavaType.@Nullable FullyQualified type, Set<JavaType.FullyQualified> foundTypes) {
if (type != null && !TypeRequiresIntrospection.parentRequiresIntrospection(type)) {
foundTypes.add(type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.openrewrite.java.micronaut;

import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.properties.ChangePropertyKey;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.openrewrite.java.micronaut;

import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.yaml.CopyValue;
import org.openrewrite.yaml.DeleteKey;
import org.openrewrite.yaml.MergeYaml;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@NonNullApi @NonNullFields
@NullMarked @NonNullFields
package org.openrewrite.java.micronaut;

import org.openrewrite.internal.lang.NonNullApi;
import org.jspecify.annotations.NullMarked;
import org.openrewrite.internal.lang.NonNullFields;

0 comments on commit 1bb454d

Please sign in to comment.