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

New method creation that specifies generic parameter needs to use appropriate generic parameter name #330

Closed
jjohnstn opened this issue Nov 7, 2022 · 0 comments · Fixed by #332
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jjohnstn
Copy link
Contributor

jjohnstn commented Nov 7, 2022

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

Another related but different problem: if the destination is already generic, the correct type variable is not used.

Before quickfix:

    public class Bug {
        
        private static class Class1<T> {
            T t;
            Class2<T> c2;
            
            void method() {
                c2.useT(t);  // Quickfix "Create method 'useT(T)' in Class2"
            }
        }
    
        private static class Class2<U> {
        }
    }

After quickfix:

    public class Bug {
        
        private static class Class1<T> {
            T t;
            Class2<T> c2;
            
            void method() {
                c2.useT(t);
            }
        }
    
        private static class Class2<U> {
            public void useT(T t) {  // Should be (U t), not (T t)
            }
        }
    }
@jjohnstn jjohnstn self-assigned this Nov 7, 2022
@jjohnstn jjohnstn added the bug Something isn't working label Nov 7, 2022
jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Nov 10, 2022
- refine type parameter logic to handle substitution of class
  type parameters when appropriate
- also handle adding type parameters when needed that may come from
  either the enclosing method or from a type
- add new tests to UnresolvedMethodsQuickFixTest1d8
- fixes eclipse-jdt#330
jjohnstn added a commit that referenced this issue Dec 14, 2022
- refine type parameter logic to handle substitution of class
  type parameters when appropriate
- also handle adding type parameters when needed that may come from
  either the enclosing method or from a type
- add new tests to UnresolvedMethodsQuickFixTest1d8
- fixes #330
@jjohnstn jjohnstn added this to the 4.27 M1 milestone Dec 14, 2022
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