mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java: Improved inspection "MethodHandle/VarHandle type mismatch" - show candidates for replacement of method/constructor in a separate pop-up menu (IDEA-167318)
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findGetter(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findGetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findGetter(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findSetter(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findSetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findSetter(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticGetter(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findStaticGetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticGetter(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticSetter(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findStaticSetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticSetter(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticVarHandle(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findStaticVarHandle'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticVarHandle(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findVarHandle(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findVarHandle'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findVarHandle(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findGetter(Test.class, "myInt", <caret>String.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findGetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.<caret>findStaticGetter(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findSetter(Test.class, "myInt", <caret>String.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findSetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.<caret>findStaticSetter(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticGetter(Test.class, "ourInt", <caret>String.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findStaticGetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.<caret>findGetter(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticSetter(Test.class, "ourInt", <caret>String.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findStaticSetter'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.<caret>findSetter(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findStaticVarHandle(Test.class, "ourInt", <caret>boolean.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findStaticVarHandle'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.<caret>findVarHandle(Test.class, "ourInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static int ourInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Change type to 'int'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.findVarHandle(Test.class, "myInt", <caret>String.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'findVarHandle'" "true"
|
||||
import java.lang.invoke.*;
|
||||
|
||||
public class Main {
|
||||
void foo() throws Throwable {
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
lookup.<caret>findStaticVarHandle(Test.class, "myInt", int.class);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int myInt;
|
||||
}
|
||||
Reference in New Issue
Block a user