From f482636569299d0e9893589e49a703cfa324e87a Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 31 Aug 2015 15:11:01 +0200 Subject: [PATCH] IDEA-144532 "extends" keyword is not hinted correctly --- .../intellij/codeInsight/completion/JavaKeywordCompletion.java | 3 +++ .../completion/keywords/extendsAfterClassGenerics.java | 2 ++ .../intellij/codeInsight/completion/KeywordCompletionTest.java | 1 + 3 files changed, 6 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/completion/keywords/extendsAfterClassGenerics.java diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java index d7d785954745..ae95ee158638 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java @@ -469,6 +469,9 @@ public class JavaKeywordCompletion { if (referenceList != null && referenceList.getParent() instanceof PsiClass) { psiClass = (PsiClass)referenceList.getParent(); } + else if (prevLeaf.getParent() instanceof PsiTypeParameterList && prevLeaf.getParent().getParent() instanceof PsiClass) { + psiClass = (PsiClass)prevLeaf.getParent().getParent(); + } } if (psiClass != null) { diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsAfterClassGenerics.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsAfterClassGenerics.java new file mode 100644 index 000000000000..75c68e89af14 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsAfterClassGenerics.java @@ -0,0 +1,2 @@ +class A { +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java index b2d2d76ceeb5..ec6cf94b62ac 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java @@ -64,6 +64,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase { public void testExtends11() throws Exception { doTest(false); } public void testExtends12() throws Exception { doTest(false); } public void testExtends13() throws Exception { doTest(false); } + public void testExtendsAfterClassGenerics() throws Exception { doTest(2, "extends", "implements"); } public void testSynchronized1() throws Exception { doTest(false); } public void testSynchronized2() throws Exception {