#129 improve support of mapping composition #134
Merged
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 is about #129.
Mapping composition (or meta annotations) were already tacklet with the following commit (target version 1.2.1): 35f1712
However, the used utility method
com.intellij.codeInsight.MetaAnnotationUtil#findMetaAnnotations
returns only a single (more precise: the first)@Mapping
annotation. Therefore this did not work as expected (but already worked with the simple test namedUnmappedTargetPropertiesWithMetaAnnotationInspectionTest
.I implemented an own recursive method to find
@Mapping
annotations and provided a test case with an infinitve chained meta-annotation.I also added a test with combined
@Mapping
and meta-annotation on the same mapping method. The current implementation did not merge them together but worked against each other.Sidenote: The intellij utility method
MetaAnnotationUtil#findMetaAnnotations
used an internal cache. I chose against using one, because it felt like a premature optimization which made the code less readable. Let me know what you think, especially because of the TODO comments to use a cache in line 300 😆If we/you really want this, we should do this in a separate issue/PR with a clean cache solution outsourced in a separate class to keep the code clean.
I can also improve this with the current PR. Let me know what you think.