-
Notifications
You must be signed in to change notification settings - Fork 218
refactor: clean-up WorkflowReconcileResult and Condition #1388
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
Conversation
metacosm
commented
Aug 8, 2022
- fix: grammar
- refactor: clean up WorkflowReconcileResult
- refactor: make it easier to create Conditions
cd87a31
to
ce1ca8d
Compare
...-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/Condition.java
Outdated
Show resolved
Hide resolved
|
||
@SuppressWarnings("rawtypes") | ||
Class<? extends Condition> deletePostcondition() default VoidCondition.class; | ||
Class<? extends Condition> deletePostcondition() default Condition.class; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH before it was more expressive before, kinda describing that what is there it is a special value - so presumably handled specially subsequently. Taking a look on this is little confusing? maybe document it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we lost any expressiveness with this change: the default is the non-instantiable interface so it fulfils the same role as a default value (i.e. we can effectively check that the provided value is not the default one) without the need to create an additional class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure, I mean VoidCondition has explicitly in it's name that it is about not having a condition. Byt fine by me also this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with VoidCondition
is that it is still an implementation, meaning that if we somehow forget to check for it in the code that processes the annotation then you get a valid condition which is not what you want. Condition
itself cannot be instantiated so if we don't process it, this will lead to a quick exception making it easier to figure out what is wrong as opposed to tracking down why some events are processed when they should not be because we forgot to check for VoidCondition
somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making VoidCondition
abstract would help with that, since it would instantly fail. Also now it throws always an exception, so it will instantly recognized in any test something is wrong.
But again I'm fine with both, I like that there are no more dedicated classes, just needs to be documented that this is the intention putting the interface there as default, that is a good enough alternative for me :)
...-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/Condition.java
Outdated
Show resolved
Hide resolved
f40b556
to
3610ebd
Compare
3610ebd
to
c7689f1
Compare
Kudos, SonarCloud Quality Gate passed! |
skip-ci
Should make it easier to handle Conditions and Filters.
Should make it easier to handle Conditions and Filters.