IDEA-135554 Suggestion for class variable are incorrect
authorpeter <peter@jetbrains.com>
Fri, 6 Feb 2015 16:01:46 +0000 (17:01 +0100)
committerpeter <peter@jetbrains.com>
Fri, 6 Feb 2015 16:26:14 +0000 (17:26 +0100)
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
java/java-tests/testData/codeInsight/completion/normal/NothingAfterTypeParameterQualifier.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy

index 77c6eb0d17cc09458f98e24f886e1539eecf27ab..bede9bd170e5297ccb4878b0bc9c3e3e47c6d6b9 100644 (file)
@@ -139,7 +139,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
     psiElement().afterLeaf(psiElement().withText("(").afterLeaf("for")).withParents(PsiJavaCodeReferenceElement.class,
                                                                                     PsiExpressionStatement.class, PsiForStatement.class);
   private static final PsiJavaElementPattern.Capture<PsiElement> CLASS_REFERENCE =
-    psiElement().withParent(psiReferenceExpression().referencing(psiClass()));
+    psiElement().withParent(psiReferenceExpression().referencing(psiClass().andNot(psiElement(PsiTypeParameter.class))));
 
   private static final ElementPattern<PsiElement> EXPR_KEYWORDS = and(
     psiElement().withParent(psiElement(PsiReferenceExpression.class).withParent(
diff --git a/java/java-tests/testData/codeInsight/completion/normal/NothingAfterTypeParameterQualifier.java b/java/java-tests/testData/codeInsight/completion/normal/NothingAfterTypeParameterQualifier.java
new file mode 100644 (file)
index 0000000..1d321aa
--- /dev/null
@@ -0,0 +1,6 @@
+public class MyFirstTestClassFoo {
+
+  public <T> T getSomething(){
+    Class klazz = T.<caret>;
+  }
+}
\ No newline at end of file
index ad932fc867355118a48adce4afe840b6bb561fa1..dd28f479f41ca84acf690c1de1e625bae108998d 100644 (file)
@@ -675,6 +675,7 @@ public class ListUtils {
   }
 
   public void testNothingAfterNumericLiteral() throws Throwable { doAntiTest(); }
+  public void testNothingAfterTypeParameterQualifier() { doAntiTest(); }
 
   public void testSpacesAroundEq() throws Throwable { doTest('='); }