RFR: fail during inference if primitive classes are bounds during the first overload resolution phase
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Wed Feb 16 09:34:39 UTC 2022
On Wed, 16 Feb 2022 01:06:18 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> Fail during inference if any bound is a primitive class during the first phase
Marked as reviewed by mcimadamore (Committer).
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 :-)
-------------
PR: https://git.openjdk.java.net/valhalla/pull/651
More information about the valhalla-dev
mailing list