Java 7的组合/多捕获块是否有正式名称? [英] Is there an official name for Java 7's combined / multi-catch block?

查看:86
本文介绍了Java 7的组合/多捕获块是否有正式名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处中讨论多捕获/组合捕获块时,术语多捕获块"之间存在歧义, Java 7功能:

Upon discussing the multiple-catch / combined catch block here with ambiguity between the terms "multiple catch block," meaning the Java 7 feature:

try { .. } catch (ExceptionA | ExceptionB ex) { .. }

和多个捕获块",字面意思是多个捕获块:

and "multiple catch blocks," meaning literally, multiple catch blocks:

} catch (ExceptionA exa) { ..
} catch (ExceptionB exb) { .. }

我已经研究过Java 7功能是否具有特定的正式名称,该名称可以用来将其与捕获多个异常的旧样式区分开来.但是, Oracle Eclipse SO )将其称为多捕获"块.

I've researched to see if the Java 7 feature has a specific, official name that can be used to clearly distinguish it from the older style of catching multiple exceptions. However, Oracle sources don't seem to name this feature anywhere, while some other sources (like Eclipse and SO) call it a "multi-catch" block.

在任何地方都有此功能的Oracle正式名称吗?

Is there an official, Oracle-given name for this feature anywhere?

推荐答案

The Java Language Specification section 14.20 refers to uni-catch and multi-catch clauses, which is about as official as it gets.

将异常参数表示为单个类类型的catch子句称为 uni-catch 子句.

将异常参数表示为类型并集的catch子句称为 multi-catch 子句.

A catch clause whose exception parameter is denoted as a union of types is called a multi-catch clause.

当然,在Java 7之前没有multi-catch子句,因此在引入multi-catch之前,永远不需要"uni-catch"一词.

Of course, prior to Java 7 there were no multi-catch clauses, so the term "uni-catch" was never necessary until multi-catch was introduced.

multi-catch 一词不同于具有多个(几个,多个)catch子句.

The term multi-catch is distinct from having more than one (several, multiple) catch clauses.

这篇关于Java 7的组合/多捕获块是否有正式名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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