mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
Java: Filter by 'static' modifier in MethodHandle/VarHandle completion assistance (IDEA-167319, IDEA-CR-19610)
This commit is contained in:
@@ -3,6 +3,6 @@ import java.lang.invoke.*;
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStatic(Types.class, "sObjMethod", <caret>);
|
||||
lookup.findStatic(Types.class, "objMethod", <caret>);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,6 @@ import java.lang.invoke.*;
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStatic(Types.class, "sObjMethod", MethodType.methodType(Object.class, Object.class));
|
||||
lookup.findStatic(Types.class, "objMethod", MethodType.methodType(Object.class, Object.class));
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@ class Main {
|
||||
l.findStaticGetter(Test.class, "ourInt", <warning descr="The type of field 'ourInt' is 'int'">void.class</warning>);
|
||||
l.findStaticGetter(Test.class, "ourInts", <warning descr="The type of field 'ourInts' is 'int[]'">int.class</warning>);
|
||||
l.findStaticGetter(Test.class, "ourString", <warning descr="The type of field 'ourString' is 'java.lang.String'">List.class</warning>);
|
||||
|
||||
l.<warning descr="Field 'ourString' is static">findGetter</warning>(Test.class, "ourString", String.class);
|
||||
l.<warning descr="Field 'myString' is not static">findStaticGetter</warning>(Test.class, "myString", String.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Main {
|
||||
l.findVirtual(Test.class, "method", <warning descr="Cannot resolve method 'Object[] method(Object[])'">MethodType.methodType(Object[].class, Object[].class)</warning>);
|
||||
l.findVirtual(Test.class, "method", <warning descr="Cannot resolve method 'Object[][] method(Object[][])'">MethodType.methodType(Object[][].class, Object[][].class)</warning>);
|
||||
|
||||
l.<warning descr="Method 'method' is static">findStatic</warning>(Test.class, "method", MethodType.methodType(void.class));
|
||||
l.<warning descr="Method 'method' is not static">findStatic</warning>(Test.class, "method", MethodType.methodType(void.class));
|
||||
l.findVirtual(Test.class, <warning descr="Cannot resolve method 'doesntExist'">"doesntExist"</warning>, MethodType.methodType(void.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class Main {
|
||||
l.findStaticSetter(Test.class, "ourInt", <warning descr="The type of field 'ourInt' is 'int'">void.class</warning>);
|
||||
l.findStaticSetter(Test.class, "ourInts", <warning descr="The type of field 'ourInts' is 'int[]'">int.class</warning>);
|
||||
l.findStaticSetter(Test.class, "ourString", <warning descr="The type of field 'ourString' is 'java.lang.String'">List.class</warning>);
|
||||
|
||||
l.<warning descr="Field 'myString' is not static">findStaticSetter</warning>(Test.class, "myString", String.class);
|
||||
l.<warning descr="Field 'ourString' is static">findSetter</warning>(Test.class, "ourString", String.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class Main {
|
||||
l.findStatic(Test.class, "method2", <warning descr="Cannot resolve method 'int method2(String)'">MethodType.methodType(int.class, String.class)</warning>);
|
||||
l.findStatic(Test.class, "method3", <warning descr="Cannot resolve method 'String method3()'">MethodType.methodType(String.class)</warning>);
|
||||
|
||||
l.<warning descr="Method 'method1' is not static">findVirtual</warning>(Test.class, "method1", MethodType.methodType(void.class));
|
||||
l.<warning descr="Method 'method1' is static">findVirtual</warning>(Test.class, "method1", MethodType.methodType(void.class));
|
||||
l.findStatic(Test.class, <warning descr="Cannot resolve method 'doesntExist'">"doesntExist"</warning>, MethodType.methodType(String.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class Main {
|
||||
l.findStaticVarHandle(Test.class, "ourInt", <warning descr="The type of field 'ourInt' is 'int'">void.class</warning>);
|
||||
l.findStaticVarHandle(Test.class, "ourInts", <warning descr="The type of field 'ourInts' is 'int[]'">int.class</warning>);
|
||||
l.findStaticVarHandle(Test.class, "ourString", <warning descr="The type of field 'ourString' is 'java.lang.String'">List.class</warning>);
|
||||
|
||||
l.<warning descr="Field 'myString' is not static">findStaticVarHandle</warning>(Test.class, "myString", String.class);
|
||||
l.<warning descr="Field 'ourString' is static">findVarHandle</warning>(Test.class, "ourString", String.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user