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

[refactoring] quick fix to convert autowired field to constructor param shows up even if the constructor param already exists #815

Closed
martinlippert opened this issue Aug 10, 2022 · 1 comment
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode status: needs-investigation theme: refactoring type: bug

Comments

@martinlippert
Copy link
Member

I have a class like this:

@Component
public class MySomething {
	
    @Autowired
    private String something;

    MySomething(String something) {
        this.something = something;
    }
}

The quick fix to convert the autowired field into a constructor param shows up, even through the constructor param already exists. This should not be the case. Instead, a quick fix should be around to remove the autowired annotation only.

In addition to that, when I execute the quick fix, it results in:

@Component
public class MySomething {
	
    private String something;

    MySomething(String something, String something, String something) {
        this.something = something;
        this.something = something;
        this.something = something;
    }
}

So I end up having the same constructor param three (!) times.

@martinlippert martinlippert added type: bug status: needs-investigation for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: refactoring labels Aug 10, 2022
@martinlippert martinlippert added this to the 4.16.0.RELEASE milestone Aug 10, 2022
@martinlippert martinlippert removed this from the 4.16.0.RELEASE milestone Sep 12, 2022
@BoykoAlex
Copy link
Contributor

Should be fixed with the adoption of the latest rewrite

@martinlippert martinlippert added this to the 4.16.1.RELEASE milestone Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode status: needs-investigation theme: refactoring type: bug
Projects
None yet
Development

No branches or pull requests

2 participants