|Re: Java Type mismatch error on upgrade Eclipse Mars to Eclipse Neon [message #1748408 is a reply to message #1748373]
||Tue, 22 November 2016 20:26
| Stephan Herrmann
Registered: July 2009
Marmi Thomas wrote on Tue, 22 November 2016 15:54|
- Has the Eclipse compiler change something between these 2 versions ?
Yes, in that time frame we fixed around 60 compiler bugs
Specifically, the JDT compiler rejects the program starting with 4.6M6.
I just checked your example against javac. Result: accepted by version 1.8, reject by early access builds of Java 9.
Ergo, it looks like accepting the program was a bug shared by ecj and javac. Both compilers have been fixed in this regard.
Background: with the unchecked warnings in the picture, JLS requires that the compiler basically discards any results from successful type inference, and erase any type arguments from a resolved method, hence "Collections.max(..)" really returns Object in this situation.
1. AVOID raw types (they have been legacy ever since their introduction 11 years ago)!
2. If you can't avoid raw types APPLY §1!
Powered by FUDForum
. Page generated in 0.02830 seconds