Closed stephan-herrmann closed 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:
superclass()
for the substitution rather than erasure()
with the following justification:
superclass
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.
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