Allow system properties abstraction#5719
Open
TomaszGaweda wants to merge 3 commits into
Open
Conversation
3e2d229 to
5e4c3be
Compare
Signed-off-by: Tomasz Gawęda <tomasz.gaweda@outlook.com>
Signed-off-by: Tomasz Gawęda <tomasz.gaweda@outlook.com>
Signed-off-by: Tomasz Gawęda <tomasz.gaweda@outlook.com>
5e4c3be to
aa655cc
Compare
Author
|
Thanks @mpkorstanje for adding the labels and forwarding to the Team. Please let me know when you will need changes to the PR, questions answered or anything else. Have a great day! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows building abstractions very similar to SystemPropertiesExtension.
The use case in my case is related to Hazelcast (#hazelcast/hazelcast), where we have our class wrapper for ClusterProperties -
ClusterProperty. Cluster properties can be set via system properties.It's common to see then patterns like
System.setProperty(SOME_PROPERTY.name(), "value")in the code. We are now slowly migrating to JUnit 5 and it would be awesome if we could use@SetSystemProperty- however, Java does not allow us to call.name()method in annotation.With this PR merged we will be able to make similar annotations like:
Obviously it is possible to make such extensions right now, however it will duplicate existing extension - I'd even say, only changes will be other annotation names. I think there will be more places where libraries would like to have derivatives of the SetSystemProperty & Co. annotations.
Notes to reviewers:
AbstractSystemPropertiesExtensionis mostly a copy of oldSystemPropertiesExtensionSystemPropertiesExtensionimplementsAbstractSystemPropertiesExtensionwith current and standard set of annotationsSystemPropertiesExtensionViaCustomAnnotationTests, which is also mostly copied fromSystemPropertiesExtensionTests, testing new abstraction and showing the usage.I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@APIannotations