Skip to content

UseCollectionInterfaces brakes on annotated types #223

@Bananeweizen

Description

@Bananeweizen

What is the smallest, simplest way to reproduce the problem?

              import java.util.HashSet;
              import org.jetbrains.annotations.Nullable;

              class Test {
                  public @Nullable HashSet<@Nullable Integer> values = new HashSet<>();
              }

What is the full stack trace of any errors you encountered?

        org.openrewrite.internal.RecipeRunException: java.lang.ClassCastException: class org.openrewrite.java.tree.J$AnnotatedType cannot be cast to class org.openrewrite.java.tree.J$ParameterizedType (org.openrewrite.java.tree.J$AnnotatedType and org.openrewrite.java.tree.J$ParameterizedType are in unnamed module of loader 'app')
            at app//org.openrewrite.TreeVisitor.visit(TreeVisitor.java:329)
            at app//org.openrewrite.staticanalysis.UseCollectionInterfaces$1.visit(UseCollectionInterfaces.java:106)

Are you interested in contributing a fix to OpenRewrite?

PR is coming in a minute...

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions