Bug 196576 - method verification does not permit return-type-substitutability
Summary: method verification does not permit return-type-substitutability
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-15 12:50 EDT by Russell Zahniser CLA
Modified: 2007-08-03 11:42 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Russell Zahniser CLA 2007-07-15 12:50:47 EDT
Build ID: I20070621-1340

Steps To Reproduce:
Attempt to compile:

public class EclipseInterfaceError {
	public static class A {
		public A method() {
			return this;
		}
	}
	
	public static class B extends A {
		public B method() {
			return this;
		}
	}
	
	public static interface Interface {
		public Interface getInterface();
		public A getA();
	}
	
	public static class Implementor implements Interface {
		public Implementor getInterface() {
			return this;
		}
		
		public B getA() {
			return new B();
		}
	}
}

This compiles fine with javac but fails in eclipse.

More information:
Here's the details on this situation in the JLS:

http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.5
Comment 1 Olivier Thomann CLA 2007-07-15 23:27:35 EDT
What are your compiler settings?
You set the compiler preferences to 5.0.
Comment 2 Kent Johnson CLA 2007-07-16 15:53:34 EDT
This compiles fine if the compiler's compliance level is set to 5.0
Comment 3 Frederic Fusier CLA 2007-08-03 11:42:02 EDT
It looks more as an invalid bug than a worksforme...
Comment 4 Frederic Fusier CLA 2007-08-03 11:42:30 EDT
Verified for 3.4M1 using build I20070802-0800.