mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-03 15:50:52 +07:00
IDEA-274123 [extract method]: don't suggest too abstract change signatures
GitOrigin-RevId: 4c59710e2304288ad4465a92ec36bff633bd661e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
98559e53c5
commit
73f35ed28c
@@ -1,12 +1,12 @@
|
||||
public class Test {
|
||||
void test(boolean condition) {
|
||||
extracted("one");
|
||||
extracted();
|
||||
foo("one");
|
||||
foo("two");
|
||||
}
|
||||
|
||||
private void extracted(String one) {
|
||||
foo(one);
|
||||
private void extracted() {
|
||||
foo("one");
|
||||
}
|
||||
|
||||
void foo(String name) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Test {
|
||||
public void test() {
|
||||
byte[] one = <selection>"one".getBytes()</selection>;
|
||||
byte[] two = "two".getBytes();
|
||||
}
|
||||
public void test() {
|
||||
String start1 = <selection>"one".substring(0, 10)</selection>;
|
||||
String start2 = "two".substring(0, 10);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
public void test() {
|
||||
byte[] one = getBytes("one");
|
||||
byte[] two = getBytes("two");
|
||||
}
|
||||
public void test() {
|
||||
String start1 = getSubstring("one");
|
||||
String start2 = getSubstring("two");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static byte[] getBytes(String one) {
|
||||
return one.getBytes();
|
||||
private static String getSubstring(String one) {
|
||||
return one.substring(0, 10);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
class Test {
|
||||
static int offset = 42;
|
||||
|
||||
void test(){
|
||||
int avgA = <selection>10 + 20 / 2</selection>;
|
||||
int avgB = 100 + 200 / 2;
|
||||
int avgA = <selection>10 + 20 / 2 - Test.offset - 1</selection>;
|
||||
int avgB = 100 + 200 / 2 - Test.offset - 1;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
class Test {
|
||||
static int offset = 42;
|
||||
|
||||
void test(){
|
||||
int avgA = average(10, 20);
|
||||
int avgB = average(100, 200);
|
||||
int avgA = averageWithOffset(10, 20);
|
||||
int avgB = averageWithOffset(100, 200);
|
||||
}
|
||||
|
||||
private static int average(int x, int x1) {
|
||||
return x + x1 / 2;
|
||||
private static int averageWithOffset(int x, int x1) {
|
||||
return x + x1 / 2 - Test.offset - 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
public class Test {
|
||||
|
||||
void test() {
|
||||
if (<selection>getSize1() < getLimit1() && getCondition1()</selection>) {
|
||||
System.out.println();
|
||||
}
|
||||
if (getSize2() < getLimit2() && getCondition1()) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
int getSize1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int getSize2() { return 42; }
|
||||
|
||||
int getLimit1() { return 42; }
|
||||
|
||||
int getLimit2() { return 42; }
|
||||
|
||||
boolean getCondition1 { return true; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
public class Test {
|
||||
|
||||
void test() {
|
||||
if (isaBoolean()) {
|
||||
System.out.println();
|
||||
}
|
||||
if (getSize2() < getLimit2() && getCondition1()) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isaBoolean() {
|
||||
return getSize1() < getLimit1() && getCondition1();
|
||||
}
|
||||
|
||||
int getSize1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int getSize2() { return 42; }
|
||||
|
||||
int getLimit1() { return 42; }
|
||||
|
||||
int getLimit2() { return 42; }
|
||||
|
||||
boolean getCondition1 { return true; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
public class Test {
|
||||
|
||||
void test() {
|
||||
if (<selection>getSize1() < getLimit1()</selection>) {
|
||||
System.out.println();
|
||||
}
|
||||
if (getSize2() < getLimit2()) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
int getSize1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int getSize2() { return 42; }
|
||||
|
||||
int getLimit1() { return 42; }
|
||||
|
||||
int getLimit2() { return 42; }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
public class Test {
|
||||
|
||||
void test() {
|
||||
if (isaBoolean()) {
|
||||
System.out.println();
|
||||
}
|
||||
if (getSize2() < getLimit2()) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isaBoolean() {
|
||||
return getSize1() < getLimit1();
|
||||
}
|
||||
|
||||
int getSize1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int getSize2() { return 42; }
|
||||
|
||||
int getLimit1() { return 42; }
|
||||
|
||||
int getLimit2() { return 42; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
public class Test {
|
||||
|
||||
boolean test1() {
|
||||
<selection>return getSize1() < getLimit1();</selection>
|
||||
}
|
||||
|
||||
boolean test2() {
|
||||
return getSize2() < getLimit2();
|
||||
}
|
||||
|
||||
int getSize1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int getSize2() { return 42; }
|
||||
|
||||
int getLimit1() { return 42; }
|
||||
|
||||
int getLimit2() { return 42; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
public class Test {
|
||||
|
||||
boolean test1() {
|
||||
return extracted();
|
||||
}
|
||||
|
||||
private boolean extracted() {
|
||||
return getSize1() < getLimit1();
|
||||
}
|
||||
|
||||
boolean test2() {
|
||||
return getSize2() < getLimit2();
|
||||
}
|
||||
|
||||
int getSize1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int getSize2() { return 42; }
|
||||
|
||||
int getLimit1() { return 42; }
|
||||
|
||||
int getLimit2() { return 42; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class Test {
|
||||
|
||||
void test() {
|
||||
<selection>if (isGood() && isApplicable()) {
|
||||
System.out.println();
|
||||
}</selection>
|
||||
if (!isGood() && isApplicable()) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isGood() { return true; }
|
||||
|
||||
boolean isApplicable() { return true; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
public class Test {
|
||||
|
||||
void test() {
|
||||
extracted(isGood());
|
||||
extracted(!isGood());
|
||||
}
|
||||
|
||||
private void extracted(boolean Good) {
|
||||
if (Good && isApplicable()) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isGood() { return true; }
|
||||
|
||||
boolean isApplicable() { return true; }
|
||||
}
|
||||
Reference in New Issue
Block a user