Array and Map paramter ignored as source-parameter if used as only source
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the issue with the Java MultiSourceMapper example from the report, checking both array and Map source parameters and comparing the stated Iterable behavior. Trace the plugin's source-parameter handling and completion behavior; the fix is done when array and Map parameters are recognized as the only source, mapped target warnings no longer appear, and completion lists them.
Written by the indexing model from the issue text.
Description
I found while investigation #168, that currently the plugin ignores source parameters of type array and Map, if used as the only source parameter.
Here a small example Mapper:
import org.mapstruct.Mapper;
import java.util.Map;
@Mapper
public interface MultiSourceMapper {
class ArrayTarget {
private int[] myArray;
public int[] getMyArray() {
return myArray;
}
public void setMyArray(int[] myArray) {
this.myArray = myArray;
}
}
ArrayTarget mapToArrayTarget(int[] myArray);
class MapTarget {
private Map<Integer, Integer> myMap;
public Map<Integer, Integer> getMyMap() {
return myMap;
}
public void setMyMap(Map<Integer, Integer> myMap) {
this.myMap = myMap;
}
}
MapTarget mapToMapTarget(Map<Integer, Integer> myMap);
}
This generates code where all targets are mapped based on their names. The plugin currently ignores the source parameters and give a unmapped target property warning.
Also the completion doesn't show them as source parameters.
One thing to notice:
For Iterable this behavior is correct as mapstruct itself doesn't support mapping from Iterable to Object.
- Dominant language
- Java
- Stars
- 168
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapstruct/mapstruct-idea
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mapstruct/mapstruct-idea#274 · 2 comments ·
-
feature hack.commit.push
Difficulty 3/5 1-2 days Newbie friendliness 68/100
mapstruct/mapstruct-idea#267 ·
-
feature hack.commit.push
Difficulty 3/5 1-2 days Newbie friendliness 55/100
mapstruct/mapstruct-idea#266 ·
-
feature hack.commit.push
Difficulty 3/5 1-2 days Newbie friendliness 75/100
mapstruct/mapstruct-idea#265 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
mapstruct/mapstruct-idea#257 · 1 comment ·
All issues in mapstruct/mapstruct-idea
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/flink-agents#1152 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jenkinsci/blueocean-plugin#5417 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo-graphs#75 ·