You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like your JavaTemplate.builder is missing a call to imports; could that factor in here? Those snippets are compiled in isolation, so they need their classpath (beyond JDK) and imports added to the builder. The best way to troubleshoot these is through doBeforeParseTemplate(System.out::println)
What version of OpenRewrite are you using?
Current main = c5cc221
What is the smallest, simplest way to reproduce the problem?
The following test case added to
JavaVisitorTest
:What did you see instead?
Fails with no import added.
Workaround
Change the
maybeAddImport
line to:and the test passes.
Context
It seems like
org.openrewrite.java.AddImport#hasReference
doesn't honourtry
statements.The text was updated successfully, but these errors were encountered: