Skip to content

ListFirstAndLast skips methodCall().get(0) #423

Closed
@timo-abele

Description

@timo-abele

What version of OpenRewrite are you using?

see below

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

      <plugin>
        <groupId>org.openrewrite.maven</groupId>
        <artifactId>rewrite-maven-plugin</artifactId>
        <version>5.22.0</version>
        <configuration>
          <activeRecipes>
            <recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
          </activeRecipes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.openrewrite.recipe</groupId>
            <artifactId>rewrite-migrate-java</artifactId>
            <version>2.8.0</version>
          </dependency>
        </dependencies>
      </plugin>

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

class A {
  class Inner {

    @Getter
    private List<String> listOne = new ArrayList<>();

  }

  void getFirst(){
    Inner inner = new Inner();
    inner.getListOne().get(0);
  }
}

It doesn't have to be an inner class, I'm just not sure if a sequence of classes as a string works in tests.

What did you expect to see?

class A {
  class Inner {

    @Getter
    private List<String> listOne = new ArrayList<>();

  }

  void getFirst(){
    Inner inner = new Inner();
    inner.getListOne().getFirst();
  }
}

What did you see instead?

no change

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

stacktrace output here

Are you interested in contributing a fix to OpenRewrite?

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