Potential Compiler Bug

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Nov 24 15:15:46 PST 2011


Hi Richard,
thanks for the report - this bug has been recently fixed in the lambda 
repository [1]. Unfortunately the fix has still not made its way to the 
lambda binaries - but it will soon ;-)

Thanks
Maurizio

[1] - 
http://mail.openjdk.java.net/pipermail/lambda-dev/2011-November/004252.html


On 24/11/11 22:35, Richard Warburton wrote:
> class BoxingBug {
>
>       static interface Function<R,A>  {
>           public R apply(A a);
>       }
>
>       public static int incUnboxed(int x) {
>           return x + 1;
>       }
>
>       public static Integer incBoxed(Integer x) {
>           return x + 1;
>       }
>
>       public static void main(String [] args) {
>           // Use of method references
>           useFunc(BoxingBug#incBoxed);
>           // If you comment out this line it compiles without error
>           useFunc(BoxingBug#incUnboxed);
>       }
>
>       public static void useFunc(Function<Integer,Integer>  f) {
>           System.out.println(f.apply(1));
>       }
>
> }
>



More information about the lambda-dev mailing list