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
Describe the bug
If a Java class contains a static import for javax.ws.rs.core.Response.Status.Family.SUCCESSFUL then applying the recipe 'migrate-jax-rs' fails with ClassCastException
SBM Version
0.14.1-SNAPSHOT
SBM Application
To Reproduce
Steps to reproduce the behavior:
Go to PersonController (src/test/resources/testcode/bootify-jaxrs/src/main/java/com/example/jee/app/PersonController.java in module spring-shell)
Add import import javax.ws.rs.container.ContainerResponseContext; and import static javax.ws.rs.core.Response.Status.Family.SUCCESSFUL;
Expected behavior
The JAX-RS classes are migrated and the integration test succeeds.
Stacktrace
java.lang.ClassCastException: class org.openrewrite.java.tree.J$FieldAccess cannot be cast to class org.openrewrite.java.tree.J$Identifier (org.openrewrite.java.tree.J$FieldAccess and org.openrewrite.java.tree.J$Identifier are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @198e2867)
at org.openrewrite.java.tree.J$FieldAccess.getSimpleName(J.java:1907)
at org.openrewrite.java.tree.J$Import.getTypeName(J.java:2630)
at org.openrewrite.java.tree.J$Import.getTypeName(J.java:2581)
at org.springframework.sbm.java.impl.OpenRewriteImport.getName(OpenRewriteImport.java:28)
at org.springframework.sbm.java.impl.OpenRewriteImport.matches(OpenRewriteImport.java:33)
at org.springframework.sbm.java.impl.OpenRewriteJavaSource.lambda$hasImportStartingWith$2(OpenRewriteJavaSource.java:99)
...
at org.springframework.sbm.java.impl.OpenRewriteJavaSource.lambda$hasImportStartingWith$3(OpenRewriteJavaSource.java:99)
...
at org.springframework.sbm.java.impl.OpenRewriteJavaSource.hasImportStartingWith(OpenRewriteJavaSource.java:98)
at org.springframework.sbm.java.impl.ProjectJavaSourcesImpl.lambda$hasImportStartingWith$0(ProjectJavaSourcesImpl.java:88)
...
at org.springframework.sbm.java.impl.ProjectJavaSourcesImpl.hasImportStartingWith(ProjectJavaSourcesImpl.java:88)
at org.springframework.sbm.java.migration.conditions.HasImportStartingWith.evaluate(HasImportStartingWith.java:42)
at org.springframework.sbm.engine.recipe.Recipe.isApplicable(Recipe.java:92)
at org.springframework.sbm.engine.recipe.Recipes.lambda$getApplicable$2(Recipes.java:50)
Desktop (please complete the following information):
OS: Windows
Version 11 22H2
Additional context
The issue seems similar to issue #691
The text was updated successfully, but these errors were encountered:
Describe the bug
If a Java class contains a static import for
javax.ws.rs.core.Response.Status.Family.SUCCESSFUL
then applying the recipe 'migrate-jax-rs' fails with ClassCastExceptionSBM Version
0.14.1-SNAPSHOT
SBM Application
To Reproduce
Steps to reproduce the behavior:
import javax.ws.rs.container.ContainerResponseContext;
andimport static javax.ws.rs.core.Response.Status.Family.SUCCESSFUL;
Expected behavior
The JAX-RS classes are migrated and the integration test succeeds.
Stacktrace
Desktop (please complete the following information):
Additional context
The issue seems similar to issue #691
The text was updated successfully, but these errors were encountered: