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.