author | mcimadamore |
Tue, 12 Mar 2013 16:02:13 +0000 | |
changeset 16340 | 3c0af3413e0f |
parent 16322 | 373dfc3f05f8 |
child 19914 | d86271bd430a |
permissions | -rw-r--r-- |
16322
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
1 |
/* |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
4 |
* |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
8 |
* |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
13 |
* accompanied this code). |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
14 |
* |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
18 |
* |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
21 |
* questions. |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
22 |
*/ |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
23 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
24 |
/* |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
25 |
* @test |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
26 |
* @bug 8008813 |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
27 |
* @summary Structural most specific fails when method reference is passed to overloaded method |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
28 |
* @compile MostSpecific08.java |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
29 |
*/ |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
30 |
class MostSpecific08 { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
31 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
32 |
static class C { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
33 |
int getInt() { return -1; } |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
34 |
Integer getInteger() { return -1; } |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
35 |
} |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
36 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
37 |
interface IntResult { } |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
38 |
interface ReferenceResult<X> { } |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
39 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
40 |
interface PrimitiveFunction { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
41 |
int f(C c); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
42 |
} |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
43 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
44 |
interface ReferenceFunction<X> { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
45 |
X f(C c); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
46 |
} |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
47 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
48 |
interface Tester { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
49 |
IntResult apply(PrimitiveFunction p); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
50 |
<Z> ReferenceResult<Z> apply(ReferenceFunction<Z> p); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
51 |
} |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
52 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
53 |
void testMref(Tester t) { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
54 |
IntResult pr = t.apply(C::getInt); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
55 |
ReferenceResult<Integer> rr = t.apply(C::getInteger); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
56 |
} |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
57 |
|
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
58 |
void testLambda(Tester t) { |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
59 |
IntResult pr = t.apply(c->c.getInt()); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
60 |
ReferenceResult<Integer> rr = t.apply(c->c.getInteger()); |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
61 |
} |
373dfc3f05f8
8008813: Structural most specific fails when method reference is passed to overloaded method
mcimadamore
parents:
diff
changeset
|
62 |
} |