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
Move annotation discovery into AbstractEntryBasedExtension #485
Merged
nipafx
merged 14 commits into
junit-pioneer:main
from
beatngu13:issue/460-refactor-envvar-sysprop
May 29, 2021
Merged
Move annotation discovery into AbstractEntryBasedExtension #485
nipafx
merged 14 commits into
junit-pioneer:main
from
beatngu13:issue/460-refactor-envvar-sysprop
May 29, 2021
Conversation
This file contains 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
Unfortunately, static declarations in inner classes (e.g. a static factory method `empty()`) are not supported in Java 8.
Eat your own dog food!
Since the extension context store no longer queries ancestors, original entries can always be restored as the backup is simply empty if there is no value for the supplied key.
beatngu13
changed the title
Refactor AbstractEntryBasedExtension
Move annotation discovery into AbstractEntryBasedExtension
May 14, 2021
nipafx
reviewed
May 29, 2021
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.
Looks good to me. The annotations as generic types and the ...Mapper
methods are a bit weird at first sight, but all together they make for a pretty type-safe way to handle the problem, particularly given annotations can't implement interfaces.
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.
Closes #460. This issue was basically a description of the current usage of both
BeforeAllCallback
andBeforeEachCallback
, which was indirectly followed by a discussion on "Enclosing classes vs Before/AfterAll" in #479. As a goal in the first issue, I said I would like to add an implementation note to prevent further confusion. In addition, it would be helpful if a core part of the implementation – annotation discovery – was a single point of failure, and not duplicated inEnvironmentVariableExtension
andSystemPropertyExtension
.Note that this PR is based on the currently unmerged changes in #481. I also marked this as a draft since I haven't updated the
README.md
yet to not cause merge conflicts.Proposed commit message:
PR checklist
The following checklist shall help the PR's author, the reviewers and maintainers to ensure the quality of this project.
It is based on our contributors guidelines, especially the "writing code" section.
It shall help to check for completion of the listed points.
If a point does not apply to the given PR's changes, the corresponding entry can be simply marked as done.
Documentation (general)
.adoc
file in thedocs
folder, e.g.docs/report-entries.adoc
.adoc
files)Documentation (new extension)
docs/docs-nav.yml
navigation has an entry for the new extensionpackage-info.java
contains information about the new extensionCode
Contributing
README.md
mentions the new contribution (real name optional)I hereby agree to the terms of the JUnit Pioneer Contributor License Agreement.