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
32
test/langtools/tools/javac/lambda/MethodReference60.java
Normal file
32
test/langtools/tools/javac/lambda/MethodReference60.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8004102
|
||||
* @summary Add support for array constructor references
|
||||
* @compile/fail/ref=MethodReference60.out -XDrawDiagnostics MethodReference60.java
|
||||
*/
|
||||
public class MethodReference60 {
|
||||
|
||||
interface ArrayFactory<X> {
|
||||
X make(int size);
|
||||
}
|
||||
|
||||
interface BadArrayFactory1<X> {
|
||||
X make();
|
||||
}
|
||||
|
||||
interface BadArrayFactory2<X> {
|
||||
X make(int i1, int i2);
|
||||
}
|
||||
|
||||
interface BadArrayFactory3<X> {
|
||||
X make(String s);
|
||||
}
|
||||
|
||||
public static void meth() {
|
||||
BadArrayFactory1<int[]> factory1 = int[]::new; //param mismatch
|
||||
BadArrayFactory2<int[]> factory2 = int[]::new; //param mismatch
|
||||
BadArrayFactory3<int[]> factory3 = int[]::new; //param mismatch
|
||||
ArrayFactory<Integer> factory4 = int[]::new; //return type mismatch
|
||||
ArrayFactory<Integer[]> factory5 = int[]::new; //return type mismatch
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue