On Mon, 15 Mar 2021 13:34:45 GMT, Rémi Forax 
<github.com+828220+fo...@openjdk.org> wrote:

>> I don't think that cast from `Object` to a raw type is unchecked, so as 
>> error does not seem warranted to me.
>> 
>> However, I agree javac should produce the rawtype warning for rawtypes in 
>> pattern matching instanceof, because we are introducing a new variable (and 
>> casting). I've filled:
>> https://bugs.openjdk.java.net/browse/JDK-8263590
>> 
>> Note the non-pattern matching instanceof does not produce the rawtype 
>> warning, and I don't think it should produce it.
>
> yes,
> javac should emit a warning in that case, that also the answer of Brian.
> 
> https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-March/002925.html

Then we should use an unbounded wildcard here and in similar places to avoid 
"rawtype" warnings in the future.

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

PR: https://git.openjdk.java.net/jdk/pull/2913

Reply via email to