Warning after upgrade to 1.6.0 - It must be typed with Map<String, ???> but it was typed with Map<Long,String> #3735
Unanswered
katerynasvitlychna
asked this question in
Q&A
Replies: 2 comments 2 replies
-
@filiphr created a separate discussion as was agreed |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks @katerynasvitlychna. So this is in since 1.5. Was done as part of #1075. It is reported because the parameters are not used explicitly. The only way to avoid this for now would be to use a wrapper. e.g. default AggregatedResponseDto map(FileActorDto dto, Map<Long, String> orgIdNameMap, Map<Long, String> contactIdNameMap) {
return map(new SourceWrapper(dto, orgIdNameMap, contactIdNameMap));
}
@Mapping(target = "orgNames", source = "wrapper")
@Mapping(target = "uploadedBy", source = "wrapper")
AggregatedResponseDto map(SourceWrapper wrapper); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following data:
and mapper method:
mapOrgNames and mapContactName handles mapping of my Maps to either Set or String.
version 1.4.2.Final - no warning was provided for the code above
version 1.6.0 - warning: The Map parameter "orgIdNameMap" cannot be used for property mapping. It must be typed with Map<String, ???> but it was typed with Map<Long,String>.
My question is, if mapping of Map<Long, ?> to bean was not supported in earlier versions( #3148 (comment)), how come warning was never thrown before?
What would be the better way to handle this?
I tried
@AfterMapping
, hoping it would do the trick - got the same warning. Working with@Context
didn't work either, since there can be only one context parameter; in my case, I have two. Adding method that would map Map<Long, String> to Map<String, String> didn't help as wellBeta Was this translation helpful? Give feedback.
All reactions