Skip to content

Annotated parameters #433

Open
Open
@Rc-Cookie

Description

@Rc-Cookie

Currently, the parameter string parser messes up completely when you attempt to annotate a parameter type, e.g.

@param @NotNull String myParam

In the generated code, the generator mostly uses the annotation without the type in place of the type, and the type where you would expect the variable name.

Annotated parameters would be really useful to automatically fill and check the parameters, though only if the annotations would actually be exposed by the API. Currently, we only get the raw types with getParamInfo(). I would propose just returning the complete java.lang.reflect.Parameter object instead of Parameter.getType(), maybe in a method getExtendedParamInfo(). That would, as a bonus, also allow you to receive generic types properly using Parameter.getParameterizedType().

While at the topic, further information not accessible through the API is whether a parameter has a default value. From on-demand compilation this should be pretty simple to extract, but to be accesible only through already compiled classes the information could be encoded as a static field in the generated java class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions