Mon, 03 Nov 2014 16:03:37 -0800
8057800: Method reference with generic type creates NPE when compiling
Reviewed-by: mcimadamore
vromero@2601 | 1 | /* |
vromero@2601 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
vromero@2601 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
vromero@2601 | 4 | * |
vromero@2601 | 5 | * This code is free software; you can redistribute it and/or modify it |
vromero@2601 | 6 | * under the terms of the GNU General Public License version 2 only, as |
vromero@2601 | 7 | * published by the Free Software Foundation. Oracle designates this |
vromero@2601 | 8 | * particular file as subject to the "Classpath" exception as provided |
vromero@2601 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
vromero@2601 | 10 | * |
vromero@2601 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
vromero@2601 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
vromero@2601 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
vromero@2601 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
vromero@2601 | 15 | * accompanied this code). |
vromero@2601 | 16 | * |
vromero@2601 | 17 | * You should have received a copy of the GNU General Public License version |
vromero@2601 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
vromero@2601 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
vromero@2601 | 20 | * |
vromero@2601 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
vromero@2601 | 22 | * or visit www.oracle.com if you need additional information or have any |
vromero@2601 | 23 | * questions. |
vromero@2601 | 24 | */ |
vromero@2601 | 25 | |
vromero@2601 | 26 | /** |
vromero@2601 | 27 | * @test |
vromero@2601 | 28 | * @bug 8057800 |
vromero@2601 | 29 | * @summary Method reference with generic type creates NPE when compiling |
vromero@2601 | 30 | * @compile NPEMethodReferenceAndGenericsTest.java |
vromero@2601 | 31 | */ |
vromero@2601 | 32 | |
vromero@2601 | 33 | public class NPEMethodReferenceAndGenericsTest { |
vromero@2601 | 34 | public <T> void foo(java.util.Comparator<? super T> comparator) {} |
vromero@2601 | 35 | |
vromero@2601 | 36 | public <C extends Comparable<? super C>> void foo() { |
vromero@2601 | 37 | foo(C::compareTo); |
vromero@2601 | 38 | } |
vromero@2601 | 39 | } |