MCR-3650 Refactor MCRConfigurableInstanceHelper into multiple classes#2870
Merged
sebhofmann merged 1 commit intomainfrom May 5, 2026
Conversation
1168254 to
820cf37
Compare
0a00587 to
d61892f
Compare
d4ba823 to
79f7c69
Compare
cb570b2 to
26cced8
Compare
76cb02f to
48a4916
Compare
48a4916 to
156469e
Compare
771e7e0 to
c39eb2b
Compare
e3c7c9f to
f5789ca
Compare
This was referenced Apr 21, 2026
021cbcc to
04ac02f
Compare
24 tasks
c23cb3f to
756c532
Compare
sebhofmann
requested changes
May 4, 2026
Member
sebhofmann
left a comment
There was a problem hiding this comment.
Found by AI:
- Duplicated word in error message — MCRInstantiator.java:236-237: "...has " + " has no singleton..." produces "...has has no...".
- Unbalanced apostrophe — MCRInstantiator.java:107-108 and MCRInstantiatorUtils.java:90-91: "Instance of class " + name + "', configured in ..." has a closing ' without an opening one.
- Mutable public sets — Options.NONE / Options.IMPLICIT in MCRInstanceConfiguration and MCRTargetType.ALL are raw EnumSets exposed as public static final. Any caller can mutate them. Wrap with Collections.unmodifiableSet(...) or use
Set.of(...). - Wrong Javadoc references:
- MCRFieldInjectable.java:30 says "is a MCRFieldInjectable" (self-referential).
- MCRMethodInjectable.java:30 says "is a MCRFieldInjectable" (copy-paste error).
- MCRRawPropertiesSource.java:32 says "interprets a MCRSourceBase" (should be MCRRawProperties).
| * in principle, be used for injection. It provides abstractions for obtaining a value ({@link MCRSource}) | ||
| * based on present annotations, and injecting obtained values ({@link MCRTarget}). | ||
| */ | ||
| public interface MCRInjectable { |
Member
There was a problem hiding this comment.
- Consider merging MCRInjectable and MCRTarget
- MCRInjectable should be sealed
Contributor
Author
There was a problem hiding this comment.
MCRInjectable represents a component that can, in principle, be used for injection (if it is annotated with one of the supported annotations). MCRTarget represents a component that is, in fact, being used for injection. I've fixed the class comments.
| * Common abstraction for components of a class (i.e., a {@link Field} or a {@link Method}) that can, | ||
| * in principle, be used for injection. It provides an abstraction for obtaining a value based on present annotations. | ||
| */ | ||
| public interface MCRSource { |
Member
There was a problem hiding this comment.
- MCRSource should be sealed anly only permit the classis in the source package. MCRSourceType enum is a closed list so extension is not intended.
| @SuppressWarnings({ "PMD.MCR.Singleton.ClassModifiers", "PMD.MCR.Singleton.PrivateConstructor", | ||
| "PMD.MCR.Singleton.NonPrivateConstructors", "PMD.MCR.Singleton.MethodModifiers", | ||
| "PMD.MCR.Singleton.MethodReturnType", "PMD.SingletonClassReturningNewInstance" }) | ||
| abstract class MCRSourceBase implements MCRSource { |
Member
There was a problem hiding this comment.
- Consider renaming to MCRInstaceSourceBase, because getInstance is only used in MCRInstanceSource, MCRInstanceMapSource, MCRInstanceListSource
- allowedTargetTypes() is dead code, because no subclass overrides it
Contributor
Author
There was a problem hiding this comment.
MCRPostConstructionSource should indeed have a differing implementation of allowedTargetTypes, since it is only allowed on methods. Small bug that we can fix in this PR.
3b3ad4b to
affc313
Compare
affc313 to
e2b6841
Compare
sebhofmann
approved these changes
May 5, 2026
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.
Link to jira.
This PR only refactors, further simplification & clean-up is done in #2922.
Pull Request Checklist (Author)
Please go through the following checklist before assigning the PR for review:
Ticket & Documentation
fixed-versionis correctly set in the ticket and matches the PR's target branch (main).Feature & Improvement Specific Checks
Testing
MCR Conventions & Metadata
mycore.properties.mycore.properties.Multi-Repo Considerations
MIRrequired?