eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
164 stars 130 forks source link

[23] VerifyError during conversion between T extends Short and short #2958

Closed stephan-herrmann closed 1 month ago

stephan-herrmann commented 1 month ago

when checking primitive conversions involving a type variable, always use the superclass to find a boxing type, knowing that all boxing types are classes, so other bounds are irrelevant.

fixes https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2937

stephan-herrmann commented 1 month ago

We have been using erasure() already in a few placed to find a boxing type hidden in a type variable, but we missed (at least) one relevant location.

OTOH, I don't think we have a card blanche to use erasure() for other situations, so I tried to establish the following principles:

The first item should not be a semantic change, just document that and why looking in this one location is sufficient.

I left one questionable use of erasure() in the context of NARROWING_AND_UNBOXING_CONVERSION which has a TODO anyway.