Skip to content

Commit

Permalink
refactor: Recipe nullability best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne committed Feb 28, 2024
1 parent 7105dbc commit 281638c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.JavaIsoVisitor;
Expand Down Expand Up @@ -134,7 +133,6 @@ actual, assertion, getArgumentsTemplate(matcherArgumentMethod)))

private final MethodMatcher CLOSE_TO_MATCHER = new MethodMatcher("org.hamcrest.Matchers closeTo(..)");

@NotNull
private String getArgumentsTemplate(J.MethodInvocation matcherArgument) {
List<Expression> methodArguments = matcherArgument.getArguments();
if (CLOSE_TO_MATCHER.matches(matcherArgument)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.openrewrite.java.testing.junit5;

import org.jetbrains.annotations.NotNull;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Preconditions;
import org.openrewrite.Recipe;
Expand Down Expand Up @@ -116,7 +115,6 @@ private static boolean isException(Expression expression) {
return expression instanceof J.Identifier && TypeUtils.isAssignableTo("java.lang.Throwable", expression.getType());
}

@NotNull
private J.MethodInvocation replaceWithAssertDoesNotThrowWithoutStringExpression(ExecutionContext ctx, J.Try try_) {
maybeAddImport("org.junit.jupiter.api.Assertions");
maybeRemoveCatchTypes(try_);
Expand All @@ -139,7 +137,6 @@ private void maybeRemoveCatchTypes(J.Try try_) {
}
}

@NotNull
private J.MethodInvocation replaceWithAssertDoesNotThrowWithStringExpression(ExecutionContext ctx, J.Try try_, Expression failCallArgument) {
// Retain the fail(String) call argument
maybeAddImport("org.junit.jupiter.api.Assertions");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.openrewrite.java.testing.testcontainers;

import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.NotNull;
import org.openrewrite.*;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.JavaParser;
Expand Down Expand Up @@ -75,7 +74,6 @@ public J.NewClass visitNewClass(J.NewClass newClass, ExecutionContext ctx) {
return nc;
}

@NotNull
private Expression getConstructorArgument(J.NewClass newClass) {
if (parseImage != null && parseImage) {
maybeAddImport("org.testcontainers.utility.DockerImageName");
Expand Down

0 comments on commit 281638c

Please sign in to comment.