[completion] IJPL-207762 nullability for LookupElement

GitOrigin-RevId: 31357e8a2d4e661cbc91a5642fe689cd3179a7e5
This commit is contained in:
Max Medvedev
2025-10-12 11:39:37 +00:00
committed by intellij-monorepo-bot
parent 27a2d0c1b9
commit 6ef13aa11e
16 changed files with 29 additions and 29 deletions
@@ -40,7 +40,7 @@ public class ChainCompletionNewVariableLookupElement extends LookupElement {
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return AutoCompletionPolicy.NEVER_AUTOCOMPLETE;
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.compiler.chainsSearch.completion.lookup;
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
@@ -20,7 +20,7 @@ public final class JavaRelevantChainLookupElement extends LookupElementDecorator
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return AutoCompletionPolicy.NEVER_AUTOCOMPLETE;
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.completion;
import com.intellij.application.options.CodeStyle;
@@ -45,7 +45,7 @@ public class JavaChainLookupElement extends LookupElementDecorator<LookupElement
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
return Set.of(getLookupString());
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer;
@@ -53,7 +53,7 @@ public class JavaGlobalMemberLookupElement extends LookupElement implements Stat
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
return JavaCompletionUtil.getAllLookupStrings(getObject());
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.completion;
import com.intellij.application.options.CodeStyle;
@@ -80,7 +80,7 @@ public class JavaPsiClassReferenceElement extends LookupItem<Object> implements
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
if (myForcedPresentableName != null) {
return Collections.singleton(myForcedPresentableName);
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.LookupElement;
@@ -89,7 +89,7 @@ public final class MethodTags {
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
Set<String> all = new HashSet<>(super.getAllLookupStrings());
all.addAll(myTags);
return all;
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.completion;
import com.intellij.application.options.CodeStyle;
@@ -236,7 +236,7 @@ final class StreamConversion {
}
@Override
public @Unmodifiable Set<String> getAllLookupStrings() {
public @Unmodifiable @NotNull Set<String> getAllLookupStrings() {
return ContainerUtil.newHashSet(myLookupString, myMethodName);
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.lookup;
import com.intellij.codeInsight.completion.InsertionContext;
@@ -86,7 +86,7 @@ public class ExpressionLookupItem extends LookupElement implements TypedLookupIt
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
return myAllLookupStrings;
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.lookup;
import com.intellij.psi.PsiElement;
@@ -27,7 +27,7 @@ public class KeywordLookupItem extends LookupElement implements TypedLookupItem
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE;
}
@@ -48,7 +48,7 @@ public enum AutoCompletionPolicy {
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return myPolicy;
}
}
@@ -45,7 +45,7 @@ public abstract class LookupElement extends UserDataHolderBase {
* The returned set must contain {@link #getLookupString()}.
* @see #isCaseSensitive()
*/
public @Unmodifiable Set<String> getAllLookupStrings() {
public @Unmodifiable @NotNull Set<String> getAllLookupStrings() {
return Collections.singleton(getLookupString());
}
@@ -117,7 +117,7 @@ public abstract class LookupElement extends UserDataHolderBase {
/**
* @return the policy determining the auto-insertion behavior when this is the only matching item produced by completion contributors
*/
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return AutoCompletionPolicy.SETTINGS_DEPENDENT;
}
@@ -43,7 +43,7 @@ public abstract class LookupElementDecorator<T extends LookupElement> extends Lo
}
@Override
public @Unmodifiable Set<String> getAllLookupStrings() {
public @Unmodifiable @NotNull Set<String> getAllLookupStrings() {
return myDelegate.getAllLookupStrings();
}
@@ -82,7 +82,7 @@ public abstract class LookupElementDecorator<T extends LookupElement> extends Lo
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return myDelegate.getAutoCompletionPolicy();
}
@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.lookup;
@@ -243,7 +243,7 @@ public class LookupItem<T> extends MutableLookupElement implements Comparable<Lo
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return myAutoCompletionPolicy;
}
@@ -282,7 +282,7 @@ public class LookupItem<T> extends MutableLookupElement implements Comparable<Lo
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
return myAllLookupStrings;
}
@@ -163,7 +163,7 @@ public final class ListTemplatesHandler implements CodeInsightActionHandler {
private static LiveTemplateLookupElement createTemplateElement(final TemplateImpl template) {
return new LiveTemplateLookupElementImpl(template, false) {
@Override
public @Unmodifiable Set<String> getAllLookupStrings() {
public @Unmodifiable @NotNull Set<String> getAllLookupStrings() {
String description = template.getDescription();
if (description == null) {
return super.getAllLookupStrings();
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.template.impl;
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
@@ -39,7 +39,7 @@ public abstract class LiveTemplateLookupElement extends LookupElement {
}
@Override
public AutoCompletionPolicy getAutoCompletionPolicy() {
public @NotNull AutoCompletionPolicy getAutoCompletionPolicy() {
return AutoCompletionPolicy.NEVER_AUTOCOMPLETE;
}
@@ -113,7 +113,7 @@ public final class PyKeywordPatternReference extends PsiReferenceBase.Poly<PyKey
}
@Override
public Set<String> getAllLookupStrings() {
public @NotNull Set<String> getAllLookupStrings() {
return Collections.singleton(getLookupString());
}