Randgalt / record-builder

Record builder generator for Java records

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method names should start with a lower case letter

faris-git opened this issue · comments

As my SAST vulnerability report tool always complain that "Method names should start with a lower case letter". Is there any reason to use static constructor method name with capital letter.

@RecordBuilder
public record MyRecord(String name){}

The generated code:

     /**
     * Static constructor/builder. Can be used instead of new MyRecord(...)
     */
    @Generated("io.soabase.recordbuilder.core.RecordBuilder")
    public static MyRecord MyRecord(String name) {...}

Identifier: Find Security Bugs-NM_METHOD_NAMING_CONVENTION

May be it would be great if we can configure the method name conventions.

Expected generated code:

/**
  * Static constructor/builder. Can be used instead of new MyRecord(...)
  */
 @Generated("io.soabase.recordbuilder.core.RecordBuilder")
 public static MyRecord myRecord(String name) {...}

This is a common pattern in FP. You can see an example of it here: https://github.com/Randgalt/expressive-java - we could add an option, though, to not generate the method.