diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java index dfd17fc47728..9b3ece54e05b 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.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.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; } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java index 81ea83c8f338..05f1bf395731 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java @@ -66,7 +66,8 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect return 0; } - public static List expandToWholeLine(CharSequence text, @Nullable TextRange range, boolean isSymmetric) { + @NotNull + public static List expandToWholeLine(@NotNull CharSequence text, @Nullable TextRange range, boolean isSymmetric) { List 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 expandToWholeLinesWithBlanks(CharSequence text, TextRange range) { + @NotNull + public static List expandToWholeLinesWithBlanks(@NotNull CharSequence text, @NotNull TextRange range) { List result = ContainerUtil.newArrayList(); result.addAll(expandToWholeLine(text, range, true)); @@ -158,7 +160,8 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect return result; } - public static List expandToWholeLine(CharSequence text, TextRange range) { + @NotNull + public static List expandToWholeLine(@NotNull CharSequence text, @Nullable TextRange range) { return expandToWholeLine(text, range, true); } } \ No newline at end of file