RFR: fail during inference if primitive classes are bounds during the first overload resolution phase
Vicente Romero
vromero at openjdk.java.net
Wed Feb 16 14:15:36 UTC 2022
On Wed, 16 Feb 2022 09:31:16 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Fail during inference if any bound is a primitive class during the first phase
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java line 216:
>
>> 214: deferredAttrContext.complete();
>> 215:
>> 216: /* if boxing is not allowed then, no undetVar should have a bound that is a primitive class, unless the bound
>
> Looks good and very minimal - probably a good starting option for a prototype. Other approaches I thought of include setting "poison" bounds on the inference variable, so as to make subtyping/equality/containment fail. But it's more complex and less localized.
>
> I believe this might just work. Of course some tests are needed :-)
yep, I will add more tests, thanks for the review
-------------
PR: https://git.openjdk.java.net/valhalla/pull/651
More information about the valhalla-dev
mailing list