From 44dfc3dd78af04281f2a3af11c629acee5f62355 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Mon, 30 Jul 2018 13:27:40 +0300 Subject: [PATCH] Annotate parameters of InsertHandler#handleInsert and LookupElement#handleInsert with @NotNull --- .../regexp/RegExpCompletionContributor.java | 18 ++------------- .../MethodChainLookupRangingHelper.java | 18 ++------------- ...ainCompletionNewVariableLookupElement.java | 18 ++------------- .../completion/AllClassesGetter.java | 18 ++------------- .../completion/AnnotationInsertHandler.java | 19 +++------------ .../completion/ArrayMemberAccess.java | 19 +++------------ .../CastingLookupElementDecorator.java | 19 +++------------ .../completion/ChainedCallCompletion.java | 19 +++------------ .../completion/CollectConversion.java | 18 ++------------- .../completion/ConstructorInsertHandler.java | 11 +++++---- .../completion/DefaultInsertHandler.java | 19 +++------------ .../completion/FromArrayConversion.java | 18 ++------------- .../completion/JavaChainLookupElement.java | 18 ++------------- .../JavaClassNameInsertHandler.java | 18 ++------------- .../completion/JavaCompletionContributor.java | 8 +++---- .../completion/JavaCompletionUtil.java | 12 +++++----- .../JavaConstructorCallElement.java | 2 +- .../JavaDocCompletionContributor.java | 22 ++++-------------- ...vaGenerateMemberCompletionContributor.java | 20 +++------------- .../JavaGlobalMemberLookupElement.java | 3 ++- .../completion/JavaKeywordCompletion.java | 4 ++-- .../JavaMemberNameCompletionContributor.java | 23 +++++-------------- .../completion/JavaMethodCallElement.java | 2 +- .../completion/JavaStaticMemberProcessor.java | 20 +++------------- .../MethodReferenceCompletionProvider.java | 18 ++------------- .../SameSignatureCallParametersProvider.java | 18 ++------------- .../completion/SmartCastProvider.java | 3 ++- .../completion/SmartCompletionDecorator.java | 18 ++------------- .../codeInsight/completion/SuperCalls.java | 18 ++------------- .../completion/ToArrayConversion.java | 18 ++------------- .../TypeArgumentCompletionProvider.java | 18 ++------------- .../lookup/ExpressionLookupItem.java | 18 ++------------- .../codeInsight/lookup/PackageLookupItem.java | 18 ++------------- .../codeInsight/lookup/PsiTypeLookupItem.java | 4 ++-- .../lookup/VariableLookupItem.java | 20 +++------------- .../getters/ClassLiteralLookupElement.java | 18 ++------------- .../impl/JavaLangClassMemberReference.java | 18 ++------------- ...JavaMethodHandleCompletionContributor.java | 18 ++------------- .../template/LiveTemplateTest.groovy | 2 +- .../ManifestCompletionContributor.java | 2 +- .../util/PsiTypeCanonicalLookupElement.java | 18 ++------------- .../util/SimpleMethodCallLookupElement.java | 20 +++------------- .../JsonStringPropertyInsertHandler.java | 18 ++------------- .../impl/JsonSchemaCompletionContributor.java | 6 ++--- .../ui/ExternalProjectPathLookupElement.java | 19 ++------------- .../codeInsight/completion/InsertHandler.java | 19 +++------------ .../util/ParenthesesInsertHandler.java | 2 +- .../codeInsight/lookup/LookupElement.java | 18 ++------------- .../lookup/LookupElementBuilder.java | 18 ++------------- .../lookup/LookupElementDecorator.java | 20 +++------------- .../completion/AddSpaceInsertHandler.java | 4 +++- .../completion/BasicInsertHandler.java | 19 +++------------ .../FilePathCompletionContributor.java | 6 ++--- .../codeInsight/lookup/LookupItem.java | 20 +++------------- .../codeInsight/lookup/TailTypeDecorator.java | 19 +++------------ .../impl/CustomLiveTemplateLookupElement.java | 18 ++------------- .../impl/LiveTemplateLookupElementImpl.java | 18 ++------------- .../impl/TemplateExpressionLookupElement.java | 19 +++------------ .../rename/inplace/MyLookupExpression.java | 19 +++------------ .../ValuesCompletionProvider.java | 20 +++------------- .../GrStatementStartCompletionProvider.java | 18 ++------------- .../GroovyClassNameInsertHandler.java | 19 +++------------ .../lang/completion/GroovyInsertHandler.java | 19 +++------------ .../GroovySmartCompletionContributor.java | 8 +++---- .../QualifiedMethodInsertHandler.java | 19 +++------------ .../completion/StaticImportInsertHandler.java | 4 ++-- .../handlers/AfterNewClassInsertHandler.java | 19 +++------------ .../handlers/GroovyMethodOverrideHandler.java | 19 +++------------ .../GroovyMethodSignatureInsertHandler.java | 19 +++------------ .../handlers/NamedArgumentInsertHandler.java | 20 +++------------- .../expressions/ChooseTypeExpression.java | 18 ++------------- .../refs/JavaFxCompletionContributor.java | 2 +- ...rtifactCoordinatesArtifactIdConverter.java | 18 ++------------- ...enArtifactCoordinatesGroupIdConverter.java | 4 +++- .../MavenDependenciesCompletionProvider.java | 3 ++- ...omXmlCompletionTagListenerContributor.java | 4 ++-- .../MavenGroovyPomCompletionContributor.java | 18 ++------------- .../enhancer/UnmatchableLookupElement.kt | 18 ++------------- .../TaskAutoCompletionListProvider.java | 18 ++------------- .../YouTrackCompletionContributor.java | 4 ++-- .../xpath/completion/XPathInsertHandler.java | 15 +++++++----- .../YamlKeyCompletionInsertHandler.java | 3 ++- .../PyUnindentingInsertHandler.java | 19 +++------------ .../OverwriteEqualsInsertHandler.java | 19 +++------------ .../completion/PyClassInsertHandler.java | 19 +++------------ .../PyDictKeyNamesCompletionContributor.java | 4 ++-- .../completion/PythonLookupElement.java | 18 ++------------- .../completion/PydevConsoleReference.java | 18 ++------------- .../impl/references/PyImportReference.java | 18 ++------------- .../completion/DtdCompletionContributor.java | 18 ++------------- .../completion/ExtendedTagInsertHandler.java | 21 ++++------------- .../completion/XmlAttributeInsertHandler.java | 18 ++------------- .../XmlClosingTagInsertHandler.java | 19 +++------------ .../completion/XmlCompletionContributor.java | 4 ++-- .../completion/XmlTagInsertHandler.java | 2 +- .../source/xml/DefaultXmlTagNameProvider.java | 20 +++------------- .../intellij/xml/util/UserColorLookup.java | 18 ++------------- 97 files changed, 244 insertions(+), 1195 deletions(-) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java index 4a83c931818b..a113077a2e6a 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpCompletionContributor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.lang.regexp; import com.intellij.codeInsight.TailType; @@ -126,7 +112,7 @@ public final class RegExpCompletionContributor extends CompletionContributor { LookupElementBuilder.create(completion[0]).withTypeText((completion.length > 1) ? completion[1] : null).withIcon(emptyIcon) .withInsertHandler(new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { context.setAddCompletionChar(false); final Editor editor = context.getEditor(); final Document document = editor.getDocument(); diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/MethodChainLookupRangingHelper.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/MethodChainLookupRangingHelper.java index bcd78c35d5fc..094230d9fff8 100644 --- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/MethodChainLookupRangingHelper.java +++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/MethodChainLookupRangingHelper.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.compiler.chainsSearch; import com.intellij.codeInsight.NullableNotNullManager; @@ -81,7 +67,7 @@ public class MethodChainLookupRangingHelper { private static LookupElementDecorator decorateWithIteratorAccess(PsiMethod method, LookupElement chainLookupElement) { return new LookupElementDecorator(chainLookupElement) { @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { super.handleInsert(context); Document document = context.getDocument(); int tail = context.getTailOffset(); diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java index 004b92204b0f..0d2698e817a9 100644 --- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java +++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.compiler.chainsSearch.completion.lookup; import com.intellij.codeInsight.completion.InsertionContext; @@ -60,7 +46,7 @@ public class ChainCompletionNewVariableLookupElement extends LookupElement { } @Override - public void handleInsert(final InsertionContext context) { + public void handleInsert(@NotNull final InsertionContext context) { final PsiFile file = context.getFile(); final PsiElement caretElement = ObjectUtils.notNull(file.findElementAt(context.getEditor().getCaretModel().getOffset())); final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(context.getProject()); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java index dbcfffc0612e..8a4ee30bd9ee 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.CodeInsightUtilCore; @@ -109,7 +95,7 @@ public class AllClassesGetter { } @Override - public void handleInsert(final InsertionContext context, final JavaPsiClassReferenceElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull final JavaPsiClassReferenceElement item) { _handleInsert(context, item); item.getTailType().processTail(context.getEditor(), context.getEditor().getCaretModel().getOffset()); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/AnnotationInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/AnnotationInsertHandler.java index 6491ffba6db3..0820effe97cb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/AnnotationInsertHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/AnnotationInsertHandler.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.openapi.diagnostic.Logger; @@ -20,6 +6,7 @@ import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.HighlighterIterator; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; +import org.jetbrains.annotations.NotNull; /** * @author peter @@ -29,7 +16,7 @@ class AnnotationInsertHandler implements InsertHandler item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElementDecorator item) { @SuppressWarnings({"unchecked"}) final LookupElement delegate = item.getDelegate(); PsiClass psiClass = (PsiClass)item.getObject(); @@ -224,10 +225,10 @@ public class ConstructorInsertHandler implements InsertHandler JAVA_CLASS_INSERT_HANDLER = new JavaClassNameInsertHandler(); @Override - public void handleInsert(final InsertionContext context, final JavaPsiClassReferenceElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull final JavaPsiClassReferenceElement item) { int offset = context.getTailOffset() - 1; final PsiFile file = context.getFile(); if (PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiImportStatementBase.class, false) != null) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java index 4c6d7f5f15ac..d0dd253c3218 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; @@ -596,7 +594,7 @@ public class JavaCompletionContributor extends CompletionContributor { } LookupElementBuilder element = LookupElementBuilder.createWithIcon(method).withInsertHandler(new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { final Editor editor = context.getEditor(); TailType.EQ.processTail(editor, editor.getCaretModel().getOffset()); context.setAddCompletionChar(false); @@ -950,7 +948,7 @@ public class JavaCompletionContributor extends CompletionContributor { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { super.handleInsert(context); Project project = context.getProject(); Document document = context.getDocument(); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java index d392983dab62..e7c16f48f6bd 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.*; @@ -407,7 +407,7 @@ public class JavaCompletionUtil { private static LookupElement castQualifier(@NotNull LookupElement item, @NotNull PsiTypeLookupItem castTypeItem) { return LookupElementDecorator.withInsertHandler(item, new InsertHandlerDecorator() { @Override - public void handleInsert(InsertionContext context, LookupElementDecorator item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElementDecorator item) { final Document document = context.getEditor().getDocument(); context.commitDocument(); final PsiFile file = context.getFile(); @@ -707,15 +707,15 @@ public class JavaCompletionUtil { return null; } - public static void insertParentheses(final InsertionContext context, - final LookupElement item, + public static void insertParentheses(@NotNull InsertionContext context, + @NotNull LookupElement item, boolean overloadsMatter, boolean hasParams) { insertParentheses(context, item, overloadsMatter, hasParams, false); } - public static void insertParentheses(final InsertionContext context, - final LookupElement item, + public static void insertParentheses(@NotNull InsertionContext context, + @NotNull LookupElement item, boolean overloadsMatter, boolean hasParams, final boolean forceClosingParenthesis) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java index f10770022899..5ecff9ead8c4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java @@ -49,7 +49,7 @@ public class JavaConstructorCallElement extends LookupElementDecorator { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { if (context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) { final Project project = context.getProject(); PsiDocumentManager.getInstance(project).commitAllDocuments(); @@ -423,7 +409,7 @@ public class JavaDocCompletionContributor extends CompletionContributor { private static class MethodSignatureInsertHandler implements InsertHandler { @Override - public void handleInsert(InsertionContext context, JavaMethodCallElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull JavaMethodCallElement item) { PsiDocumentManager.getInstance(context.getProject()).commitDocument(context.getEditor().getDocument()); final Editor editor = context.getEditor(); final PsiMethod method = item.getObject(); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java index 5aa32e83b15f..fa85f8b12b22 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.generation.*; @@ -103,7 +89,7 @@ public class JavaGenerateMemberCompletionContributor { Icon icon = prototype.getIcon(Iconable.ICON_FLAG_VISIBILITY); result.addElement(createGenerateMethodElement(prototype, PsiSubstitutor.EMPTY, icon, "", new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { removeLookupString(context); insertGenerationInfos(context, Collections.singletonList(new PsiGenerationInfo<>(prototype))); @@ -143,7 +129,7 @@ public class JavaGenerateMemberCompletionContributor { RowIcon icon = new RowIcon(baseMethod.getIcon(0), implemented ? AllIcons.Gutter.ImplementingMethod : AllIcons.Gutter.OverridingMethod); return createGenerateMethodElement(baseMethod, substitutor, icon, baseClass.getName(), new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { removeLookupString(context); final PsiClass parent = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiClass.class, false); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberLookupElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberLookupElement.java index d3b0865a7e37..57b19df14f3b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberLookupElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGlobalMemberLookupElement.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; @@ -85,7 +86,7 @@ public class JavaGlobalMemberLookupElement extends LookupElement implements Stat } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME); (willBeImported() ? myImportInsertion : myQualifiedInsertion).handleInsert(context, this); 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 c27cadf3dc12..73521a748897 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java @@ -403,7 +403,7 @@ public class JavaKeywordCompletion { } @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); TailType.insertChar(context.getEditor(), context.getTailOffset(), ';'); } @@ -492,7 +492,7 @@ public class JavaKeywordCompletion { createKeyword(PsiKeyword.INSTANCEOF), new InsertHandler>() { @Override - public void handleInsert(InsertionContext context, LookupElementDecorator item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElementDecorator item) { TailType tailType = TailType.HUMBLE_SPACE_BEFORE_WORD; if (tailType.isApplicable(context)) { tailType.processTail(context.getEditor(), context.getTailOffset()); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java index eb10559f16cb..63155c78df6c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.TailType; @@ -30,7 +16,10 @@ import com.intellij.psi.*; import com.intellij.psi.codeStyle.JavaCodeStyleManager; import com.intellij.psi.codeStyle.SuggestedNameInfo; import com.intellij.psi.codeStyle.VariableKind; -import com.intellij.psi.util.*; +import com.intellij.psi.util.PropertyUtilBase; +import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.psi.util.PsiUtil; +import com.intellij.psi.util.PsiUtilCore; import com.intellij.refactoring.introduceField.InplaceIntroduceFieldPopup; import com.intellij.refactoring.introduceVariable.IntroduceVariableBase; import com.intellij.util.ArrayUtil; @@ -439,7 +428,7 @@ public class JavaMemberNameCompletionContributor extends CompletionContributor { private static LookupElementDecorator withInsertHandler(final SuggestedNameInfo callback, LookupElement element) { return LookupElementDecorator.withInsertHandler(element, new InsertHandler>() { @Override - public void handleInsert(InsertionContext context, LookupElementDecorator item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElementDecorator item) { TailType tailType = LookupItem.getDefaultTailType(context.getCompletionChar()); if (tailType != null) { context.setAddCompletionChar(false); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index 0f389d37d475..4b0509f9a62d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -154,7 +154,7 @@ public class JavaMethodCallElement extends LookupItem implements Type } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { final Document document = context.getDocument(); final PsiFile file = context.getFile(); final PsiMethod method = getObject(); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java index 436751813144..7cb6b9e40617 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.AutoCompletionPolicy; @@ -69,7 +55,7 @@ public class JavaStaticMemberProcessor extends StaticMemberProcessor { } return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new VariableLookupItem((PsiField)member, shouldImport) { @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME); super.handleInsert(context); @@ -99,7 +85,7 @@ public class JavaStaticMemberProcessor extends StaticMemberProcessor { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME); super.handleInsert(context); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java index 10cd3089cf7b..c0f94311517c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java @@ -1,18 +1,4 @@ -/* - * 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. - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; @@ -125,7 +111,7 @@ public class MethodReferenceCompletionProvider extends CompletionProvider() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { context.commitDocument(); int startOffset = context.getTailOffset(); PsiExpressionList exprList = diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SmartCastProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/SmartCastProvider.java index 6f2e9196eac9..631bd1d4875d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/SmartCastProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/SmartCastProvider.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; @@ -166,7 +167,7 @@ class SmartCastProvider extends CompletionProvider { PsiTypeLookupItem.createLookupItem(type, parameters.getPosition())) { @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.smarttype.casting"); final Editor editor = context.getEditor(); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionDecorator.java b/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionDecorator.java index 71891495f7f3..9213e8207716 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionDecorator.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionDecorator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.application.options.CodeStyle; @@ -115,7 +101,7 @@ public class SmartCompletionDecorator extends TailTypeDecorator { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { if (getObject() instanceof PsiVariable && context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) { context.commitDocument(); replaceMethodCallIfNeeded(context); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java b/java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java index dcd34bfa1f22..cd7184eac604 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.completion.scope.CompletionElement; @@ -67,7 +53,7 @@ class SuperCalls { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { context.commitDocument(); PsiJavaCodeReferenceElement ref = PsiTreeUtil .findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiJavaCodeReferenceElement.class, false); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ToArrayConversion.java b/java/java-impl/src/com/intellij/codeInsight/completion/ToArrayConversion.java index 5bc822dd53bf..b1185e1321e4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/ToArrayConversion.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/ToArrayConversion.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.application.options.CodeStyle; @@ -105,7 +91,7 @@ public class ToArrayConversion { getSpace(callSpace) + ")", presentableString}; result.consume(new ExpressionLookupItem(conversion, PlatformIcons.METHOD_ICON, prefix + ".toArray(" + presentableString + ")", lookupStrings) { @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_TOAR); super.handleInsert(context); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java index c0f906c9031c..8f0110936ac7 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.*; @@ -220,7 +206,7 @@ class TypeArgumentCompletionProvider extends CompletionProvider DEFAULT_IMPORT_FIXER = new InsertHandler() { @Override - public void handleInsert(InsertionContext context, PsiTypeLookupItem item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull PsiTypeLookupItem item) { if (item.getObject() instanceof PsiClass) { addImportForItem(context, (PsiClass)item.getObject()); } @@ -98,7 +98,7 @@ public class PsiTypeLookupItem extends LookupItem implements TypedLookupItem { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { myImportFixer.handleInsert(context, this); PsiElement position = context.getFile().findElementAt(context.getStartOffset()); diff --git a/java/java-impl/src/com/intellij/codeInsight/lookup/VariableLookupItem.java b/java/java-impl/src/com/intellij/codeInsight/lookup/VariableLookupItem.java index b3f603e2167e..33ed353b46aa 100644 --- a/java/java-impl/src/com/intellij/codeInsight/lookup/VariableLookupItem.java +++ b/java/java-impl/src/com/intellij/codeInsight/lookup/VariableLookupItem.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.lookup; import com.intellij.codeInsight.AutoPopupController; @@ -33,13 +19,13 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.impl.source.PsiFieldImpl; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; -import java.util.HashMap; import com.intellij.util.ui.ColorIcon; import com.intellij.util.ui.JBUI; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.*; +import java.util.HashMap; /** * @author peter @@ -169,7 +155,7 @@ public class VariableLookupItem extends LookupItem implements Typed } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { PsiVariable variable = getObject(); Document document = context.getDocument(); diff --git a/java/java-impl/src/com/intellij/psi/filters/getters/ClassLiteralLookupElement.java b/java/java-impl/src/com/intellij/psi/filters/getters/ClassLiteralLookupElement.java index 04927aa2ac05..005664ec28f3 100644 --- a/java/java-impl/src/com/intellij/psi/filters/getters/ClassLiteralLookupElement.java +++ b/java/java-impl/src/com/intellij/psi/filters/getters/ClassLiteralLookupElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.filters.getters; import com.intellij.codeInsight.completion.InsertionContext; @@ -95,7 +81,7 @@ class ClassLiteralLookupElement extends LookupElement implements TypedLookupItem } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { final Document document = context.getEditor().getDocument(); document.replaceString(context.getStartOffset(), context.getTailOffset(), myCanonicalText + DOT_CLASS); final Project project = context.getProject(); diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaLangClassMemberReference.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaLangClassMemberReference.java index 50b0f901ad80..7a9c9405d3e9 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaLangClassMemberReference.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaLangClassMemberReference.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.resolve.reference.impl; import com.intellij.codeInsight.completion.InsertHandler; @@ -189,7 +175,7 @@ public class JavaLangClassMemberReference extends PsiReferenceBase() { @Override - void handleInsert(InsertionContext insertCtx, LookupElement item) { + void handleInsert(@NotNull InsertionContext insertCtx, @NotNull LookupElement item) { def stateRef = TemplateManagerImpl.getTemplateState(insertCtx.editor) assertFalse(stateRef.isFinished()) stateRef.nextTab() diff --git a/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java b/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java index 554c25b08ca2..19d2cf1815c9 100644 --- a/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java +++ b/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java @@ -60,7 +60,7 @@ public class ManifestCompletionContributor extends CompletionContributor { private static final InsertHandler HEADER_INSERT_HANDLER = new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { context.setAddCompletionChar(false); EditorModificationUtil.insertStringAtCaret(context.getEditor(), ": "); context.commitDocument(); diff --git a/java/openapi/src/com/intellij/codeInsight/completion/util/PsiTypeCanonicalLookupElement.java b/java/openapi/src/com/intellij/codeInsight/completion/util/PsiTypeCanonicalLookupElement.java index 08e26fc8b433..bf3d859237c4 100644 --- a/java/openapi/src/com/intellij/codeInsight/completion/util/PsiTypeCanonicalLookupElement.java +++ b/java/openapi/src/com/intellij/codeInsight/completion/util/PsiTypeCanonicalLookupElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion.util; import com.intellij.codeInsight.completion.InsertionContext; @@ -76,7 +62,7 @@ public class PsiTypeCanonicalLookupElement extends LookupElement { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { context.getEditor().getDocument().replaceString(context.getStartOffset(), context.getStartOffset() + getLookupString().length(), getPsiType().getCanonicalText()); } diff --git a/java/openapi/src/com/intellij/codeInsight/completion/util/SimpleMethodCallLookupElement.java b/java/openapi/src/com/intellij/codeInsight/completion/util/SimpleMethodCallLookupElement.java index 1ebda1561335..c83f76f1aa48 100644 --- a/java/openapi/src/com/intellij/codeInsight/completion/util/SimpleMethodCallLookupElement.java +++ b/java/openapi/src/com/intellij/codeInsight/completion/util/SimpleMethodCallLookupElement.java @@ -1,28 +1,14 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion.util; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementPresentation; +import com.intellij.openapi.util.Iconable; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiSubstitutor; import com.intellij.psi.PsiType; import com.intellij.psi.util.PsiFormatUtil; -import com.intellij.openapi.util.Iconable; import org.jetbrains.annotations.NotNull; /** @@ -42,7 +28,7 @@ public class SimpleMethodCallLookupElement extends LookupElement { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { new MethodParenthesesHandler(myMethod, true).handleInsert(context, this); } diff --git a/json/src/com/intellij/json/codeinsight/JsonStringPropertyInsertHandler.java b/json/src/com/intellij/json/codeinsight/JsonStringPropertyInsertHandler.java index 36518e18f3cb..ebb20bf560a9 100644 --- a/json/src/com/intellij/json/codeinsight/JsonStringPropertyInsertHandler.java +++ b/json/src/com/intellij/json/codeinsight/JsonStringPropertyInsertHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.json.codeinsight; import com.intellij.codeInsight.AutoPopupController; @@ -40,7 +26,7 @@ public class JsonStringPropertyInsertHandler implements InsertHandler createArrayOrObjectLiteralInsertHandler(boolean newline) { return new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { Editor editor = context.getEditor(); if (!newline) { @@ -377,7 +377,7 @@ public class JsonSchemaCompletionContributor extends CompletionContributor { boolean insertComma) { return new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { ApplicationManager.getApplication().assertWriteAccessAllowed(); Editor editor = context.getEditor(); Project project = context.getProject(); @@ -410,7 +410,7 @@ public class JsonSchemaCompletionContributor extends CompletionContributor { JsonSchemaType finalType = type; return new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { ApplicationManager.getApplication().assertWriteAccessAllowed(); Editor editor = context.getEditor(); Project project = context.getProject(); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/ExternalProjectPathLookupElement.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/ExternalProjectPathLookupElement.java index 257d4b60b3d6..a751b519dbbf 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/ExternalProjectPathLookupElement.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/ExternalProjectPathLookupElement.java @@ -1,23 +1,8 @@ -/* - * 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. - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.service.ui; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.FoldRegion; @@ -47,7 +32,7 @@ public class ExternalProjectPathLookupElement extends LookupElement { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { Editor editor = context.getEditor(); final FoldingModel foldingModel = editor.getFoldingModel(); foldingModel.runBatchFoldingOperation(() -> { diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/InsertHandler.java b/platform/lang-api/src/com/intellij/codeInsight/completion/InsertHandler.java index 0c77f729829b..aed34500d8e3 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/completion/InsertHandler.java +++ b/platform/lang-api/src/com/intellij/codeInsight/completion/InsertHandler.java @@ -1,22 +1,9 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; +import org.jetbrains.annotations.NotNull; /** * @author Mike @@ -26,5 +13,5 @@ public interface InsertHandler { /** * Invoked inside atomic action. */ - void handleInsert(InsertionContext context, T item); + void handleInsert(@NotNull InsertionContext context, @NotNull T item); } diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java b/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java index b5e6ff9e52e8..9578130a39e1 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java +++ b/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java @@ -91,7 +91,7 @@ public abstract class ParenthesesInsertHandler implemen protected abstract boolean placeCaretInsideParentheses(final InsertionContext context, final T item); @Override - public void handleInsert(final InsertionContext context, final T item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull final T item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); context.commitDocument(); diff --git a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElement.java b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElement.java index 08e70bcab62c..9aaa06da79e1 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElement.java +++ b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.lookup; import com.intellij.codeInsight.completion.InsertionContext; @@ -81,7 +67,7 @@ public abstract class LookupElement extends UserDataHolderBase { return true; } - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { } /** diff --git a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java index 176022619595..91de81b3b481 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java +++ b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.lookup; @@ -441,7 +427,7 @@ public final class LookupElementBuilder extends LookupElement { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { if (myInsertHandler != null) { myInsertHandler.handleInsert(context, this); } diff --git a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java index 8b741c48106b..f5b049e0b1ea 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java +++ b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.lookup; import com.intellij.codeInsight.completion.InsertHandler; @@ -64,7 +50,7 @@ public abstract class LookupElementDecorator extends Lo } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { myDelegate.handleInsert(context); } @@ -141,7 +127,7 @@ public abstract class LookupElementDecorator extends Lo } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { myInsertHandler.handleInsert(context, this); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java index a793352228b4..3a220bc9d2b1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.AutoPopupController; @@ -8,6 +9,7 @@ import com.intellij.openapi.editor.EditorModificationUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiDocumentManager; +import org.jetbrains.annotations.NotNull; /** * @author zolotov @@ -28,7 +30,7 @@ public class AddSpaceInsertHandler implements InsertHandler { myTriggerAutoPopup = triggerAutoPopup; } - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) return; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/BasicInsertHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/BasicInsertHandler.java index 370cacd85f2a..a6195bd07c79 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/BasicInsertHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/BasicInsertHandler.java @@ -1,29 +1,16 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; +import org.jetbrains.annotations.NotNull; /** * @author Mike */ public class BasicInsertHandler implements InsertHandler { @Override - public void handleInsert(InsertionContext context, T item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull T item) { } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java index 5935c0091efc..eab934026da2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; @@ -290,7 +288,7 @@ public class FilePathCompletionContributor extends CompletionContributor { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { context.commitDocument(); if (myFile.isValid()) { final PsiReference psiReference = context.getFile().findReferenceAt(context.getStartOffset()); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java index 4e7c5ef74d80..7909f7d7e883 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupItem.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.lookup; @@ -27,12 +13,12 @@ import com.intellij.openapi.util.ClassConditionKey; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Key; import com.intellij.util.containers.ContainerUtil; -import java.util.HashMap; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -191,7 +177,7 @@ public class LookupItem extends MutableLookupElement implements Comparable } @Override - public void handleInsert(final InsertionContext context) { + public void handleInsert(@NotNull final InsertionContext context) { final InsertHandler handler = getInsertHandler(); if (handler != null) { //noinspection unchecked diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/TailTypeDecorator.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/TailTypeDecorator.java index 2bee9eba7df1..d1f78cb983bc 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/TailTypeDecorator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/TailTypeDecorator.java @@ -1,23 +1,10 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.lookup; import com.intellij.codeInsight.TailType; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.psi.impl.source.PostprocessReformattingAspect; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -42,7 +29,7 @@ public abstract class TailTypeDecorator extends LookupE protected abstract TailType computeTailType(InsertionContext context); @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { final LookupElement delegate = getDelegate(); final TailType tailType = computeTailType(context); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/CustomLiveTemplateLookupElement.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/CustomLiveTemplateLookupElement.java index f9a1d3412e0c..f4a369df2953 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/CustomLiveTemplateLookupElement.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/CustomLiveTemplateLookupElement.java @@ -1,18 +1,4 @@ -/* - * 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. - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.impl; import com.intellij.codeInsight.completion.InsertionContext; @@ -58,7 +44,7 @@ public class CustomLiveTemplateLookupElement extends LiveTemplateLookupElement { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { context.setAddCompletionChar(false); expandTemplate(context.getEditor(), context.getFile()); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupElementImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupElementImpl.java index 783459f8893c..313722ca56ce 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupElementImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupElementImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.impl; import com.intellij.codeInsight.completion.InsertionContext; @@ -46,7 +32,7 @@ public class LiveTemplateLookupElementImpl extends LiveTemplateLookupElement { } @Override - public void handleInsert(InsertionContext context) { + public void handleInsert(@NotNull InsertionContext context) { startTemplate(context, myTemplate); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java index e717bb34fb33..bb2be1540e4b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.impl; import com.intellij.codeInsight.AutoPopupController; @@ -30,6 +16,7 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -69,7 +56,7 @@ class TemplateExpressionLookupElement extends LookupElementDecorator() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { if (shouldSelectAll) return; final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(context.getEditor()); final TemplateState templateState = TemplateManagerImpl.getTemplateState(topLevelEditor); diff --git a/platform/lang-impl/src/com/intellij/util/textCompletion/ValuesCompletionProvider.java b/platform/lang-impl/src/com/intellij/util/textCompletion/ValuesCompletionProvider.java index 51fcede3539c..08bfc15ff933 100644 --- a/platform/lang-impl/src/com/intellij/util/textCompletion/ValuesCompletionProvider.java +++ b/platform/lang-impl/src/com/intellij/util/textCompletion/ValuesCompletionProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.textCompletion; import com.intellij.codeInsight.completion.*; @@ -127,7 +113,7 @@ public class ValuesCompletionProvider implements TextCompletionProvider { if (handler == null) return builder.withInsertHandler(myInsertHandler); return builder.withInsertHandler(new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { myInsertHandler.handleInsert(context, item); handler.handleInsert(context, item); } @@ -141,7 +127,7 @@ public class ValuesCompletionProvider implements TextCompletionProvider { public class CompletionCharInsertHandler implements InsertHandler { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { context.setAddCompletionChar(mySeparators.contains(context.getCompletionChar())); } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrStatementStartCompletionProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrStatementStartCompletionProvider.java index af0c788d57e0..cee2662bddd9 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrStatementStartCompletionProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrStatementStartCompletionProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion; import com.intellij.codeInsight.TailTypes; @@ -60,7 +46,7 @@ class GrStatementStartCompletionProvider extends CompletionProvider() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { if (context.getCompletionChar() != ' ') { TailTypes.IF_LPARENTH.processTail(context.getEditor(), context.getTailOffset()); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java index 3d8540ec6eed..0951c758410a 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java @@ -1,18 +1,4 @@ -/* - * 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. - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion; import com.intellij.codeInsight.completion.*; @@ -21,6 +7,7 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; @@ -49,7 +36,7 @@ public class GroovyClassNameInsertHandler implements InsertHandler { public static final GroovyInsertHandler INSTANCE = new GroovyInsertHandler(); @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { @NonNls Object obj = item.getObject(); PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovySmartCompletionContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovySmartCompletionContributor.java index 384ef6889339..7ddfd5b61098 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovySmartCompletionContributor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovySmartCompletionContributor.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion; import com.intellij.application.options.CodeStyle; @@ -149,7 +147,7 @@ public class GroovySmartCompletionContributor extends CompletionContributor { final PsiTypeLookupItem item = PsiTypeLookupItem.createLookupItem(type, position, PsiTypeLookupItem.isDiamond(type), ChooseTypeExpression.IMPORT_FIXER).setShowPackage(); item.setInsertHandler(new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.smarttype.casting"); final Editor editor = context.getEditor(); @@ -266,7 +264,7 @@ public class GroovySmartCompletionContributor extends CompletionContributor { if (item.getObject() instanceof PsiClass) { item.setInsertHandler(new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { GroovyCompletionUtil.addImportForItem(context.getFile(), context.getStartOffset(), item); } }); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/QualifiedMethodInsertHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/QualifiedMethodInsertHandler.java index 4e008336df6c..ff57a46e50ad 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/QualifiedMethodInsertHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/QualifiedMethodInsertHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion; import com.intellij.codeInsight.completion.InsertHandler; @@ -21,6 +7,7 @@ import com.intellij.codeInsight.completion.JavaGlobalMemberLookupElement; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.util.PsiTreeUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; class QualifiedMethodInsertHandler implements InsertHandler { @@ -30,7 +17,7 @@ class QualifiedMethodInsertHandler implements InsertHandler } @Override - public void handleInsert(final InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull LookupElement item) { final PsiClassType.ClassResolveResult resolveResult = myClassType.resolveGenerics(); final PsiClass psiClass = resolveResult.getElement(); if (psiClass == null || !psiClass.isValid()) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodOverrideHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodOverrideHandler.java index a1dd12a6f4b9..c9e21ac69702 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodOverrideHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodOverrideHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion.handlers; import com.intellij.codeInsight.completion.InsertHandler; @@ -22,6 +8,7 @@ import com.intellij.codeInsight.generation.OverrideImplementUtil; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiMethod; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -34,7 +21,7 @@ public class GroovyMethodOverrideHandler implements InsertHandler } @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { context.getDocument().deleteString(context.getStartOffset(), context.getTailOffset()); PsiMethod method = (PsiMethod)item.getObject(); List prototypes = OverrideImplementUtil.overrideOrImplementMethod(myPsiClass, method, false); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodSignatureInsertHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodSignatureInsertHandler.java index ec4201fdfdcf..07fe6e94828a 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodSignatureInsertHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/handlers/GroovyMethodSignatureInsertHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion.handlers; import com.intellij.application.options.CodeStyle; @@ -35,6 +21,7 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.TypeConversionUtil; import com.intellij.util.IncorrectOperationException; import com.intellij.util.text.CharArrayUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.GroovyLanguage; import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMemberReference; @@ -45,7 +32,7 @@ public class GroovyMethodSignatureInsertHandler implements InsertHandler private NamedArgumentInsertHandler() {} @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { int tailOffset = context.getTailOffset(); PsiElement argumentList = context.getFile().findElementAt(tailOffset - 1); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java index 48fabbbe480c..41049f9b5d2c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.template.expressions; import com.intellij.codeInsight.completion.InsertHandler; @@ -42,7 +28,7 @@ import java.util.List; public class ChooseTypeExpression extends Expression { public static final InsertHandler IMPORT_FIXER = new InsertHandler() { @Override - public void handleInsert(InsertionContext context, PsiTypeLookupItem item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull PsiTypeLookupItem item) { GroovyCompletionUtil.addImportForItem(context.getFile(), context.getStartOffset(), item); } }; diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxCompletionContributor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxCompletionContributor.java index 8cd999f9734f..400dd12a4747 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxCompletionContributor.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxCompletionContributor.java @@ -59,7 +59,7 @@ public class JavaFxCompletionContributor extends CompletionContributor { public static final JavaFxTagInsertHandler INSTANCE = new JavaFxTagInsertHandler(); @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); final Object object = item.getObject(); if (object instanceof JavaFxClassTagDescriptorBase) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesArtifactIdConverter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesArtifactIdConverter.java index 80ca0cc0eb05..736733676ec3 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesArtifactIdConverter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesArtifactIdConverter.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.dom.converters; import com.intellij.codeInsight.completion.CompletionType; @@ -82,7 +68,7 @@ public class MavenArtifactCoordinatesArtifactIdConverter extends MavenArtifactCo public static final InsertHandler INSTANCE = new MavenArtifactInsertHandler(); @Override - public void handleInsert(final InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull LookupElement item) { if (TemplateManager.getInstance(context.getProject()).getActiveTemplate(context.getEditor()) != null) { return; // Don't brake the template. } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesGroupIdConverter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesGroupIdConverter.java index 7f1301421050..544dce23c9d6 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesGroupIdConverter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/converters/MavenArtifactCoordinatesGroupIdConverter.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.dom.converters; import com.intellij.codeInsight.completion.InsertHandler; @@ -15,6 +16,7 @@ import com.intellij.util.containers.hash.HashSet; import com.intellij.util.xml.ConvertContext; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.DomManager; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.dom.model.MavenDomDependency; import org.jetbrains.idea.maven.indices.MavenProjectIndicesManager; @@ -78,7 +80,7 @@ public class MavenArtifactCoordinatesGroupIdConverter extends MavenArtifactCoord public static final InsertHandler INSTANCE = new MavenGroupIdInsertHandler(); @Override - public void handleInsert(final InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull LookupElement item) { if (TemplateManager.getInstance(context.getProject()).getActiveTemplate(context.getEditor()) != null) { return; // Don't brake the template. } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenDependenciesCompletionProvider.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenDependenciesCompletionProvider.java index 68905ea2c3db..40e1023141dd 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenDependenciesCompletionProvider.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenDependenciesCompletionProvider.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.dom.model.completion; import com.intellij.codeInsight.actions.ReformatCodeProcessor; @@ -70,7 +71,7 @@ public class MavenDependenciesCompletionProvider extends CompletionContributor { public static final InsertHandler INSTANCE = new MavenDependencyInsertHandler(); @Override - public void handleInsert(final InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull LookupElement item) { String s = item.getLookupString(); int idx = s.indexOf(':'); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenPomXmlCompletionTagListenerContributor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenPomXmlCompletionTagListenerContributor.java index 9dc5f2825d6c..5d7a6e101482 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenPomXmlCompletionTagListenerContributor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/model/completion/MavenPomXmlCompletionTagListenerContributor.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.dom.model.completion; import com.google.common.collect.ImmutableSet; @@ -12,7 +13,6 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; -import com.intellij.util.Consumer; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.DomFileDescription; import com.intellij.util.xml.DomManager; @@ -53,7 +53,7 @@ public class MavenPomXmlCompletionTagListenerContributor extends CompletionContr LookupElement decorator = LookupElementDecorator.withInsertHandler(lookupElement, new InsertHandler>() { @Override - public void handleInsert(final InsertionContext context, LookupElementDecorator item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull LookupElementDecorator item) { lookupElement.handleInsert(context); Object object = lookupElement.getObject(); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java index 63cdf10f4030..b7fd1b4b12b6 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.plugins.groovy; import com.intellij.codeInsight.actions.ReformatCodeProcessor; @@ -242,7 +228,7 @@ public class MavenGroovyPomCompletionContributor extends CompletionContributor { private static final InsertHandler INSTANCE = new MavenDependencyInsertHandler(); @Override - public void handleInsert(final InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull LookupElement item) { String s = item.getLookupString(); int idx = s.indexOf(':'); String groupId = s.substring(0, idx); diff --git a/plugins/stats-collector/src/com/intellij/completion/enhancer/UnmatchableLookupElement.kt b/plugins/stats-collector/src/com/intellij/completion/enhancer/UnmatchableLookupElement.kt index e447c4a9dfd7..45e13f87f0b3 100644 --- a/plugins/stats-collector/src/com/intellij/completion/enhancer/UnmatchableLookupElement.kt +++ b/plugins/stats-collector/src/com/intellij/completion/enhancer/UnmatchableLookupElement.kt @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.completion.enhancer @@ -31,7 +17,7 @@ class UnmatchableLookupElement( return original.`object` } - override fun handleInsert(context: InsertionContext?) { + override fun handleInsert(context: InsertionContext) { original.handleInsert(context) } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskAutoCompletionListProvider.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskAutoCompletionListProvider.java index 05d4b7288855..121b349a3d9d 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskAutoCompletionListProvider.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskAutoCompletionListProvider.java @@ -1,18 +1,4 @@ -/* - * 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. - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.tasks.actions; import com.intellij.codeInsight.completion.CompletionParameters; @@ -78,7 +64,7 @@ public class TaskAutoCompletionListProvider extends TextFieldWithAutoCompletionL protected InsertHandler createInsertHandler(@NotNull final Task task) { return new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { Document document = context.getEditor().getDocument(); String s = ((TaskManagerImpl)TaskManager.getManager(context.getProject())).getChangelistName(task); s = StringUtil.convertLineSeparators(s); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java index 582bafc47452..fbd9507beec0 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.tasks.youtrack.lang.codeinsight; import com.intellij.codeInsight.completion.*; @@ -17,7 +18,6 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.util.List; -import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -105,7 +105,7 @@ public class YouTrackCompletionContributor extends CompletionContributor { */ private static class MyInsertHandler implements InsertHandler { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { final CompletionItem completionItem = (CompletionItem)item.getObject(); final Document document = context.getDocument(); final Editor editor = context.getEditor(); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java index 63b96e8a9625..cee9dcd07764 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathInsertHandler.java @@ -15,17 +15,20 @@ */ package org.intellij.lang.xpath.completion; -import com.intellij.codeInsight.completion.*; -import com.intellij.codeInsight.lookup.*; -import com.intellij.openapi.editor.CaretModel; -import com.intellij.openapi.editor.EditorModificationUtil; -import com.intellij.openapi.editor.Editor; +import com.intellij.codeInsight.completion.CompletionInitializationContext; +import com.intellij.codeInsight.completion.InsertHandler; +import com.intellij.codeInsight.completion.InsertionContext; +import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.editor.CaretModel; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.EditorModificationUtil; +import org.jetbrains.annotations.NotNull; class XPathInsertHandler implements InsertHandler { private static final Logger LOG = Logger.getInstance(XPathInsertHandler.class.getName()); - public void handleInsert(InsertionContext context, LookupElement lookupItem) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement lookupItem) { final Object object = lookupItem.getObject(); LOG.debug("object = " + object); diff --git a/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java b/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java index 50d4ec264504..d0cf7ff71c0b 100644 --- a/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java +++ b/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java @@ -1,3 +1,4 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.yaml.completion; import com.intellij.codeInsight.completion.InsertHandler; @@ -24,7 +25,7 @@ public abstract class YamlKeyCompletionInsertHandler im protected abstract YAMLKeyValue createNewEntry(@NotNull YAMLDocument document, T item); @Override - public void handleInsert(InsertionContext context, T item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull T item) { final PsiElement currentElement = context.getFile().findElementAt(context.getStartOffset()); assert currentElement != null : "no element at " + context.getStartOffset(); diff --git a/python/src/com/jetbrains/python/codeInsight/PyUnindentingInsertHandler.java b/python/src/com/jetbrains/python/codeInsight/PyUnindentingInsertHandler.java index a4aa9e3cddb2..7dd4c8a12f85 100644 --- a/python/src/com/jetbrains/python/codeInsight/PyUnindentingInsertHandler.java +++ b/python/src/com/jetbrains/python/codeInsight/PyUnindentingInsertHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python.codeInsight; import com.intellij.codeInsight.completion.InsertHandler; @@ -29,6 +15,7 @@ import com.jetbrains.python.PyNames; import com.jetbrains.python.codeInsight.completion.PythonLookupElement; import com.jetbrains.python.psi.PyStatementWithElse; import com.jetbrains.python.psi.PyTryExceptStatement; +import org.jetbrains.annotations.NotNull; /** * Adjusts indentation after a final part keyword is inserted, e.g. an "else:". @@ -40,7 +27,7 @@ public class PyUnindentingInsertHandler implements InsertHandler { private PyClassInsertHandler() { } - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); if (context.getCompletionChar() == '(') { diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java index d34326db184c..c57228b3c3ee 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java +++ b/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python.codeInsight.completion; import com.intellij.codeInsight.completion.*; @@ -191,7 +191,7 @@ public class PyDictKeyNamesCompletionContributor extends CompletionContributor { if (addHandler) { item = item.withInsertHandler(new InsertHandler() { @Override - public void handleInsert(final InsertionContext context, final LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull final LookupElement item) { final PyStringLiteralExpression str = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PyStringLiteralExpression.class, false); if (str != null) { diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PythonLookupElement.java b/python/src/com/jetbrains/python/codeInsight/completion/PythonLookupElement.java index 9819f3ac2bea..85d4ab54275a 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PythonLookupElement.java +++ b/python/src/com/jetbrains/python/codeInsight/completion/PythonLookupElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python.codeInsight.completion; import com.intellij.codeInsight.completion.BasicInsertHandler; @@ -96,7 +82,7 @@ public class PythonLookupElement extends LookupElement implements Comparable() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); int offset = context.getStartOffset(); diff --git a/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java b/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java index 3c3612c54bfc..45e8d7d9b0d6 100644 --- a/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java +++ b/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python.psi.impl.references; import com.intellij.codeInsight.completion.CompletionUtil; @@ -312,7 +298,7 @@ public class PyImportReference extends PyReferenceImpl { private static final String IMPORT_KWD = " import "; - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); int tailOffset = context.getTailOffset(); diff --git a/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionContributor.java b/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionContributor.java index 38a3da153b89..6224e446a313 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionContributor.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionContributor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; @@ -39,7 +25,7 @@ public class DtdCompletionContributor extends CompletionContributor { private static final InsertHandler INSERT_HANDLER = new BasicInsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); if (item.getObject().toString().startsWith(" { } @Override - public void handleInsert(final InsertionContext context, final LookupElement item) { + public void handleInsert(@NotNull final InsertionContext context, @NotNull final LookupElement item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlClosingTagInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlClosingTagInsertHandler.java index c8088a41209d..e323f1bbf3bf 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlClosingTagInsertHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlClosingTagInsertHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; @@ -22,6 +8,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.codeStyle.CodeStyleManager; +import org.jetbrains.annotations.NotNull; public class XmlClosingTagInsertHandler implements InsertHandler { public final static XmlClosingTagInsertHandler INSTANCE = new XmlClosingTagInsertHandler(); @@ -29,7 +16,7 @@ public class XmlClosingTagInsertHandler implements InsertHandler private XmlClosingTagInsertHandler(){} @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { Editor editor = context.getEditor(); Document document = editor.getDocument(); Project project = context.getProject(); diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java index d19e953c6480..91cac5b711b6 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java @@ -58,7 +58,7 @@ public class XmlCompletionContributor extends CompletionContributor { @NonNls public static final String TAG_NAME_COMPLETION_FEATURE = "tag.name.completion"; private static final InsertHandlerDecorator QUOTE_EATER = new InsertHandlerDecorator() { @Override - public void handleInsert(InsertionContext context, LookupElementDecorator item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElementDecorator item) { final char completionChar = context.getCompletionChar(); if (completionChar == '\'' || completionChar == '\"') { context.setAddCompletionChar(false); @@ -368,7 +368,7 @@ public class XmlCompletionContributor extends CompletionContributor { private static class EntityRefInsertHandler extends BasicInsertHandler { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); context.setAddCompletionChar(false); Editor editor = context.getEditor(); diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java index b7c84c3f5970..b20ad3fc5b53 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java @@ -55,7 +55,7 @@ public class XmlTagInsertHandler implements InsertHandler { public static final XmlTagInsertHandler INSTANCE = new XmlTagInsertHandler(); @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { Project project = context.getProject(); Editor editor = context.getEditor(); Document document = InjectedLanguageUtil.getTopLevelEditor(editor).getDocument(); diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java b/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java index d79df580ea98..f60bcf642682 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.xml; import com.intellij.codeInsight.AutoPopupController; @@ -115,7 +101,7 @@ public class DefaultXmlTagNameProvider implements XmlTagNameProvider { elements.add(LookupElementBuilder.create("?xml version=\"1.0\" encoding=\"\" ?>").withPresentableText("").withInsertHandler( new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { int offset = context.getEditor().getCaretModel().getOffset(); context.getEditor().getCaretModel().moveToOffset(offset - 4); AutoPopupController.getInstance(context.getProject()).scheduleAutoPopup(context.getEditor()); @@ -136,7 +122,7 @@ public class DefaultXmlTagNameProvider implements XmlTagNameProvider { for (String s : tags) { elements.add(LookupElementBuilder.create(s).withTypeText(ns).withInsertHandler(new XmlTagInsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { final Editor editor = context.getEditor(); final Document document = context.getDocument(); final int caretOffset = editor.getCaretModel().getOffset(); diff --git a/xml/impl/src/com/intellij/xml/util/UserColorLookup.java b/xml/impl/src/com/intellij/xml/util/UserColorLookup.java index 5ccf637721d1..e6237847fea9 100644 --- a/xml/impl/src/com/intellij/xml/util/UserColorLookup.java +++ b/xml/impl/src/com/intellij/xml/util/UserColorLookup.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.xml.util; import com.intellij.codeInsight.completion.InsertHandler; @@ -60,7 +46,7 @@ public class UserColorLookup extends LookupElementDecorator { super(PrioritizedLookupElement.withPriority(LookupElementBuilder.create(COLOR_STRING).withInsertHandler( new InsertHandler() { @Override - public void handleInsert(InsertionContext context, LookupElement item) { + public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { handleUserSelection(context, colorToStringConverter); } }), priority));