undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
37
test/langtools/tools/javac/lambda/LambdaExpr10.java
Normal file
37
test/langtools/tools/javac/lambda/LambdaExpr10.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280
|
||||
* @summary Add lambda tests
|
||||
* check that lambda in array initializers (with wrong type) are correctly rejected
|
||||
* @compile/fail/ref=LambdaExpr10.out -XDrawDiagnostics LambdaExpr10.java
|
||||
*/
|
||||
|
||||
class LambdaExpr10 {
|
||||
|
||||
interface Block<T> {
|
||||
void m(T t);
|
||||
}
|
||||
|
||||
void apply(Object[] obj_arr) { }
|
||||
|
||||
void test1() {
|
||||
Object[] arr1 = { t -> { } };
|
||||
Object[][] arr2 = { { t -> { } } };
|
||||
}
|
||||
|
||||
void test2() {
|
||||
Object[] arr1 = new Object[]{ t -> { } };
|
||||
Object[][] arr2 = new Object[][]{ { t -> { } } };
|
||||
}
|
||||
|
||||
void test3() {
|
||||
apply(new Object[]{ t -> { } });
|
||||
apply(new Object[][]{ { t -> { } } });
|
||||
}
|
||||
|
||||
void test4() {
|
||||
Block<?>[] arr1 = { t -> t };
|
||||
Block<?>[] arr2 = new Block<?>[]{ t -> t };
|
||||
apply(new Block<?>[]{ t -> { }, t -> { } });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue