Table of Contents
Demo for issue with OpenRewrite’s recipe ApplyToWithLambdaDsl
, present in module rewrite-spring.
Original request for recipe : openrewrite/rewrite-spring#449
Run:
mvn rewrite:run
Got:
Error while visiting src\main\java\com\example\demorewritespringseccustomdsl\SecurityConfig.java: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "org.openrewrite.java.tree.JavaType$Method.getName()" is null
org.openrewrite.java.tree.J$MethodInvocation.withName(J.java:3837)
org.openrewrite.java.spring.boot2.ConvertToSecurityDslVisitor.lambda$computeAndMarkChain$2(ConvertToSecurityDslVisitor.java:241)
java.base/java.util.Optional.ifPresent(Optional.java:178)
org.openrewrite.java.spring.boot2.ConvertToSecurityDslVisitor.computeAndMarkChain(ConvertToSecurityDslVisitor.java:239)
org.openrewrite.java.spring.boot2.ConvertToSecurityDslVisitor.lambda$visitMethodInvocation$0(ConvertToSecurityDslVisitor.java:87)
java.base/java.util.Optional.map(Optional.java:260)
org.openrewrite.java.spring.boot2.ConvertToSecurityDslVisitor.visitMethodInvocation(ConvertToSecurityDslVisitor.java:86)
org.openrewrite.java.spring.boot2.ConvertToSecurityDslVisitor.visitMethodInvocation(ConvertToSecurityDslVisitor.java:34)
...
Spring Security’s documentation:
-
Custom DSLs (v6.0)
-
Custom DSLs (v6.2)