mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
Java: Improved completion for arguments of getField() and getMethod() - extract the type information from forName() and getClass() to provide code assistance (IDEA-167250)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
class Main {
|
||||
final Parent test = new Test();
|
||||
void foo() {
|
||||
test.getClass().getField("<caret>");
|
||||
}
|
||||
}
|
||||
|
||||
class Test extends Parent {
|
||||
public int num;
|
||||
int num2;
|
||||
}
|
||||
|
||||
class Parent {
|
||||
public int num3;
|
||||
int num4;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Main {
|
||||
final Parent test = new Test();
|
||||
void foo() {
|
||||
test.getClass().getField("num2");
|
||||
}
|
||||
}
|
||||
|
||||
class Test extends Parent {
|
||||
public int num;
|
||||
int num2;
|
||||
}
|
||||
|
||||
class Parent {
|
||||
public int num3;
|
||||
int num4;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Main {
|
||||
final Class<?> clazz = Test.class;
|
||||
void foo() {
|
||||
clazz.getMethod("<caret>");
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public void method(){}
|
||||
void method2(int n){}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Main {
|
||||
final Class<?> clazz = Test.class;
|
||||
void foo() {
|
||||
clazz.getMethod("method");
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public void method(){}
|
||||
void method2(int n){}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class Main {
|
||||
void foo() {
|
||||
Class<?> d = d();
|
||||
d = d();
|
||||
int i = 0;
|
||||
(d).getDeclaredMethod("<caret>");
|
||||
}
|
||||
Class<Test> d() {
|
||||
return Test.class;
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int method() {}
|
||||
int method2(int n) {}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Main {
|
||||
void foo() {
|
||||
Class<?> d = d();
|
||||
d = d();
|
||||
int i = 0;
|
||||
(d).getDeclaredMethod("method2", int.class);
|
||||
}
|
||||
Class<Test> d() {
|
||||
return Test.class;
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int method() {}
|
||||
int method2(int n) {}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Main {
|
||||
void foo() {
|
||||
bar().getClass().getField("<caret>");
|
||||
}
|
||||
Test bar() { return null; }
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int num;
|
||||
public int num2;
|
||||
int num3;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Main {
|
||||
void foo() {
|
||||
bar().getClass().getField("num2");
|
||||
}
|
||||
Test bar() { return null; }
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int num;
|
||||
public int num2;
|
||||
int num3;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Main {
|
||||
Test test;
|
||||
void foo() {
|
||||
test.getClass().getField("<caret>");
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int num;
|
||||
public int num2;
|
||||
int num3;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Main {
|
||||
Test test;
|
||||
void foo() {
|
||||
test.getClass().getField("num2");
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public int num;
|
||||
public int num2;
|
||||
int num3;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Main {
|
||||
void foo() throws NoSuchMethodException {
|
||||
clazz().getMethod("<caret>");
|
||||
}
|
||||
private Class<? extends Test> clazz() {return Test.class;}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public void method(){}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Main {
|
||||
void foo() throws NoSuchMethodException {
|
||||
clazz().getMethod("method");
|
||||
}
|
||||
private Class<? extends Test> clazz() {return Test.class;}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public void method(){}
|
||||
}
|
||||
Reference in New Issue
Block a user