mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
[jvm-lang] java: port _Create property from usage_ action
- make it create template for both getter and setter; - make it work with type parameter guesser; - add tests!
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
// "Create property" "true"
|
||||
class JC {
|
||||
private boolean foo;
|
||||
|
||||
public boolean isFoo() {<caret>
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(boolean foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.isFoo();
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
// "Create property" "true"
|
||||
class Calculator {
|
||||
int i;
|
||||
|
||||
public void printError() {
|
||||
setI(0);
|
||||
setI(0);
|
||||
}
|
||||
|
||||
public void setI(int i) {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Calculator {
|
||||
private Object i;
|
||||
|
||||
{
|
||||
setI(() -> {});
|
||||
setI(() -> {});
|
||||
}
|
||||
|
||||
public void setI(Object i) {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Calculator {
|
||||
private int i;
|
||||
|
||||
public void printError() {
|
||||
setI(0);
|
||||
setI(0);
|
||||
}
|
||||
|
||||
public void setI(int i) {
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property" "true"
|
||||
class JC {}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>isFoo();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
class Calculator {
|
||||
int i;
|
||||
public void printError() {
|
||||
set<caret>I(0);
|
||||
set<caret>I(0);
|
||||
}
|
||||
public int getI() {return i;}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
class Calculator {
|
||||
int i;
|
||||
public void printError() {
|
||||
set<caret>I(0);
|
||||
set<caret>I(0);
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create property" "false"
|
||||
class JC {
|
||||
void setFoo(boolean a) {}
|
||||
}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>isFoo();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property" "false"
|
||||
class JC {}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>isFoo("1");
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create property" "false"
|
||||
class JC {
|
||||
void setFoo(int a) {}
|
||||
}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>getFoo();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property" "false"
|
||||
class JC {}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>getFoo("1");
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property" "false"
|
||||
class JC {}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>setFoo("1", "2");
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property" "false"
|
||||
class JC {}
|
||||
|
||||
class Main {
|
||||
void usage(JC jc) {
|
||||
jc.<caret>setFoo();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property" "false"
|
||||
interface I {}
|
||||
|
||||
class Main {
|
||||
void usage(I i) {
|
||||
i.<caret>setFoo("hello");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// "Create property" "true"
|
||||
class Calculator {
|
||||
{
|
||||
set<caret>I(() -> {});
|
||||
set<caret>I(() -> {});
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// "Create property" "true"
|
||||
class Calculator {
|
||||
public void printError() {
|
||||
set<caret>I(0);
|
||||
set<caret>I(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user