Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstanceOfPatternMatch providing duplicate variable name #304

Closed
mathewm3 opened this issue Jun 27, 2024 · 1 comment
Closed

InstanceOfPatternMatch providing duplicate variable name #304

mathewm3 opened this issue Jun 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mathewm3
Copy link

What version of OpenRewrite are you using?

I am using

  • rewrite-maven-plugin 5.32.1
  • rewrite-migrate-java 2.16.0

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.32.1</version>
                <configuration>
                    <activeRecipes>
                       <recipe>org.openrewrite.java.migrate.UpgradeToJava17</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-migrate-java</artifactId>
                        <version>2.16.0</version>
                    </dependency>
                </dependencies>
            </plugin>

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

if (inputValue instanceof Number && upperBound instanceof Number && lowerBound instanceof Number) {

else if ((target instanceof String) && (token instanceof String))

What did you expect to see?

if (inputValue instanceof Number number1 && upperBound instanceof Number number2 && lowerBound instanceof Number number3) {


else if ((target instanceof String string1) && (token instanceof String string2))

What did you see instead?

if (inputValue instanceof Number number && upperBound instanceof Number number && lowerBound instanceof Number number) {

else if ((target instanceof String string) && (token instanceof String string))

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

No errors

Are you interested in contributing a fix to OpenRewrite?

@mathewm3 mathewm3 added the bug Something isn't working label Jun 27, 2024
@timtebeek
Copy link
Contributor

Thanks for reporting @mathewm3 ! This is unfortunately a known issue, and I've tried in the past to get this resolved; see also

I hope you don't mind me closing this one as a duplicate. Any help towards getting the issue resolved would be welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants