Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle absence of no-args constructor for @ConsiderForDowel #4

Closed
6 tasks done
jayasuryat opened this issue Oct 4, 2022 · 1 comment · Fixed by #7
Closed
6 tasks done

Handle absence of no-args constructor for @ConsiderForDowel #4

jayasuryat opened this issue Oct 4, 2022 · 1 comment · Fixed by #7
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jayasuryat
Copy link
Owner

jayasuryat commented Oct 4, 2022

Currently DowelGenerator is not considering if the class annotated with @ConsiderForDowel has a no-args constructor or not. It just assumes such a constructor exists and generates code which tries to invoke a (non-existent) no-args constructor. See here.

DowelGenerator should handle such cases gracefully and log meaningful errors.

TODO

  • Remove strict reliance on the primary constructor of the class annotated with @ConsiderForDowel annotation for object creation. Read more here.
  • Log error for absence of non-private constructors separately.
  • Log error for absence of no-args constructors separately.
  • Update processor tests for the changes
  • Update lint rules to handle these cases
  • Update lint rule tests for the changes
@jayasuryat jayasuryat added the bug Something isn't working label Oct 4, 2022
@jayasuryat jayasuryat added this to the v0.5.1 milestone Oct 4, 2022
@jayasuryat
Copy link
Owner Author

Also, Dowel only considers the primary constructor of the classes annotated with @ConsiderForDowel annotation. This limitation is not really necessary. All Dowel cares about is being able to create an instance by calling the invoke method (i.e., () ex Provider()) without passing any parameters. It does not really matter if the corresponding constructor is primary or not, or wether it has default values or not.

So in light of this issue, it would also make sense to lift of this unnecessary limitation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant