Bug 239758

Summary: [1.5][compiler] Generic interface inheritance and overriding error
Product: [Eclipse Project] JDT Reporter: Yue Ni <ni2yue4>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jerome_lanneluc, kent_johnson, Olivier_Thomann, philippe_mulet
Version: 3.5   
Target Milestone: 3.4.1   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard:
Attachments:
Description Flags
Java source files for this issue
none
Patch for 3.4.x
none
Proposed patch none

Description Yue Ni CLA 2008-07-07 02:57:10 EDT
Created attachment 106686 [details]
Java source files for this issue

Build ID: I20080617-2000

Steps To Reproduce:
1.Create an interface named IServiceAction like below:
package com.example.test;
public interface IServiceAction<Response, Request, Fault extends Exception>
{
    Response execute(Request parameter) throws Fault;
}
2. Create an interface named IServiceOperation like below:
package com.example.test;
public interface IServiceOperation<Response, Request, Fault extends Exception>
	extends IServiceAction<Response, Request, Fault>
{
    Response execute(Request parameter) throws Fault;
}
3.Create a class named MyServiceAction like below:
package com.example.test;
import java.io.IOException;
public class MyServiceAction
{
    public String execute(String parameter) throws IOException
    {
        return serviceOperation.execute(parameter);
    }
    private final IServiceOperation<String, String, IOException> serviceOperation = null;
}
These three classes should be able to be compiled, but in JEE version of Eclipse 3.4, MyServiceAction class failed to be compiled. and the error message is "Unhandled exception type Fault". 

More information:
I have tried to compile them in Eclipse 3.3 and IntelliJ IDEA 7.0.3, and both of them compile these classes without any error.
Comment 1 Philipe Mulet CLA 2008-07-07 06:01:27 EDT
Reproduced with simple testcase:

import java.io.IOException;

interface IServiceAction<Response, Request, Fault extends Exception> {
    Response execute(Request parameter) throws Fault;
}

interface IServiceOperation<Response, Request, Fault extends Exception> extends IServiceAction<Response, Request, Fault> {
    Response execute(Request parameter) throws Fault;
}

public class MyServiceAction
{
    public String execute(String parameter) throws IOException
    {
        return serviceOperation.execute(parameter);
    }
    private final IServiceOperation<String, String, IOException> serviceOperation = null;
}
Comment 2 Philipe Mulet CLA 2008-07-07 06:03:12 EDT
Removing any of the super methods (execute(...)) does make the problem go away.
Comment 3 Philipe Mulet CLA 2008-07-07 06:10:56 EDT
Removing any of the super methods (execute(...)) does make the problem go away.
Problem got introduced during 3.4M7
Comment 4 Philipe Mulet CLA 2008-07-07 06:49:53 EDT
This is another consequence from fix for bug 79798. It was merging exceptions from original methods, instead of substituted parameterized ones; thus surfacing Fault in place of substitute IOException.
Comment 5 Philipe Mulet CLA 2008-07-07 07:35:52 EDT
Created attachment 106709 [details]
Patch for 3.4.x
Comment 6 Philipe Mulet CLA 2008-07-07 07:40:00 EDT
Need to backport to 3.3.x as well, since fix for 79798 made it there as well.
To be released for 3.5M1 too.
Comment 7 Philipe Mulet CLA 2008-07-07 07:44:43 EDT
Created attachment 106710 [details]
Proposed patch

for HEAD
Comment 8 Philipe Mulet CLA 2008-07-07 09:11:05 EDT
Released for 3.5M1.
Added GenericTypeTest#test1366
Comment 9 Philipe Mulet CLA 2008-07-07 09:19:18 EDT
Released for 3.4.1
Comment 10 Philipe Mulet CLA 2008-07-07 09:38:56 EDT
Released in 3.3.x maintenance branch (post 3.3.2).
Fixed
Comment 11 Olivier Thomann CLA 2008-08-06 14:34:27 EDT
Verified for 3.5M1 using I20080805-1307
Comment 12 Jerome Lanneluc CLA 2008-08-28 12:45:53 EDT
Verified for 3.4.1 using M20080827-2000