Skip to content
This repository was archived by the owner on May 12, 2020. It is now read-only.
This repository was archived by the owner on May 12, 2020. It is now read-only.

RAVE should support multiple validator factories per compilation unit #39

@ZacSweers

Description

@ZacSweers

Currently RAVE limits this, though I'm not sure why. It's indirectly enforced by checking for multiple factories during verification, but this seems to be imposed by its inverted approach of using @Validated annotations to determine the factory to generate. I'm not sure if there was any other intention.

I actually ran into this in an unrelated bug where compilation with multiple modules that have duplicate package-info.java files will actually include multiple modules' models in the same processing round. Obviously this is a separate bug and would be really wasteful, but it got me thinking.

My suggestion would be this: Follow the approach used by auto-value-moshi/gson's factory processors and just collect all the @Validated and @Validator elements up front, then tie them together during processing. This would be api-invisible and not be a major breaking change to support.

I don't know that there's much use case for multiple validators per module, but if we're going to support/require specifying a validator per @Validated annotation it seems like we should at least support it. Otherwise I don't see why we have that specification requirement on @Validated annotations if they're all implicitly limited to one anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions