Collection Membership operator can return unintuitive results if collection has mix of types
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with CollectionMembershipOperator.java, especially lines 34-47, and trace how the membership and “is containing” operations coerce mixed-type collections. Reproduce the examples from the issue, then establish the intended comparison behavior before identifying the regression coverage needed to show that null, numeric, string, and boolean values are handled consistently.
Written by the indexing model from the issue text.
Description
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.
{{ 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)
- Dominant language
- Java
- Stars
- 785
- Forks
- 184
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 1
Contributor guide
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 HubSpot/jinjava
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Jinjava 3.0 Open
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
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 ·