Bug 239758 - [1.5][compiler] Generic interface inheritance and overriding error
Summary: [1.5][compiler] Generic interface inheritance and overriding error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows Server 2003
: P3 major with 1 vote (vote)
Target Milestone: 3.4.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-07 02:57 EDT by Yue Ni CLA
Modified: 2009-05-07 03:32 EDT (History)
4 users (show)

See Also:


Attachments
Java source files for this issue (1.85 KB, application/zip)
2008-07-07 02:57 EDT, Yue Ni CLA
no flags Details
Patch for 3.4.x (10.17 KB, patch)
2008-07-07 07:35 EDT, Philipe Mulet CLA
no flags Details | Diff
Proposed patch (4.91 KB, patch)
2008-07-07 07:44 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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