IDEA-103117 (completion after annotated wildcard parameter)

This commit is contained in:
Roman Shevchenko
2013-03-21 20:21:57 +01:00
parent e97098dc1e
commit d07261265b
5 changed files with 48 additions and 8 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -483,8 +483,8 @@ public class JavaCompletionData extends JavaAwareCompletionData {
}
}
if ((isInsideParameterList(position) || isAtResourceVariableStart(position)) &&
!psiElement().afterLeaf(PsiKeyword.FINAL).accepts(position) &&
if ((isInsideParameterList(position) || isAtResourceVariableStart(position)) &&
!psiElement().afterLeaf(PsiKeyword.FINAL).accepts(position) &&
!AFTER_DOT.accepts(position)) {
result.addElement(TailTypeDecorator.withTail(createKeyword(position, PsiKeyword.FINAL), TailType.HUMBLE_SPACE_BEFORE_WORD));
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,8 +52,11 @@ import static com.intellij.patterns.StandardPatterns.or;
* @author peter
*/
public class JavaMemberNameCompletionContributor extends CompletionContributor {
public static final ElementPattern<PsiElement> INSIDE_TYPE_PARAMS_PATTERN =
psiElement().afterLeaf(psiElement().withText("?").afterLeaf("<", ","));
public static final ElementPattern<PsiElement> INSIDE_TYPE_PARAMS_PATTERN = psiElement().
afterLeaf(psiElement().withText("?").andOr(
psiElement().afterLeaf("<", ","),
psiElement().afterSiblingSkipping(psiElement().whitespaceCommentEmptyOrError(), psiElement(PsiAnnotation.class))));
static final int MAX_SCOPE_SIZE_TO_SEARCH_UNRESOLVED = 50000;
@Override
@@ -410,7 +413,7 @@ public class JavaMemberNameCompletionContributor extends CompletionContributor {
continue outer;
}
}
LookupElement element = PrioritizedLookupElement.withPriority(LookupElementBuilder.create(name).withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE), -i);
if (callback != null) {
element = LookupElementDecorator.withInsertHandler(element, new InsertHandler<LookupElementDecorator<LookupElement>>() {
@@ -0,0 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class A {
Collection<@TA ? ex<caret>>
}
@@ -0,0 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class A {
Collection<@TA ? extends <caret>>
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,6 +62,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
public void testExtends10() throws Exception { doTest(false); }
public void testExtends11() throws Exception { doTest(false); }
public void testExtends12() throws Exception { doTest(false); }
public void testExtends13() throws Exception { doTest(false); }
public void testSynchronized1() throws Exception { doTest(false); }
public void testSynchronized2() throws Exception {