CollinAlpert / Lombok.NET

.NET adaptation for Java's Lombok using Source Generators.
MIT License
309 stars 16 forks source link

Constructor access modifiers cannot be customized when using constructor generators #25

Closed View12138 closed 1 year ago

View12138 commented 1 year ago

I have a internal class, bug I can't generte the public constructor.

// my code
[RequiredArgsConstructor]
internal partial class MyClass
{
    private readonly int myPropety;
}
// the generated code
internal partial class MyClass
{
    internal MyClass(int newMyPropety)
    {
        myPropety = newMyPropety;
    }
}

This is my solution

// my code
[RequiredArgsConstructor(ModifierType = ModifierType.Public)]
internal partial class MyClass
{
    private readonly int myPropety;
}
// the generated code
internal partial class MyClass
{
    public MyClass(int newMyPropety)
    {
        myPropety = newMyPropety;
    }
}
CollinAlpert commented 1 year ago

Fixed in version 2.1.2.