-
Notifications
You must be signed in to change notification settings - Fork 112
Description
For v1: We should disallow record use annotations on factories and constructors.
When recording instances we take into account generative constructors and redirecting factories and tearoffs to those. We know what kind of instances they produce.
Non-redirecting factories are not treated explicitly. Their bodies may contain a call to a generative constructor, and such call is recorded as if it were a call to a generative constructor anywhere in the code. So, for instance recording this is correct.
However, such factories are not much different from static methods, so we could consider allowing recording them in the same way as static methods.
They are slightly more challenging though, because they might have redirecting factories pointing at them.
I don't believe we have any use cases right now, so marking this as low prio.
A list of tests to add if we do:
- Class Ordinary Factories
- Direct Call: Annotated ordinary factory in a class, called with constant and non-constant arguments.
- Tear-off: Tear-off of an annotated ordinary factory in a class.
- Redirecting Call: Redirecting factory pointing to an annotated ordinary factory in a class.
- Redirecting Tear-off: Tear-off of a redirecting factory pointing to an annotated ordinary factory in a class.
- Enum Ordinary Factories
- Direct Call: Annotated ordinary factory in an enum, called with constant arguments.
- Tear-off: Tear-off of an annotated ordinary factory in an enum.
- Redirecting Call: Redirecting factory pointing to an annotated ordinary factory in an enum.
- Redirecting Tear-off: Tear-off of a redirecting factory pointing to an annotated ordinary factory in an enum.
- Extension Type Ordinary Factories
- Direct Call: Annotated ordinary factory in an extension type, called with constant arguments.
- Tear-off: Tear-off of an annotated ordinary factory in an extension type.
- Redirecting Call: Redirecting factory pointing to an annotated ordinary factory in an extension type.
- Redirecting Tear-off: Tear-off of a redirecting factory pointing to an annotated ordinary factory in an extension type.
- Edge Cases & Deep Redirections
- Deep Redirection: Redirecting factory A -> Redirecting factory B -> Annotated Ordinary Factory.
- Redundant Annotation: Annotated ordinary factory inside an already annotated @RecordUse class.
- Optional Arguments: Annotated ordinary factory with optional/named parameters to ensure full argument capture.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status