Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7030606

Project-coin: multi-catch types should be pairwise disjoint

XMLWordPrintable

    • b138
    • unknown
    • generic
    • Verified

      As per latest JSR 334 EDR, types in a multi-catch statement should be pairwise disjoint, i.e. it is an error if for any two types Ti, Tj we have that Ti <: Tj or Tj <: Ti.

      Here's the relevant EDR text:

      "A catch clause must have exactly one parameter (which is called an exception parameter); the declared type of the exception parameter can be a single class type or can be a disjunctive type (denoted with '|') between two or more class types (or alternatives). [...] It is a compile-time error if a disjunctive type contains two alternatives Di, Dj where Di is a subtype of Dj."

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: