Files
openide/java/java-impl/resources/inspectionDescriptions/JavaLangInvokeHandleSignature.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

32 lines
1.1 KiB
HTML

<html>
<body>
Reports <code>MethodHandle</code> and <code>VarHandle</code> factory method calls that don't match any method or field.
<p>Also reports arguments to <code>MethodHandle.invoke()</code> and similar methods, that don't match the <code>MethodHandle</code> signature
and arguments to <code>VarHandle.set()</code> that don't match the <code>VarHandle</code> type.
<!-- tooltip end -->
<p>Examples:</p>
<pre>
MethodHandle mh = MethodHandles.lookup().findVirtual(
MyClass.class, "foo", MethodType.methodType(void.class, int.class));
<i>// the argument should be an <b>int</b> value</i>
mh.invoke(myObj, "<b>abc</b>");
</pre>
<br>
<pre>
<i>// the argument should be <b>String</b>.class</i>
VarHandle vh = MethodHandles.lookup().findVarHandle(
MyClass.class, "text", <b>int</b>.class);
</pre>
<br>
<pre>
VarHandle vh = MethodHandles.lookup().findVarHandle(
MyClass.class, "text", String.class);
<i>// the argument should be a <b>String</b> value</i>
vh.set(myObj, <b>42</b>);
</pre>
<p>
<small>New in 2017.2</small>
</p>
</body>
</html>