From e033b6206b49d87fb759e240d727138039f18e2b Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Tue, 6 Nov 2018 16:41:32 +0300 Subject: [PATCH] add @NotNull to parameter of ElementClassHint#shouldProcess(DeclarationKind) --- .../context/ChainCompletionContext.java | 2 +- .../completion/JavaCompletionUtil.java | 2 +- .../scope/JavaCompletionProcessor.java | 4 ++-- .../completion/proc/VariablesProcessor.java | 4 ++-- .../resolve/ClassResolverProcessor.java | 4 ++-- .../resolve/SymbolCollectingProcessor.java | 4 ++-- .../resolve/VariableResolverProcessor.java | 6 ++---- .../intellij/psi/scope/ElementClassHint.java | 19 +++---------------- .../processor/MethodResolveProcessor.java | 4 ++-- .../psi/scope/processor/MethodsProcessor.java | 18 ++---------------- .../scope/processor/VariablesProcessor.java | 4 ++-- ...roovyConstructorNamedArgumentProvider.java | 4 ++-- .../groovy/lang/resolve/caches/fileCache.kt | 4 ++-- .../processors/GrScopeProcessorWithHints.java | 18 ++---------------- .../processors/GroovyResolverProcessor.java | 2 +- 15 files changed, 28 insertions(+), 71 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java index 5a84f6b7a390..868b6e2fef38 100644 --- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java +++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java @@ -232,7 +232,7 @@ public class ChainCompletionContext { } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.ENUM_CONST || kind == DeclarationKind.FIELD || kind == DeclarationKind.METHOD || 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 b588734dce77..77e8dbaaf915 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java @@ -207,7 +207,7 @@ public class JavaCompletionUtil { } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return member instanceof PsiEnumConstant ? kind == DeclarationKind.ENUM_CONST : member instanceof PsiField ? kind == DeclarationKind.FIELD : kind == DeclarationKind.METHOD; diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java index 4530aeb1a279..05e38b444487 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.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.scope; import com.intellij.codeInspection.SuppressManager; @@ -278,7 +278,7 @@ public class JavaCompletionProcessor implements PsiScopeProcessor, ElementClassH } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { switch (kind) { case CLASS: return myFilter.isClassAcceptable(PsiClass.class); diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java index 9bdf4e60626c..3fcef0a18eae 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.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.proc; @@ -38,7 +38,7 @@ public class VariablesProcessor implements PsiScopeProcessor, ElementClassHint{ } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.VARIABLE || kind == DeclarationKind.FIELD || kind == DeclarationKind.ENUM_CONST; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java index 583892772e60..8fe4ff0edcbf 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.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.psi.impl.source.resolve; import com.intellij.openapi.diagnostic.Logger; @@ -82,7 +82,7 @@ public class ClassResolverProcessor implements PsiScopeProcessor, NameHint, Elem } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.CLASS; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java index debf5b7f798c..fc2af21540b6 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.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.psi.impl.source.resolve; import com.intellij.openapi.util.Key; @@ -48,7 +48,7 @@ public class SymbolCollectingProcessor implements PsiScopeProcessor, ElementClas } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.CLASS || kind == DeclarationKind.PACKAGE || kind == DeclarationKind.METHOD || kind == DeclarationKind.FIELD; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java index 7f3a730193da..7caa8e8064a3 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.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.psi.impl.source.resolve; import com.intellij.openapi.util.Key; @@ -92,7 +90,7 @@ public class VariableResolverProcessor extends ConflictFilterProcessor implement @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.VARIABLE || kind == DeclarationKind.FIELD || kind == DeclarationKind.ENUM_CONST; } diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/ElementClassHint.java b/java/java-psi-impl/src/com/intellij/psi/scope/ElementClassHint.java index b25dc262028e..930349423679 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/ElementClassHint.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/ElementClassHint.java @@ -1,21 +1,8 @@ -/* - * 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.scope; import com.intellij.openapi.util.Key; +import org.jetbrains.annotations.NotNull; public interface ElementClassHint { Key KEY = Key.create("ElementClassHint"); @@ -29,5 +16,5 @@ public interface ElementClassHint { ENUM_CONST } - boolean shouldProcess(DeclarationKind kind); + boolean shouldProcess(@NotNull DeclarationKind kind); } diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java index b85772a802fd..7d27023f7c6b 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.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.psi.scope.processor; @@ -57,7 +57,7 @@ public class MethodResolveProcessor implements PsiScopeProcessor, ElementClassHi } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.METHOD; } diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java index 0a7bb80f32db..f7d4e121b1db 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.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.scope.processor; import com.intellij.openapi.util.Key; @@ -117,7 +103,7 @@ public abstract class MethodsProcessor extends ConflictFilterProcessor implement } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.METHOD; } } diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.java index ef0fb950abf4..284d6350cd07 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.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.psi.scope.processor; import com.intellij.openapi.util.Key; @@ -33,7 +33,7 @@ public abstract class VariablesProcessor implements PsiScopeProcessor, ElementCl protected abstract boolean check(PsiVariable var, ResolveState state); @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return kind == DeclarationKind.VARIABLE || kind == DeclarationKind.FIELD || kind == DeclarationKind.ENUM_CONST; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyConstructorNamedArgumentProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyConstructorNamedArgumentProvider.java index 74f47f5daa6d..22a70ae5d18f 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyConstructorNamedArgumentProvider.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyConstructorNamedArgumentProvider.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 org.jetbrains.plugins.groovy.lang; import com.intellij.openapi.util.Key; @@ -198,7 +198,7 @@ public abstract class GroovyConstructorNamedArgumentProvider extends GroovyNamed } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { return myResolveTargetKinds.contains(kind); } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/caches/fileCache.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/caches/fileCache.kt index 30e5bd744769..c30fe2e7dfb5 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/caches/fileCache.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/caches/fileCache.kt @@ -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 org.jetbrains.plugins.groovy.lang.resolve.caches import com.intellij.openapi.util.Key @@ -38,7 +38,7 @@ class FileCacheBuilderProcessor(private val annotationResolve: Boolean) : PsiSco override fun isAnnotationResolve(): Boolean = annotationResolve - override fun shouldProcess(kind: ElementClassHint.DeclarationKind?): Boolean { + override fun shouldProcess(kind: ElementClassHint.DeclarationKind): Boolean { return !annotationResolve || kind === ElementClassHint.DeclarationKind.CLASS } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GrScopeProcessorWithHints.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GrScopeProcessorWithHints.java index c083f2c18f4a..3840231ef63d 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GrScopeProcessorWithHints.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GrScopeProcessorWithHints.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.resolve.processors; import com.intellij.openapi.util.Key; @@ -50,7 +36,7 @@ public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, Na } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { assert myResolveTargetKinds != null : "don't invoke shouldProcess if resolveTargets are not declared"; return myResolveTargetKinds.contains(kind); } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GroovyResolverProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GroovyResolverProcessor.java index 5697640552f0..20a70376b96c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GroovyResolverProcessor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/GroovyResolverProcessor.java @@ -157,7 +157,7 @@ public abstract class GroovyResolverProcessor implements PsiScopeProcessor, Elem } @Override - public boolean shouldProcess(DeclarationKind kind) { + public boolean shouldProcess(@NotNull DeclarationKind kind) { if (kind == DeclarationKind.METHOD) { if (myStopExecutingMethods) return false; if (isPropertyResolve() && !myAcceptableKinds.contains(GroovyResolveKind.METHOD)) return false;