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

8.4.5: Clean up return-type-substitutable definition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8
    • specification

      A few problems with return-type-substitutable, as defined in JLS 8:

      - It talks about adapting type parameters without first asserting that the two signatures are the same (if not, the operation is undefined)

      - It performs unchecked conversion *before* widening; javac and assignment perform it *after* widening

      - It asserts R1 == |R2|, while javac checks that R1 <: |R2|

      - Cosmetically, "does not have the same signature" is (probably?) more general than needed—we're really asserting that d1 is a proper subsignature of d2, rather than being the same.

      For the javac discrepancies, it may be that javac needs to be corrected, but we should look more closely and the motivation for the specified rules.

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: