Possible compiler bug? Code compiles on 8 but not 11

Alex Buckley alex.buckley at oracle.com
Fri Jan 31 18:58:39 UTC 2020


Hi David,

This is a question of whether javac is conforming to the JLS, and if so, 
whether the JLS is correct. It's best in such cases to quote the 
smallest possible code sample in inline text. Oracle's javac team is not 
looking to reproduce issues in the manner of a support organization, but 
rather to understand as precisely as possible what's going on in the 
type system.

Alex

On 1/31/2020 10:36 AM, David Grieve wrote:
> I have some code that compiles on 8 but not on 11. With 11 (11.0.5, to be exact), the compiler gives an error:
> 
>> Factory.java
>> Error:(9, 25) java: incompatible types: java.lang.Object cannot be converted to Manager<java.lang.String>
> 
> This can be fixed with an explicit cast. But it seems to me that the cast should not be needed.
> 
> I'm hoping to get an answer for why this compiles cleanly on 8, but not 11.
> 
> I have uploaded a small sample that reproduces to http://cr.openjdk.java.net/~dgrieve/javac-bug.zip
> 


More information about the compiler-dev mailing list