Skip to content

Commit

Permalink
refactor: OpenRewrite best practices
Browse files Browse the repository at this point in the history
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.recipes.OpenRewriteBestPractices?organizationId=T3BlblJld3JpdGU%3D

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
2 people authored and app committed Oct 21, 2024
1 parent 88d422a commit ef493d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions rewrite-core/src/main/java/org/openrewrite/TreeVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ public final Cursor updateCursor(T currentValue) {
}

public @Nullable T visit(@Nullable Tree tree, P p, Cursor parent) {
assert !(parent.getValue() instanceof Tree)
|| !((Tree) parent.getValue()).isScope(tree)
|| !(p instanceof ExecutionContext)
|| !CursorValidatingExecutionContextView.view((ExecutionContext) p).getValidateCursorAcyclic() :
assert !(parent.getValue() instanceof Tree) ||
!((Tree) parent.getValue()).isScope(tree) ||
!(p instanceof ExecutionContext) ||
!CursorValidatingExecutionContextView.view((ExecutionContext) p).getValidateCursorAcyclic() :
"The `parent` cursor must not point to the same `tree` as the tree to be visited. " +
"This usually indicates that you have used getCursor() where getCursor().getParent() is appropriate. " +
"This is a test-only validation which can be opted out of by configuring your test's type validation options with `cursorAcyclic(false)`.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.openrewrite.*;
import org.openrewrite.maven.table.MavenMetadataFailures;
import org.openrewrite.maven.tree.MavenMetadata;
import org.openrewrite.maven.tree.ResolvedPom;
import org.openrewrite.maven.tree.ResolvedManagedDependency;
import org.openrewrite.maven.tree.ResolvedPom;
import org.openrewrite.semver.Semver;
import org.openrewrite.semver.VersionComparator;
import org.openrewrite.xml.ChangeTagValueVisitor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
*/
// Generated from java-escape by ANTLR 4.11.1
package org.openrewrite.xml.internal.grammar;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.atn.ATN;
import org.antlr.v4.runtime.atn.ATNDeserializer;
import org.antlr.v4.runtime.atn.LexerATNSimulator;
import org.antlr.v4.runtime.atn.PredictionContextCache;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
public class XMLLexer extends Lexer {
Expand Down

0 comments on commit ef493d1

Please sign in to comment.