Skip to content

Commit

Permalink
swap @nullable to jspecify (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
zieka authored Oct 23, 2024
1 parent 4bcc7b1 commit 3168c24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jspecify.annotations.Nullable;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Option;
import org.openrewrite.internal.lang.Nullable;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -55,10 +55,10 @@ protected List<String> getNpmCommand(Accumulator acc, ExecutionContext ctx) {
command.add("--force");
command.add("--verbose");
command.add("--allow-dirty");

// Replace `${version}` with the `version` value in each command item
command.replaceAll(s -> s.replace("${version}", Optional.ofNullable(version).orElse("latest")));

return command;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import org.jspecify.annotations.Nullable;
import org.openrewrite.*;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.nodejs.NpmExecutor;
import org.openrewrite.nodejs.NpmExecutorExecutionContextView;
import org.openrewrite.quark.Quark;
Expand Down Expand Up @@ -60,7 +60,7 @@ public TreeVisitor<?, ExecutionContext> getScanner(Accumulator acc) {
@Override
public @Nullable Tree visit(@Nullable Tree tree, ExecutionContext ctx) {
if (tree instanceof SourceFile && !(tree instanceof Quark) && !(tree instanceof ParseError) &&
!tree.getClass().getName().equals("org.openrewrite.java.tree.J$CompilationUnit")) {
!tree.getClass().getName().equals("org.openrewrite.java.tree.J$CompilationUnit")) {
SourceFile sourceFile = (SourceFile) tree;
String fileName = sourceFile.getSourcePath().getFileName().toString();
if (fileName.indexOf('.') > 0) {
Expand All @@ -84,7 +84,7 @@ public TreeVisitor<?, ExecutionContext> getScanner(Accumulator acc) {
public Collection<? extends SourceFile> generate(Accumulator acc, ExecutionContext ctx) {
Path previous = ctx.getMessage(PREVIOUS_RECIPE);
if (previous != null
&& !Objects.equals(ctx.getMessage(FIRST_RECIPE), ctx.getCycleDetails().getRecipePosition())) {
&& !Objects.equals(ctx.getMessage(FIRST_RECIPE), ctx.getCycleDetails().getRecipePosition())) {
acc.copyFromPrevious(previous);
}

Expand Down

0 comments on commit 3168c24

Please sign in to comment.