Bug 153874 - [1.5][compiler] Compiler fails to consider bridge method with -source 1.4
Summary: [1.5][compiler] Compiler fails to consider bridge method with -source 1.4
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 156447 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-15 02:35 EDT by Gernot CLA
Modified: 2007-02-08 11:55 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (2.06 KB, patch)
2006-09-05 12:45 EDT, Kent Johnson CLA
no flags Details | Diff
New proposed patch (6.04 KB, patch)
2006-09-06 12:07 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gernot CLA 2006-08-15 02:35:06 EDT
I filed a similar bug agains Eclipse 3.1.2 yesterday (Bug 153734). Then I found out it had been fixed in Eclipse 3.2, so I've upgraded to that version now.

Unfortunately, here's a related bug: the following code does not compile with "-source 1.4", although it should (and it does with Sun's javac). 
The error message is 
"The type TestCharset must implement the inherited abstract method Comparable.compareTo"
It seems as if the the compiler failed to see the bridge method "compareTo(Object)" in the abstract base class java.nio.Charset.

public class TestCharset extends Charset {

	protected TestCharset(String canonicalName, String[] aliases) {
		super(canonicalName, aliases);
	}

	public boolean contains(Charset cs) {
		return false;
	}

	public CharsetDecoder newDecoder() {
		return null;
	}

	public CharsetEncoder newEncoder() {
		return null;
	}

}
Comment 1 Philipe Mulet CLA 2006-09-05 12:44:58 EDT
Smells like something we should fix for 3.2.1. We did break this scenario during the 3.2 cycle to address a different bug. 
Comment 2 Kent Johnson CLA 2006-09-05 12:45:33 EDT
Created attachment 49411 [details]
Proposed patch
Comment 3 Kent Johnson CLA 2006-09-06 12:07:49 EDT
Created attachment 49506 [details]
New proposed patch
Comment 4 Kent Johnson CLA 2006-09-06 14:10:56 EDT
Released for 3.2.1

Released in HEAD for 3.3 M2

Added LookupTest #68a to test method dispatch when bridge methods are found
Added MethodVerifyTest #99 for the missing abstract method implementation error

Put back checks in BinaryTypeBinding that were removed to fix bug 139099 and improved method lookup in Scope when bridge methods are found.
Comment 5 Olivier Thomann CLA 2006-09-06 21:14:14 EDT
*** Bug 156447 has been marked as a duplicate of this bug. ***
Comment 6 Frederic Fusier CLA 2006-09-12 08:06:27 EDT
Verified for 3.2.1 using build M20060908-1655.
Comment 7 Frederic Fusier CLA 2006-09-18 11:54:02 EDT
Verified for 3.3 M2 using build I20060918-0010.
Comment 8 Nils Meier CLA 2007-02-08 11:55:22 EST
Version: 3.2.1
Build id: M20060921-0945

still fails in the scenario of compiling with 1.5 in the presence of a compareTo(Object) bridge