On Tue, 24 Jan 2023 11:07:07 GMT, Rémi Forax <[email protected]> wrote:

>> @stuart-marks Sorry, missed this notification. I initially had the same 
>> idea, but decided against it because it forces me to suppress "rawtypes" 
>> since `coll instanceof ListN` is not considered to be a rawtype, but `coll 
>> instanceof ListN c` is. And currently it won't allow for `coll instanceof 
>> ListN<E> c`...
>
> `coll instanceof ListN<?> list` should work.

@forax @stuart-marks Yeah, that works. It's unfortunate that it's not possible 
to match on the actual (generic) type, as then both sides of the || could use 
type unification to avoid having to do the cast on the return value as well. 
Submitted a commit to switch to the wildcard version.

-------------

PR: https://git.openjdk.org/jdk/pull/11847

Reply via email to