Bug 258658 - [1.5][compiler] Eclipse compiler compiles unrelated return types in interface; Sun JDK javac won't
Summary: [1.5][compiler] Eclipse compiler compiles unrelated return types in interface...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-12 09:25 EST by Peter Arrenbrecht CLA
Modified: 2009-01-27 05:17 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Arrenbrecht CLA 2008-12-12 09:25:22 EST
Build ID: M20080911-1700

Steps To Reproduce:
1.Paste the tree interfaces below.
2.See how Eclipse compiles them OK.
3.Check with javac from Sun's JDK. It returns

$ javac -d ../temp/classes ch/arrenbrecht/eclipsequirks/covariant/*.java
ch/arrenbrecht/eclipsequirks/covariant/IBoth.java:3: types ch.arrenbrecht.eclipsequirks.covariant.ITwo and ch.arrenbrecht.eclipsequirks.covariant.IOne are incompatible; both define foo(), but with unrelated return types
public interface IBoth extends IOne, ITwo
       ^
1 error

$ javac -version
javac 1.6.0_0-internal

More information:
---
package ch.arrenbrecht.eclipsequirks.covariant;

public interface IOne
{
	IOne foo();
}
---
package ch.arrenbrecht.eclipsequirks.covariant;

public interface ITwo
{
	ITwo foo();
}
---
package ch.arrenbrecht.eclipsequirks.covariant;

public interface IBoth extends IOne, ITwo
{
	IBoth foo();
}
---
Comment 1 Philipe Mulet CLA 2008-12-12 10:27:28 EST
Interestingly javac7 behaves like we do.
Kent - is this a compliance-driven behavior ? Or do we have the right behavior, and they only fixed it from 1.7 on ?
Comment 2 Philipe Mulet CLA 2008-12-12 10:30:50 EST
Feels like our behavior is correct, and Javac6 wrong since IBoth is actually a good fit for both supertype #foo method return types.
Comment 3 Peter Arrenbrecht CLA 2008-12-12 10:35:03 EST
I certainly agree that Eclipse's behaviour is better. Javac is causing me some pain with this. :(
Comment 4 Kent Johnson CLA 2008-12-12 11:28:04 EST
Closing as a javac bug

See the additional testcases in the comment section
   http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294779

I really like the last comment ;)
Comment 5 Kent Johnson CLA 2008-12-12 11:42:52 EST
To change resolved state
Comment 6 Kent Johnson CLA 2008-12-12 11:43:35 EST
Closing as invalid since its not an eclipse bug, but is a javac bug
Comment 7 David Audel CLA 2009-01-27 05:17:13 EST
Verified for 3.5M5.