This repository was archived by the owner on Jan 20, 2023. It is now read-only.
Fix converter nullability. #42
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.
変更の前提
ProjectMapKにおける変換処理の方針について
ProjectMapK内では、変換処理の引数をnon-nullで扱う。理由は、変換処理は共通で使い回されるものである一方、入力が
nullだった場合に設定する値というのは関数ごとに決定されるべきと考えられるためである。補足: 「nullならデフォルト値」の実現方法
「
nullならデフォルト値」の実現は以下2つの方法が考えられる。null時の取り扱いを記述するKParameterRequireNonNullアノテーションとデフォルト引数を組み合わせる変更内容
修正
BoundKMapperで、nullでも変換処理を動かしていた(= 他のマッピングクラスと挙動が異なっていた)不具合の修正を行った。破壊的変更
変換処理は値が
nullでは発生しないため、AbstractKConverterのconvert関数のパラメータをnon-null要求に修正した。その他
変更に合わせテストの修正を行い、テストパターンも追加を行った。