Bug 153128 - [compiler] Duplicate methods generated (from invalid source, but still :-)
Summary: [compiler] Duplicate methods generated (from invalid source, but still :-)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.3 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-08 13:31 EDT by Erling Ellingsen CLA
Modified: 2007-07-29 09:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erling Ellingsen CLA 2006-08-08 13:31:16 EDT
Tested on 3.2.0 M20060629-1905

<code>
public class Shared {
	interface Moosh { void foo(); }
	
	static abstract class A implements Moosh {}
	
	static class X extends A {}
	static class Y extends A {}
	static class Z extends A {}
	public static void main(String[] args) {
		new X();  // throws ClassFormatError
	}
}
</code>

The class X ends up having 3 copies of the auto-generated error-throwing method:

static class SharedError$X extends SharedError$A
{

    public void foo()
    {
        throw new Error("Unresolved compilation problem: \n\tThe type SharedError.Z must implement the inherited abstract method SharedError.Moosh.foo()\n");
    }

    public void foo()
    {
        throw new Error("Unresolved compilation problem: \n\tThe type SharedError.Y must implement the inherited abstract method SharedError.Moosh.foo()\n");
    }

    public void foo()
    {
        throw new Error("Unresolved compilation problem: \n\tThe type SharedError.X must implement the inherited abstract method SharedError.Moosh.foo()\n");
    }
}
Comment 1 Frederic Fusier CLA 2006-08-09 07:53:54 EDT
Reproduced in R3_2_maintenance and HEAD stream
Comment 2 Olivier Thomann CLA 2006-08-14 21:38:53 EDT
This problem should be located in the generation of problem type and problem method.
I'll investigate.
Comment 3 Olivier Thomann CLA 2006-09-05 14:49:12 EDT
When adding the problem methods for missing abstract methods, the problems were not filter to match the corresponding type declaration.
This is why we ended up with 3 methods foo.
Comment 4 Olivier Thomann CLA 2006-09-05 22:01:52 EDT
Fixed and released in HEAD.
Released for 3.3M2.
Added regression test org.eclipse.jdt.core.tests.compiler.regression.ProblemTypeAndMethodTest#test001
Comment 5 Maxime Daniel CLA 2006-09-19 01:11:17 EDT
Verified for 3.3 M2 using build I20060918-0010.
Comment 6 Eclipse Webmaster CLA 2007-07-29 09:20:41 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991