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

Bug 573327 - invalid suggestions for loop variable missing type #657

Closed
jjohnstn opened this issue Jul 5, 2023 · 0 comments · Fixed by #658
Closed

Bug 573327 - invalid suggestions for loop variable missing type #657

jjohnstn opened this issue Jul 5, 2023 · 0 comments · Fixed by #658
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jjohnstn
Copy link
Contributor

jjohnstn commented Jul 5, 2023

From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=573327

For the following snippet taken from UnresolvedTypesQuickFixTest.testForEachMissingType()

import java.util.*;

public class E {
    
public void foo(ArrayList<? extends HashSet<? super Integer>> list) {
    for (element: list) {
    }
}

}

A number of quick fix suggestions are made. The first one:

Create loop variable 'element' seems to be the only valid one.

Among others are:

Create enum element
Create class element
Create interface element
Change to ElementType (java.annotation)
Change to Statement (java.sql)
Fix project setup...

There can be many more class suggestions when running in a typical Eclipse. All of them but the first one are invalid choices.

@jjohnstn jjohnstn added the bug Something isn't working label Jul 5, 2023
@jjohnstn jjohnstn added this to the 4.29 M2 milestone Jul 5, 2023
@jjohnstn jjohnstn self-assigned this Jul 5, 2023
jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Jul 5, 2023
- fixes eclipse-jdt#657
- add new code in UnresolvedElementsSubProcessor to recognize when a
  lower-case enhanced for-loop variable that has no type causes a
  "create loop variable xxxx" proposal and then do not suggest
  creating new types, records, etc...
- modify existing test in UnresolvedTypesQuickFixTest
github-actions bot pushed a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Jul 14, 2023
- fixes eclipse-jdt#657
- add new code in UnresolvedElementsSubProcessor to recognize when a
  lower-case enhanced for-loop variable that has no type causes a
  "create loop variable xxxx" proposal and then do not suggest
  creating new types, records, etc...
- modify existing test in UnresolvedTypesQuickFixTest
jjohnstn added a commit that referenced this issue Jul 14, 2023
…pe (#658)

- fixes #657
- add new code in UnresolvedElementsSubProcessor to recognize when a
  lower-case enhanced for-loop variable that has no type causes a
  "create loop variable xxxx" proposal and then do not suggest
  creating new types, records, etc...
- modify existing test in UnresolvedTypesQuickFixTest
fedejeanne pushed a commit to fedejeanne/eclipse.jdt.ui that referenced this issue Aug 23, 2023
…pe (eclipse-jdt#658)

- fixes eclipse-jdt#657
- add new code in UnresolvedElementsSubProcessor to recognize when a
  lower-case enhanced for-loop variable that has no type causes a
  "create loop variable xxxx" proposal and then do not suggest
  creating new types, records, etc...
- modify existing test in UnresolvedTypesQuickFixTest
fedejeanne pushed a commit to fedejeanne/eclipse.jdt.ui that referenced this issue Aug 23, 2023
…pe (eclipse-jdt#658)

- fixes eclipse-jdt#657
- add new code in UnresolvedElementsSubProcessor to recognize when a
  lower-case enhanced for-loop variable that has no type causes a
  "create loop variable xxxx" proposal and then do not suggest
  creating new types, records, etc...
- modify existing test in UnresolvedTypesQuickFixTest
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
None yet
Development

Successfully merging a pull request may close this issue.

1 participant