Skip to content

Commit

Permalink
refactor: OpenRewrite recipe best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne committed Dec 8, 2023
1 parent b95965c commit 4314bfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Collection<? extends SourceFile> generate(Map<Path, List<String>> acc, Ex
public TreeVisitor<?, ExecutionContext> getVisitor(Map<Path, List<String>> acc) {
return new TreeVisitor<Tree, ExecutionContext>() {
@Override
public Tree visit(@Nullable Tree tree, ExecutionContext executionContext) {
public Tree visit(@Nullable Tree tree, ExecutionContext ctx) {
assert tree instanceof SourceFile;
SourceFile s = (SourceFile) tree;
if(acc.containsKey(s.getSourcePath()) && acc.get(s.getSourcePath()).size() > 1) {
Expand Down
15 changes: 10 additions & 5 deletions src/test/java/org/openrewrite/FindCallGraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ void staticInitializer() {
)
),
//language=java
java("""
java(
"""
class Scratch {
static int i = bar();
static {
Expand Down Expand Up @@ -196,7 +197,8 @@ void initializer() {
)
),
//language=java
java("""
java(
"""
class Scratch {
int i = bar();
int j;
Expand Down Expand Up @@ -243,7 +245,8 @@ void innerClass() {
)
),
//language=java
java("""
java(
"""
class A {
class B {
void b() {
Expand Down Expand Up @@ -279,7 +282,8 @@ void anonymousClass() {
)
)
),
java("""
java(
"""
class A {
public void method() {}
}
Expand Down Expand Up @@ -318,7 +322,8 @@ void companionObject() {
)
),
//language=kotlin
kotlin("""
kotlin(
"""
class A {
companion object {
@JvmStatic
Expand Down

0 comments on commit 4314bfd

Please sign in to comment.