Fwd: Unable to compile code using generics under 8u20 but builds under 8u05

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Oct 14 00:46:26 UTC 2014

-------- Forwarded Message --------
Subject: 	Unable to compile code using generics under 8u20 but builds 
under 8u05
Date: 	Mon, 13 Oct 2014 13:47:31 +0100
From: 	Will May <will.j.may at gmail.com>
To: 	jdk8u-dev at openjdk.java.net

Hi all,

I've got a piece of code which will compile fine on JDK 8u05 but fails to
compile [1] on JDK 8u20; a minimal test case is at the bottom of this email.

I know that there were changes around generic wildcards in 8u20 but does
anyone know if 8u05 is bugged and it has been fixed or if 8u20 is now

For reference, the two bugs that I found were fixed around generic
wildcards were 8042338 [2] and 8042803 [3].



1 The error message is "incompatible types:
java.util.function.Consumer<capture#1 of ?> cannot be converted to
java.util.function.Consumer<? super capture#1 of ?>"
2 https://bugs.openjdk.java.net/browse/JDK-8042338
3 https://bugs.openjdk.java.net/browse/JDK-8042803

import java.util.List;
import java.util.function.Consumer;

public class Temp {

     public void doWithList(final List<?> list) {

     public static interface ExceptionThrowingConsumer<T> {
         void accept(T input) throws Exception;

     public static <T> Consumer<T> consumer(ExceptionThrowingConsumer<T>
consumer) {
         return i -> {
             try {
             } catch (Exception e) {
                 throw new RuntimeException(e);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20141013/442833f8/attachment.html>

More information about the compiler-dev mailing list