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

Don't change field name in parameters list #38

Closed
View12138 opened this issue Feb 23, 2024 · 1 comment
Closed

Don't change field name in parameters list #38

View12138 opened this issue Feb 23, 2024 · 1 comment

Comments

@View12138
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Don't change field name in parameters list when the parameter name is the same as the field name. eg: name = newName;.

Describe the solution you'd like
when the parameter name is the same as field name, use this to assess field. eg: this.name = name;.

Describe alternatives you've considered

// source code
[AllArgsConstructor(MemberType = MemberType.{{memberType}})]
internal partial class TestClass
{
	private string name;
	private string _name;
	private string @string;
	private int _age;
}

// now <auto-generated/>
internal partial class TestClass
{
    internal TestClass(string newName, string name, string newString, int newAge)
    {
        name = newName;
        _name = name;
        @string = newString;
        _age = newAge;
    }
}

// new <auto-generated/>
internal partial class TestClass
{
    internal TestClass(string name1, string name2, string @string, int age)
    {
        name = name1;
        _name = name2;
        this.@string = @string;
        this.age = age;
    }
}
View12138 pushed a commit to View12138/Lombok.NET that referenced this issue Feb 23, 2024
CollinAlpert pushed a commit that referenced this issue Mar 11, 2024
* Feat: #38

* Update RequiredArgsConstructorGenerator.cs

fix: remove Whitespace

---------

Co-authored-by: View <ms_view@outlok.com>
@CollinAlpert
Copy link
Owner

Fixed in v2.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants