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
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @summary test for VarHandle signature polymorphic methods with wrong return type
|
||||
* @compile/fail/ref=MethodReferenceTestVarHandle_neg.out -XDrawDiagnostics MethodReferenceTestVarHandle_neg.java
|
||||
*/
|
||||
|
||||
import java.lang.invoke.*;
|
||||
import java.util.*;
|
||||
|
||||
public class MethodReferenceTestVarHandle_neg {
|
||||
|
||||
interface Setter {
|
||||
int apply(int[] arr, int idx, int val);
|
||||
}
|
||||
|
||||
public static void meth() {
|
||||
VarHandle vh = MethodHandles.arrayElementVarHandle(int[].class);
|
||||
|
||||
// Return type of Setter::apply does not match return type of VarHandle::set
|
||||
Setter f = vh::set;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue