File tree Expand file tree Collapse file tree
main/java/org/openrewrite/staticanalysis
test/java/org/openrewrite/staticanalysis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ private boolean validIdentifier() {
155155 // Sets structure for cursor positions to aggregate namespaces.
156156 private Cursor getCursorToParentScope () {
157157 return getCursor ().dropParentUntil (is ->
158- is instanceof J . CompilationUnit ||
158+ is instanceof JavaSourceFile ||
159159 is instanceof J .ClassDeclaration ||
160160 is instanceof J .Block ||
161161 is instanceof J .MethodDeclaration ||
Original file line number Diff line number Diff line change 1717
1818import org .junit .jupiter .api .Test ;
1919import org .openrewrite .DocumentExample ;
20+ import org .openrewrite .Issue ;
2021import org .openrewrite .test .RecipeSpec ;
2122import org .openrewrite .test .RewriteTest ;
2223
24+ import static org .openrewrite .groovy .Assertions .groovy ;
2325import static org .openrewrite .java .Assertions .java ;
26+ import static org .openrewrite .kotlin .Assertions .kotlin ;
2427
2528@ SuppressWarnings ({"EmptyTryBlock" , "CatchMayIgnoreException" })
2629class RenameExceptionInEmptyCatchTest implements RewriteTest {
@@ -150,4 +153,30 @@ void method() {
150153 )
151154 );
152155 }
156+
157+ @ Issue ("https://github.com/openrewrite/rewrite-static-analysis/issues/701" )
158+ @ Test
159+ void kotlinImportOnly () {
160+ rewriteRun (
161+ //language=kotlin
162+ kotlin (
163+ """
164+ import nebula.plugin.contacts.Contact
165+ """
166+ )
167+ );
168+ }
169+
170+ @ Issue ("https://github.com/openrewrite/rewrite-static-analysis/issues/701" )
171+ @ Test
172+ void groovyTopLevelStatement () {
173+ rewriteRun (
174+ //language=groovy
175+ groovy (
176+ """
177+ def file = new File("test")
178+ """
179+ )
180+ );
181+ }
153182}
You can’t perform that action at this time.
0 commit comments