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