add a couple of @NotNull annotations

This commit is contained in:
Max Medvedev
2018-07-24 12:15:31 +03:00
parent eced1c17c1
commit 3a588ce4ff
2 changed files with 11 additions and 22 deletions
@@ -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.tree;
@@ -442,12 +428,12 @@ public class TreeUtil {
}
@Nullable
public static ASTNode skipWhitespaceAndComments(final ASTNode node, boolean forward) {
public static ASTNode skipWhitespaceAndComments(@Nullable ASTNode node, boolean forward) {
return skipWhitespaceCommentsAndTokens(node, TokenSet.EMPTY, forward);
}
@Nullable
public static ASTNode skipWhitespaceCommentsAndTokens(final ASTNode node, @NotNull TokenSet alsoSkip, boolean forward) {
public static ASTNode skipWhitespaceCommentsAndTokens(@Nullable ASTNode node, @NotNull TokenSet alsoSkip, boolean forward) {
ASTNode element = node;
while (true) {
if (element == null) return null;
@@ -457,7 +443,7 @@ public class TreeUtil {
return element;
}
public static boolean isWhitespaceOrComment(ASTNode element) {
public static boolean isWhitespaceOrComment(@NotNull ASTNode element) {
return element.getPsi() instanceof PsiWhiteSpace || element.getPsi() instanceof PsiComment;
}
}
@@ -66,7 +66,8 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect
return 0;
}
public static List<TextRange> expandToWholeLine(CharSequence text, @Nullable TextRange range, boolean isSymmetric) {
@NotNull
public static List<TextRange> expandToWholeLine(@NotNull CharSequence text, @Nullable TextRange range, boolean isSymmetric) {
List<TextRange> result = new ArrayList<>();
if (range == null) {
@@ -88,7 +89,7 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect
}
@Nullable
private static TextRange getExpandedRange(CharSequence text, TextRange range, boolean isSymmetric) {
private static TextRange getExpandedRange(@NotNull CharSequence text, @NotNull TextRange range, boolean isSymmetric) {
int startOffset = range.getStartOffset();
int endOffset = range.getEndOffset();
int index1 = CharArrayUtil.shiftBackward(text, startOffset - 1, " \t");
@@ -128,7 +129,8 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect
return null;
}
public static List<TextRange> expandToWholeLinesWithBlanks(CharSequence text, TextRange range) {
@NotNull
public static List<TextRange> expandToWholeLinesWithBlanks(@NotNull CharSequence text, @NotNull TextRange range) {
List<TextRange> result = ContainerUtil.newArrayList();
result.addAll(expandToWholeLine(text, range, true));
@@ -158,7 +160,8 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect
return result;
}
public static List<TextRange> expandToWholeLine(CharSequence text, TextRange range) {
@NotNull
public static List<TextRange> expandToWholeLine(@NotNull CharSequence text, @Nullable TextRange range) {
return expandToWholeLine(text, range, true);
}
}