Skip to content

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

Closed

Description

@martinlippert

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.

Activity

  1. added
    for: eclipse
    for: vscode
    on Aug 10, 2022
  2. added this to the 4.16.0.RELEASE milestone on Aug 10, 2022
  3. removed this from the 4.16.0.RELEASE milestone on Sep 12, 2022
  4. BoykoAlex commented on Oct 7, 2022

    @BoykoAlex
    Contributor

    Should be fixed with the adoption of the latest rewrite

  5. added this to the 4.16.1.RELEASE milestone on Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodestatus: needs-investigationtheme: refactoringtype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions