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
Nested records have unneeded import #232
Comments
|
The bug occurs for any nested type, not just if |
|
Retested with 2022-09 and 2022-12 as well (Version: 2022-12 (4.26.0) - Build id: 20221201-1913). The issue is still there. To reproduce:
|
|
I can reproduce this with latest Eclipse build. Looks like the issue is in ImportRewrite (in jdt.ui) that doesn't check for the names from inner types. This made sense for types because we won't encounter inner types names as part of the outer type's declaration. But as seen in this example, records are an exception. One way to fix this would be, in ImportRewrite#findInImports(), we should look for known names from body declarations of a record and if found return ImportRewriteContext.RES_NAME_FOUND Could be a good first for a beginner. Tag @noopur2507 |
|
Still present in 2023-03 (4.27.0) - Build id: 20230309-1520 |
|
@noopur2507 Can you please take this forward? |
|
I met it on May 6, 2023 and found this opened issue. |
Version: 2022-06 (4.24.0)
Build id: 20220609-1112
Given a record nesting a record:
On organize imports, this will have an import for
B. At the same time thisimportis marked as unneeded.The text was updated successfully, but these errors were encountered: