Skip to content

Properly resolving types in ChangeMethodParameters refactoring. #8637

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Jul 7, 2025

Consider code like:

package test;

import java.util.List;

public class JavaApplication113 {

    public List<String> test(String str) {
        return null;
    }

    public static class SubClass extends JavaApplication113 {

        @Override
        public java.util.List<java.lang.String> test(java.lang.String str) {
            return null;
        }
        
    }
}

put cursor at JavaApplication113.test, open the Refactor/Change Method Parameters, and add a new parameter with type java.util.List<java.lang.String> and name par1. The refactoring will use java.util.List<java.lang.String> as the parameter type that is written in the source code. I think imports should be properly resolved on every place where the type is printed, and typically java.util.List should be imported, and the inserted type should be List<String>.

This is what this PR is attempting to do.

@lahodaj lahodaj added this to the NB27 milestone Jul 7, 2025
@lahodaj lahodaj added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests labels Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant