mapstruct / mapstruct/mapstruct-idea

Array and Map paramter ignored as source-parameter if used as only source

オープン
#173 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Java
スター
168
フォーク
41
PR マージ指標
30日以内にマージされた PR はありません

説明

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.
grafik
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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

レポートにある Java MultiSourceMapper の例で問題を再現し、array と Map のソースパラメーターの両方を確認して、記載されている Iterable の動作と比較します。プラグインのソースパラメーター処理と completion の動作を追跡します。array と Map のパラメーターが唯一のソースとして認識され、マッピングされた target の警告が表示されなくなり、completion にそれらが一覧表示されれば、fix は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。