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

org.openrewrite.staticanalysis.NoDoubleBraceInitialization fails with nested braces init. #352

Open
blipper opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@blipper
Copy link
Contributor

blipper commented Oct 2, 2024

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

class A {
    void foo() {
        LinkedHashMap<String, Object> expectedMap = new LinkedHashMap<>() {{
        put("a", 1);
        put("testArrayList", new ArrayList<>() {{
                        add(1);
                    }});
        }}
    }
}

What did you expect to see?

class A {
    void foo() {
        ArrayList<String, Object> innerExpectedArrayList = new ArrayList<>();
        innerExpectedArrayList.add(1);
        LinkedHashMap<String, Object> expectedMap = new LinkedHashMap<>() {{
        expectedMap.put("a", 1);
        expectedMap.put("testArrayList", innerExpectedArrayList);
    }
}

What did you see instead?

class A {
    void foo() {
        LinkedHashMap<String, Object> expectedMap = new LinkedHashMap<>() {{
        expectedMap.put("a", 1);
        expectedMap.put("testArrayList", new ArrayList<>() {{
                        expectedMap.add(1);
                    }});
        }}
    }
}
@blipper blipper added the bug Something isn't working label Oct 2, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Oct 6, 2024
@timtebeek timtebeek changed the title org.openrewrite.staticanalysis.NoDoubleBraceInitialization fails with nested braces init. org.openrewrite.staticanalysis.NoDoubleBraceInitialization fails with nested braces init. Oct 6, 2024
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
Status: Backlog
Development

No branches or pull requests

1 participant