Missing unchecked cast warning in polymorphic method call - #5260
Conversation
+ Suppress CheckCast after polymorphic method call Fixes eclipse-jdt#5256
|
Do I see it right, the extra cast was not expected? If so, we should touch the platform bundle again like in eclipse-platform/eclipse.platform#2842 for the next build with this PR merged. |
correct
Has an I-build already picked up that touching? Otherwise we might be good already? |
Yes, I've built one already. |
It seem counterintuitive? Could you help to understand this? |
I'll try, though those polymorphic method calls are not my everyday business either. The declaration of methods like JLS 15.2.3, however, defines the "compile-time parameter types" and "compile-time result" to be determined from the context, in particular:
So, if you write ... (String) methodHandle.invokeExact(a)... the expression Ergo, the invocation already "has" the type requested by the cast, so no additional check via a Still the compiler should check for unsafe operations due to erasure. In the original example of #3651 a cast to a type variable Does this make sense? I checked with javac, which also does not issue a |
|
To further expand on this part:
The type information from the cast is then used for the signature in the The |
|
OK, thanks. |
Fixes #5256
See #5256 (comment) f.