IDEA-70184 Class F cannot be referenced from static context error after Smart Completion invocation

This commit is contained in:
peter
2011-10-17 18:55:39 +02:00
parent c7be853da4
commit 7dbcadcedc
4 changed files with 29 additions and 1 deletions

View File

@@ -116,7 +116,8 @@ public class JavaInheritorsGetter extends CompletionProvider<CompletionParameter
final PsiClass psiClass = PsiUtil.resolveClassInType(type);
if (psiClass == null) return null;
if (HighlightClassUtil.checkCreateInnerClassFromStaticContext(parameters.getPosition(), null, psiClass) != null) {
if ((parameters.getInvocationCount() < 2 || psiClass instanceof PsiCompiledElement) &&
HighlightClassUtil.checkCreateInnerClassFromStaticContext(parameters.getPosition(), null, psiClass) != null) {
return null;
}

View File

@@ -0,0 +1,13 @@
public class Test{
public class F {}
public int x(F f) {
return 1;
}
public static void main(String[] args) {
Test test = new Test();
test.x(new F())<caret>;
}
}

View File

@@ -0,0 +1,13 @@
public class Test{
public class F {}
public int x(F f) {
return 1;
}
public static void main(String[] args) {
Test test = new Test();
test.x(new <caret>);
}
}

View File

@@ -75,6 +75,7 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
public void testNoObjectMethodsAsFirstPart() throws Throwable { doTest(); }
public void testGetClassLoader() throws Throwable { doTest(); }
public void testNewStaticProblem() throws Throwable { doTest(); }
public void testChainingPerformance() throws Throwable {
long time = System.currentTimeMillis();