mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
Java: Slightly increased the limit for size of subexpression that can be an extracted method's parameter (IDEA-181195)
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
* @author Pavel.Dolgov
|
||||
*/
|
||||
class ComplexityHolder {
|
||||
static final int MAX_ACCEPTABLE = 9;
|
||||
static final int MAX_ACCEPTABLE = 12;
|
||||
static final int TOO_COMPLEX = 100;
|
||||
|
||||
private final ObjectIntHashMap<PsiExpression> myCache = new ObjectIntHashMap<>();
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class C {
|
||||
void foo(String x, int a, int b) {
|
||||
String s1 = <selection>sum(a, b).substring(2, Math.max(a, b))</selection>;
|
||||
String s2 = sum(a, 0).substring(2, Math.min(a, b) + 1);
|
||||
String s3 = x.substring(2, a - b);
|
||||
}
|
||||
|
||||
String sum(int a, int b) {
|
||||
return a + " " + b;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class C {
|
||||
void foo(String x, int a, int b) {
|
||||
String s1 = newMethod(sum(a, b), Math.max(a, b));
|
||||
String s2 = newMethod(sum(a, 0), Math.min(a, b) + 1);
|
||||
String s3 = newMethod(x, a - b);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String newMethod(String sum, int max) {
|
||||
return sum.substring(2, max);
|
||||
}
|
||||
|
||||
String sum(int a, int b) {
|
||||
return a + " " + b;
|
||||
}
|
||||
}
|
||||
@@ -947,6 +947,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testParametrizedDuplicateExpression() throws Exception {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testSuggestChangeSignatureWithChangedParameterName() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
boolean success = performExtractMethod(true, true, getEditor(), getFile(), getProject(), false, null, false, "p");
|
||||
|
||||
Reference in New Issue
Block a user