装箱+瓦尔格人优先于装箱+野兽 [英] Boxing+Varargs is preferred over Boxing+Widening

查看:47
本文介绍了装箱+瓦尔格人优先于装箱+野兽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我错了,请纠正我. 是Boxing + Varargs优先于Boxing + Widening吗?

Please correct me if I'm wrong. Is Boxing+Varargs is preferred over Boxing+Widening?

我在网站中找到相反.

推荐答案

第一阶段(第15.12.2.2节)执行重载解析,不允许装箱或拆箱转换,也不允许使用可变arity方法调用.如果在此阶段未找到适用的方法,则处理将继续进行到第二阶段.

The first phase (§15.12.2.2) performs overload resolution without permitting boxing or unboxing conversion, or the use of variable arity method invocation. If no applicable method is found during this phase then processing continues to the second phase.

第二阶段(第15.12.2.3节)在允许装箱和拆箱的同时执行重载解析,但仍排除使用可变arity方法调用.如果在此阶段未找到适用的方法,则处理将继续进行到第三阶段.

The second phase (§15.12.2.3) performs overload resolution while allowing boxing and unboxing, but still precludes the use of variable arity method invocation. If no applicable method is found during this phase then processing continues to the third phase.

第三阶段(第15.12.2.4节)允许将重载与可变arity方法,装箱和拆箱相结合.

The third phase (§15.12.2.4) allows overloading to be combined with variable arity methods, boxing, and unboxing.

因此,总而言之:扩展>装箱和拆箱>可变参数

So in summary: widening > boxing&unboxing > varargs

这篇关于装箱+瓦尔格人优先于装箱+野兽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆