JDK-8029002 : javac should take multiple upper bounds into account in incorporation
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-11-22
  • Updated: 2014-07-29
  • Resolved: 2014-04-18
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 8 JDK 9
8u20 b13Fixed 9Fixed
Related Reports
Relates :  
Relates :  
Description
This code:

interface Task<E extends Exception> {}
class Comparator<T> {}
class CustomException extends Exception {}

class TaskQueue<E extends Exception, T extends Task<E>> {}

abstract class Test {
    abstract <E extends Exception, T extends Task<E>> TaskQueue<E, T> create(Comparator<? super T> comparator);

    void f(Comparator<Task<CustomException>> comp) {
        TaskQueue<CustomException, Task<CustomException>> queue = create(comp);
    }
}

compiles in 6 and 7 but fails to compile in 8.

Reported on lambda-dev: http://mail.openjdk.java.net/pipermail/lambda-dev/2013-November/011442.html
Comments
Another example: import java.util.ArrayList; import java.util.List; public class Compile { public <T, Exp extends List<T>> Exp typedNull() { return null; } public void call() { ArrayList<String> list = typedNull(); } } reported by Stephan Herrmann on lambda-spec-observers: http://mail.openjdk.java.net/pipermail/lambda-spec-observers/2013-December/000590.html
10-12-2013