2020-10-05 17:15:31 +00:00
|
|
|
/**
|
2020-12-30 17:20:54 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2020-10-05 17:15:31 +00:00
|
|
|
* @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);
|
|
|
|
}
|
|
|
|
|
2023-01-17 04:43:40 +00:00
|
|
|
public static void meth() {
|
2020-10-05 17:15:31 +00:00
|
|
|
VarHandle vh = MethodHandles.arrayElementVarHandle(int[].class);
|
|
|
|
|
|
|
|
// Return type of Setter::apply does not match return type of VarHandle::set
|
|
|
|
Setter f = vh::set;
|
|
|
|
}
|
|
|
|
}
|