Back to Intellij Community

JavaLangInvokeHandleSignature

java/java-impl/resources/inspectionDescriptions/JavaLangInvokeHandleSignature.html

2025.3-rc-2852 B
Original Source

Reports MethodHandle and VarHandle factory method calls that don't match any method or field.

Also reports arguments to MethodHandle.invoke() and similar methods, that don't match the MethodHandle signature and arguments to VarHandle.set() that don't match the VarHandle type.

Examples:

MethodHandle mh = MethodHandles.lookup().findVirtual(
      MyClass.class, "foo", MethodType.methodType(void.class, int.class));_// the argument should be an **int** value_mh.invoke(myObj, " **abc**");
_// the argument should be **String**.class_VarHandle vh = MethodHandles.lookup().findVarHandle(
      MyClass.class, "text", **int**.class);
VarHandle vh = MethodHandles.lookup().findVarHandle(
      MyClass.class, "text", String.class);_// the argument should be a **String** value_vh.set(myObj, **42** );

New in 2017.2