Summary: | [1.6][compiler] Generic method override bug, Eclipse compiles code ok but Sun javac fails with error | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Tobias Gierke <tobias.gierke> | ||||
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||
Status: | VERIFIED WORKSFORME | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | jarthana, Olivier_Thomann, tobias.gierke | ||||
Version: | 3.6 | ||||||
Target Milestone: | 3.6 RC1 | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Tobias Gierke
2010-05-10 11:34:31 EDT
Created attachment 167732 [details]
Demonstrates the bug
Sorry, forgot the javac output:
> javac -d target src/*.java
src/SubClass.java:6: getStuff() in SubClass cannot implement getStuff() in SomeInterface; attempting to use incompatible return type
found : java.util.Vector<? extends java.lang.String>
required: java.util.Vector<java.lang.String>
public Vector<? extends String> getStuff() {
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Using HEAD contents in 1.6 mode I get: [compiled 24 lines in 562 ms: 42.7 lines/s] [2 .class files generated] ---------- 1. ERROR in D:\tests_sources\SubClass.java (at line 6) public Vector<? extends String> getStuff() { ^^^^^^^^^^^^^^^^^^^^^^^^ The return type is incompatible with SomeInterface.getStuff() ---------- 1 problem (1 error) which seems to be consistent with javac. Srikanth, could you please double-check this case? Thanks. Tobias, please use a newer version of the compiler. > Tobias, please use a newer version of the compiler.
Since I'm already using the latest Eclipse version, do you want me to try the compiler from HEAD ? Is there an update site where I can get the binaries or do I need to compile it myself ?
Using 3.6M7 should be good enough. Stupid me, didn't think of the milestone releases :) The code does not compile with Eclipse 3.6M7 and the error message is correct. Thanks for your quick response ! While this is not a duplicate of bug# 302358 the fix for that bug also addresses this issue and hence the behavior 3.6 M6+ is correct and matches javac. Verified for 3.6RC1 using build I20100513-1500. |