mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce: do not treat as same different foreach vars (IDEA-58421)
This commit is contained in:
@@ -219,7 +219,7 @@ public class CodeInsightUtil {
|
||||
public static boolean areExpressionsEquivalent(PsiExpression expr1, PsiExpression expr2) {
|
||||
return PsiEquivalenceUtil.areElementsEquivalent(expr1, expr2, new Comparator<PsiElement>() {
|
||||
public int compare(PsiElement o1, PsiElement o2) {
|
||||
if (o1 instanceof PsiParameter && o2 instanceof PsiParameter) {
|
||||
if (o1 instanceof PsiParameter && o2 instanceof PsiParameter && ((PsiParameter)o1).getDeclarationScope() instanceof PsiMethod) {
|
||||
return ((PsiParameter)o1).getName().compareTo(((PsiParameter)o2).getName());
|
||||
}
|
||||
return 1;
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
{
|
||||
List<Integer> l = new ArrayList<Integer>();
|
||||
for (Integer i : l) {
|
||||
final String tostr = i.toString();
|
||||
System.out.println(tostr);
|
||||
}
|
||||
for (Integer i : l) {
|
||||
System.out.println(i.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
{
|
||||
List<Integer> l = new ArrayList<Integer>();
|
||||
for (Integer i : l) {
|
||||
System.out.println(<selection>i.toString()</selection>);
|
||||
}
|
||||
for (Integer i : l) {
|
||||
System.out.println(i.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,10 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
doTest(new MockIntroduceVariableHandler("foo1", true, true, false, "Foo"));
|
||||
}
|
||||
|
||||
public void testDifferentForeachParameters () throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("tostr", true, true, false, "java.lang.String"));
|
||||
}
|
||||
|
||||
public void testSiblingInnerClassType() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("vari", true, false, false, "A.B"){
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user