Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Collection Membership operator can return unintuitive results if collection has mix of types

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java
領域
backend

調査の方向性

CollectionMembershipOperator.java、特に34-47行目から始め、membership 操作と “is containing” 操作が混在型のコレクションをどのように型変換するかを追跡してください。issue の例を再現し、その後、想定される比較動作を確立してから、null、数値、文字列、ブール値が一貫して処理されることを示すために必要なリグレッションテストのカバレッジを特定してください。

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

説明

Since the CollectionMembershipOperator coerces the type of the item being tested to the first (or first non-null) element in the list, it can lead to unexpected/unintuitive results.

https://github.com/HubSpot/jinjava/blob/af0819ac4cfc8fb99cfa9b7ccddfbfd251946f9d/src/main/java/com/hubspot/jinjava/el/ext/CollectionMembershipOperator.java#L34-L47

{{ null in [null, 1, 2] }} {# true #}
{{ null in [1, null, 2] }} {# false - null converted to 0; no 0 in list #}
{{ null in [1, null, 2, 0] }} {# true - because of the 0 in the list, not the null #}
{{ null in [0, 1, 2] }} {# true #}

{{ 1 in ['1', 2 ] }} {# true - 1 converted to '1' #}
{{ 2 in ['1', 2 ] }} {# false - 2 is converted to '2', no '2' in list #}
{{ 1 in [false, 1] }} {# false - 1 converted to true #}
{{ 1 in [true, 0] }} {# true #}
{{ 1 in [null, 'abc', 1] }} {# false #}

{{ '' in [1, '', 2] }} {# false #}
{{ '' in [0, 1, 2] }} {# true #}

(The same applies to is containing, e.g. [false, 1] is containing 1 is false)

主要言語
Java
スター
787
フォーク
184
平均マージ
6日 22時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

HubSpot/jinjava のほかの issue

HubSpot/jinjava の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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