-
Bug
-
Resolution: Unresolved
-
P4
-
8
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.
- 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.
- relates to
-
JDK-7018313 5.1.9: Unchecked conversion during assignment/method invocation is too lax
- Open
-
JDK-8167318 Eliminate redundant Types.returnTypeSubstitutable method
- Open
-
JDK-8207224 Javac compiles source code despite illegal use of unchecked conversions
- Resolved