author | vasya |
Mon, 14 Dec 2015 20:18:19 +0100 | |
changeset 34752 | 9c262a013456 |
parent 27841 | eb2cbcdc86bb |
child 37633 | d16d6d59446d |
permissions | -rw-r--r-- |
27841
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
1 |
/** |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
2 |
* @test |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
3 |
* @bug 8062747 |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
4 |
* @summary Avoiding an error for lambdas with thrown types inference inside an anonymous class. |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
5 |
* @compile T8062747.java |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
6 |
*/ |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
7 |
public class T8062747 { |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
8 |
|
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
9 |
public interface Throwing<Y extends Exception> { |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
10 |
void canThrow() throws Y; |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
11 |
} |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
12 |
|
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
13 |
public static <Y extends Exception> void wrap(Throwing<Y> action) { |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
14 |
} |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
15 |
|
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
16 |
public static void invoke(String a) { |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
17 |
Runnable r = new Runnable() { |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
18 |
@Override |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
19 |
public void run() { |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
20 |
wrap(() -> System.out.println(a)); |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
21 |
} |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
22 |
}; |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
23 |
} |
eb2cbcdc86bb
8062747: Compiler error when anonymous class uses method with parametrized exception
jlahoda
parents:
diff
changeset
|
24 |
} |