Closed FlorianWege-HS-KL closed 1 week ago
hi @FlorianWege-HS-KL ; thanks for reporting as a runnable test! There appears to be a failure in the way the JavaTemplate is created, which only shows if the braces are missing. Here's the generated template; notice the missing ;
after the logging statement.
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.openrewrite.java.internal.template.__M__;
import org.openrewrite.java.internal.template.__P__;
public class SingleStatementIf{Logger log;
public void foo(){
/*__TEMPLATE__*/log.debug("first" + "second")/*__TEMPLATE_STOP__*/
}
private String bar(){
return null;
}
}
That likely needs a fix in openrewrite/rewrite, meaning other recipes would benefit from this fix as well. Thanks for bringing that to our attention!
Thanks again for the help here @FlorianWege-HS-KL ! Fixed upstream such that there's no need to test it again here.
What's changed?
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Is this in the right test class? Should there be a separate Log4jToSlf4Test class?
Checklist