IDEA-119052 Java smart type code completion proposes incorrect variant if non-matching local variable hides a matching instance variable

This commit is contained in:
peter
2014-01-13 19:58:47 +01:00
parent df8967b840
commit b06366a1ba
5 changed files with 46 additions and 2 deletions
@@ -0,0 +1,18 @@
import java.util.Collection;
class A {
String join(Collection<String> strings) {
return StringUtil.join(strings, ",");
}
void method(Collection<String> param) {
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String[] param = {""}; // hides the parameter
Collection<String> params = Arrays.asList(param);
join(params)<caret>
}
};
}
}
@@ -0,0 +1,18 @@
import java.util.Collection;
class A {
String join(Collection<String> strings) {
return StringUtil.join(strings, ",");
}
void method(Collection<String> param) {
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String[] param = {""}; // hides the parameter
Collection<String> params = Arrays.asList(param);
join(<caret>)
}
};
}
}
@@ -994,6 +994,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
public void testCaseMissingEnumValue() throws Throwable { doTest(); }
public void testCaseMissingEnumValue2() throws Throwable { doTest(); }
public void testNoHiddenParameter() { doTest(); }
public void testTypeVariableInstanceOf() throws Throwable {
configureByTestName();
@@ -1106,7 +1108,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
complete();
}
private void doTest() throws Exception {
private void doTest() {
doTest(Lookup.NORMAL_SELECT_CHAR);
}