AssertBetweenInconvertibleTypes false positive generated when AbstractAssert#isEqualTo follows AbstractIterableAssert#first() #12

Closed
opened 2023-09-20 19:28:44 +02:00 by Ghost · 2 comments

The warning 'isEqualTo()' between objects of inconvertible types 'ArrayList<Integer>' and 'int'

is being generated by the following code:

final var test = new ArrayList<Integer>();
test.add(1);
assertThat(test).first().isEqualTo(1);

This is happening no matter what the generic type ends up being.

This code does not produce the warning:

final var test = new ArrayList<Integer>();
test.add(1);
final ListAssert<Integer> listAssert = assertThat(test);
final ObjectAssert<Integer> objAssert = listAssert.first();
objAssert.isEqualTo(1);
The warning `'isEqualTo()' between objects of inconvertible types 'ArrayList<Integer>' and 'int'` is being generated by the following code: ```java final var test = new ArrayList<Integer>(); test.add(1); assertThat(test).first().isEqualTo(1); ``` This is happening no matter what the generic type ends up being. This code _does not_ produce the warning: ```java final var test = new ArrayList<Integer>(); test.add(1); final ListAssert<Integer> listAssert = assertThat(test); final ObjectAssert<Integer> objAssert = listAssert.first(); objAssert.isEqualTo(1); ```
Owner

Hi Mr. Queasy,

I'm not sure what your report is about. The AssertBetweenInconvertibleTypes inspection is, as far as I know, an inspection of the IntelliJ core and not generated by Cajon. Thus, this should be addressed to Jetbrains rather than me.

Please clarify, otherwise I will close this issue as invalid. Thank you.

Hi Mr. Queasy, I'm not sure what your report is about. The AssertBetweenInconvertibleTypes inspection is, as far as I know, an inspection of the IntelliJ core and not generated by Cajon. Thus, this should be addressed to Jetbrains rather than me. Please clarify, otherwise I will close this issue as invalid. Thank you.
Owner

Not sure you saw my reply, I had email notifications disabled, but they should be working now (hopefully).

Not sure you saw my reply, I had email notifications disabled, but they should be working now (hopefully).
chrisly42 added the invalid label 2023-10-10 21:05:55 +02:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: chrisly42/cajon-plugin#12