On Mon, 15 Mar 2021 10:18:26 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/constant/DynamicConstantDesc.java line 
>> 360:
>> 
>>> 358:     public final boolean equals(Object o) {
>>> 359:         if (this == o) return true;
>>> 360:         return (o instanceof DynamicConstantDesc desc)
>> 
>> should be
>>   `(o instanceof DynamicConstantDesc<?> desc)`
>
> I noticed that too initially. However, `javac` does not seem to produce a 
> "rawtypes" warning. Which makes sense, if you think about it.

The problem is that `desc` is a raw type and raw types doesn't play well with 
the rest of the language (in particular with inference).

I think it's a bug in javac, it should not even raise a warning but an error.
But the spec is not fully clear.

The spec says that the narrow conversion should not be unchecked
https://docs.oracle.com/javase/specs/jls/se15/preview/specs/patterns-instanceof-jls.html#jls-14.30.2
it depends if you consider the raw conversion as unchecked or not.

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

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

Reply via email to