Skip to content

Commit 7a97a2d

Browse files
committed
Minor polish
1 parent 1ab2cbf commit 7a97a2d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/org/openrewrite/java/migrate/lang/var/DeclarationCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,6 @@ public static boolean initializedByStaticMethod(@Nullable Expression initializer
224224
return false;
225225
}
226226

227-
return invocation.getMethodType().getFlags().contains(Flag.Static);
227+
return invocation.getMethodType().hasFlags(Flag.Static);
228228
}
229229
}

src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForObjectsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ void m() {
313313
@Issue("https://github.com/openrewrite/rewrite-migrate-java/issues/550")
314314
void genericType() {
315315
rewriteRun(
316+
//language=java
316317
java(
317318
"""
318319
import java.io.Serializable;
@@ -348,6 +349,7 @@ class NotApplicable {
348349
void genericTypeInStaticMethod() {
349350
// ATM the recipe skips all static method initialized variables
350351
rewriteRun(
352+
//language=java
351353
java(
352354
"""
353355
package example;
@@ -360,7 +362,7 @@ static <T> T cast(Object o) {
360362
class User {
361363
public String test() {
362364
Object o = "Hello";
363-
String string = Global.cast(o);
365+
String string = Global.cast(o); // static method unchanged
364366
return string;
365367
}
366368
}
@@ -376,7 +378,7 @@ static <T> T cast(Object o) {
376378
class User {
377379
public String test() {
378380
var o = "Hello";
379-
String string = Global.cast(o);
381+
String string = Global.cast(o); // static method unchanged
380382
return string;
381383
}
382384
}

0 commit comments

Comments
 (0)