mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
32 lines
1.1 KiB
HTML
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> |