Bug 141704 - [1.5][compiler] Eclipse 3.2RC4 Doesn't recognize implemented method by abstract class (while 3.1.2 works just fine).
Summary: [1.5][compiler] Eclipse 3.2RC4 Doesn't recognize implemented method by abstra...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.2 RC5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-14 21:19 EDT by Agustin Barto CLA
Modified: 2006-05-19 11:10 EDT (History)
4 users (show)

See Also:


Attachments
Patch (1.05 KB, patch)
2006-05-15 12:19 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 Agustin Barto CLA 2006-05-14 21:19:46 EDT
I have a rather unusual class hierarchy somewhat represented by the interface and two classes from below. Eclipse 3.2RC4 reports an error, while 3.1.2 doesn't, and the code compiles and works just fine.

========== AnInterface.java

package bug_report;

public interface AnInterface {
	void aMethod(Object anObject, String aString, Object... args);
	void aMethod(Object anObject, Object... args);
}

========== AnAbstractClass.java

package bug_report;

public abstract class AnAbstractClass implements AnInterface {
	public void aMethod(Object anObject, Object... args) {
		System.out.println("AnAbstractClass.aMethod(...)");		
	}

	public void aMethod(Object anObject, String aString, Object... args) {
		System.out.println("AnAbstractClass.aMethod(...)");
	}
}

========== AnAbstractClass.java

package bug_report;

public class ASubClass extends AnAbstractClass {
	@Override
	public void aMethod(Object anObject, String aString, Object... args) {
//
// Eclipse 3.2RC4 Reports: Cannot directly invoke the abstract method aMethod(Object, String, Object...) for the type AnInterface
//
		super.aMethod(anObject, aString, this, args);
	}

	@Override
	public void aMethod(Object anObject, Object... args) {
		super.aMethod(anObject, args);
	}
}
Comment 1 Olivier Thomann CLA 2006-05-15 10:42:38 EDT
Reproduced with RC4.
Works fine with either JDK1.5.0_07 or JDK60b82.
Comment 2 Philipe Mulet CLA 2006-05-15 11:26:44 EDT
Given it is a regression, we may consider for 3.2RC5 if we have a good fix. This remains a corner situation, and could rather qualify for 3.2.1.
Comment 3 Kent Johnson CLA 2006-05-15 12:19:02 EDT
Created attachment 41463 [details]
Patch

Only need to choose the interface method if its a better match than the concrete method. This is the second case in findMethod() when we're faced with the same issue.
Comment 4 Philipe Mulet CLA 2006-05-15 12:48:27 EDT
+1 for 3.2RC5. Current behavior is a regression over 3.1, introduced in 3.2RC2.
Fix looks good, one omission of a code pattern.

Martin - pls cast your vote
Comment 5 Philipe Mulet CLA 2006-05-16 05:00:38 EDT
Dani - pls cast your vote.
Comment 6 Dani Megert CLA 2006-05-16 06:49:16 EDT
Looked at the patch and talked to Philippe about the potential risk.
Approving for 3.2 RC5 since it is a regression and rejects valid code.
Comment 7 Philipe Mulet CLA 2006-05-16 06:58:30 EDT
Re: comment 6

1) Is this really a critical stop ship defect?
It is a recent regression we introduced by mistake, and we have a good/simple fix for it (broken since RC2). We reject valid code. It was discovered in about 2 weeks...

2) What is the potential risk for existing (3.2) clients that now use/rely on
Since we reject valid code, there is no impact on existing clients which are broken if they see it.
Comment 8 Philipe Mulet CLA 2006-05-16 09:05:08 EDT
Mike - pls cast your vote
Comment 9 Mike Wilson CLA 2006-05-16 09:21:56 EDT
I don't have enough context to be able to verify the code, but it seems like something that would be good to fix. +1
Comment 10 Kent Johnson CLA 2006-05-16 10:12:07 EDT
Added VarargsTest #49 and released into HEAD for RC5
Comment 11 Philipe Mulet CLA 2006-05-16 10:21:21 EDT
Darin - would you vote for this bug ? (cannot find Martin any longer)
Comment 12 Martin Aeschlimann CLA 2006-05-16 10:37:05 EDT
+1 for 3.2RC5
Comment 13 Darin Wright CLA 2006-05-16 10:45:17 EDT
+1
Comment 14 Olivier Thomann CLA 2006-05-19 11:10:22 EDT
Verified with I20060519-0010 for 3.2RC5