SONARJAVA-5621 Fix issue in CFG computation with generic record pattern#5191
Conversation
Samples with generic record patterns as added in the unit test, were causing UnsupportedOperationExceptions
dorian-burihabwa-sonarsource
left a comment
There was a problem hiding this comment.
The change looks good but we can probably extend the test code with bounded types.
We should also improve the ticket to give it the appropriate type (bug?), affected version and description.
| void generic_record_pattern() { | ||
| CFG cfg = buildCFG(""" | ||
| private static boolean testGen3(Object o) throws Throwable { | ||
| return o instanceof GenRecord1<?, ?>(Integer i, var s) && i.intValue() == 3 && s.length() == 0; |
There was a problem hiding this comment.
I am trying some corner cases here but we should probably test with a bounded wild card
There was a problem hiding this comment.
return o instanceof GenRecord1<?, ? extends CharSequence>(Integer i, var s) && i.intValue() == 3 && s.length() == 0;
|
dorian-burihabwa-sonarsource
left a comment
There was a problem hiding this comment.
LGTM 👍🏿 Thanks for adding the new test case!




SONARJAVA-5621