JDK-6938489 : The problem with the multiple bounds for the generic type
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2010-03-26
  • Updated: 2011-01-19
  • Resolved: 2010-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Description
Javac allows to inherit a method with one signature from the superclass and a super interface at the same time. 
It is also not a problem if this method is protected in the class and is certainly public in the interface - you just have to override it as public in the subclass.

But for some unclear reasons using the described class and the interface 
as the multiple bounds for a generic type doesn't work.

Here it the minimal test case:

class MyClass {
    protected void foo() {
    }
}

interface MyInterface {
    public void foo();
}

// MixedClass compiles fine
class MixedClass extends MyClass implements MyInterface {
    public void foo() {
        super.foo();
    }
}

// this doesn't compile wit the message
// foo() in MyClass cannot implement foo() in MyInterface
// which isn't correct, because it perfectly can do it in the subclass
public class GenericProblem<T extends MyClass & MyInterface> {

}

This problem is reproducible with the latest JDK 7