Suggest j and k for int type

GitOrigin-RevId: 964e58ddcbf7920d18274be6e05df40088f9ed32
This commit is contained in:
Tagir Valeev
2020-06-11 10:01:40 +03:00
committed by intellij-monorepo-bot
parent 8af51fa572
commit ba72470db2
5 changed files with 13 additions and 9 deletions
@@ -2,12 +2,12 @@
class X {
int m(int i) {
if (i > 0) {
int i1 = ++i;
if (i1 == 1) {
int j = ++i;
if (j == 1) {
System.out.println(1);
System.out.println(2);
} else if (i1 == 2) {
} else if (j == 2) {
System.out.println(2);
}
}
@@ -44,6 +44,10 @@ public final class VariableNameGenerator {
if (type != null) {
SuggestedNameInfo info = myManager.suggestVariableName(myKind, null, null, type, true);
candidates.addAll(Arrays.asList(info.names));
if (type.equals(PsiType.INT)) {
candidates.add("j");
candidates.add("k");
}
}
return this;
}
@@ -2,9 +2,9 @@ class Main {
int test(int i) {
return switch(i) {
default -> {
int result = i;
int j = i;
i++;
yield <caret>result;
yield <caret>j;
}
};
}
@@ -2,8 +2,8 @@ package com.siyeh.ipp.forloop.indexed;
class NormalForEachLoop {
void foo(int[] is) {
for (int i1 = 0, isLength = is.length; i1 < isLength; i1++) {
int i = is[i1];
for (int j = 0, isLength = is.length; j < isLength; j++) {
int i = is[j];
System.out.println(i);
}
}
@@ -2,8 +2,8 @@ package com.siyeh.ipp.forloop.indexed;
import java.util.*;
class NormalForEachLoop implements List<Integer>{
void foo() {
for (int i1 = 0, thisSize = this.size(); i1 < thisSize; i1++) {
Integer i = this.get(i1);
for (int j = 0, thisSize = this.size(); j < thisSize; j++) {
Integer i = this.get(j);
System.out.println(i);
}
}