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

18.4: Ignore 'Serializable' upper bound for 'throws' ivars

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 8
    • specification

    Description

      Resolution of inference variables, 18.4, gives special treatment to variables appearing in 'throws' clauses that don't have "extra" bounds. Specifically:

      "Otherwise, if the bound set contains throws αi, and the proper upper bounds of αi are, at most, Exception, Throwable, and Object, then Ti = RuntimeException."

      The idea here is that RuntimeException satisfies any of these upper bounds, and is also less intrusive, since it isn't a checked exception type.

      The type Serializable is also a supertype of RuntimeException, and there's no particular reason such a bound couldn't also be ignored. Proposed new rule:

      "Otherwise, if the bound set contains throws αi, and ***each*** proper upper ***bound*** of αi ***is a supertype of RuntimeException***, then Ti = RuntimeException."

      This rule is also more future-proof -- if, say, a new interface is added as a supertype of Throwable; and it supports intersection types and type variables as upper bounds, should that situation arise.

      Attachments

        Issue Links

          Activity

            People

              abuckley Alex Buckley
              dlsmith Dan Smith
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: