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

Inheritable @Optional and evaluation at getter even if field exists #659

Open
derKrischan opened this issue Dec 8, 2019 · 0 comments
Open

Comments

@derKrischan
Copy link

I'm experimenting with AWS CDK in Java and have to build some Property beans for cloud constructs. Usually it is a mix of mostly predefined options and some options that are later resolved (e.g. IDs of dependent constructs). Therefore I thought it might be worth a try to mix immutable.io with lightbend config and except of one small issue everything works out fine.
When I annotate a property in an immutable bean class with @optional the generated bean class doesn't have the annotation because @optional isn't marked as inheritable. In my mind it should be and I haven't found a reason in the lightbend config discussions why not. (Maybe to harsh but in my mind whenever you override a field in an inherited bean and don't want it to inherit the parent annotations, you already have a code smell.)
the second point belongs to #570 where the @optional at getters is only evaluated if the field does not exist. Even if the field exists and doesn't have the annotation, the corresponding getter should also be evaluated for the annotation.
I will try to deliver a PR as a discussion base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant