From 4a18a8be0d0a8c33e6bd6ff27353b5ff93c0f653 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 26 Apr 2016 18:01:07 +0300 Subject: [PATCH] notNull --- .../psi/stubs/PsiClassHolderFileStub.java | 4 ++- .../impl/java/stubs/JavaClassElementType.java | 4 +-- .../java/stubs/impl/PsiJavaFileStubImpl.java | 3 ++ .../psi/stubs/BinaryFileStubBuilder.java | 5 ++-- .../intellij/psi/stubs/IStubElementType.java | 4 +-- .../intellij/psi/stubs/ObjectStubBase.java | 3 +- .../com/intellij/psi/stubs/PsiFileStub.java | 3 +- .../src/com/intellij/psi/stubs/Stub.java | 6 ++-- .../src/com/intellij/psi/stubs/StubBase.java | 6 +++- .../com/intellij/psi/stubs/StubElement.java | 6 +++- .../com/intellij/psi/stubs/StubIndexKey.java | 6 ++-- .../intellij/psi/stubs/StubOutputStream.java | 9 ++++-- .../psi/stubs/StubSerializationUtil.java | 6 ++-- .../src/com/intellij/util/indexing/ID.java | 6 ++-- .../extapi/psi/StubBasedPsiElementBase.java | 29 ++++++++++++------- .../psi/impl/source/tree/SharedImplUtil.java | 5 ++-- .../intellij/psi/stubs/PsiFileStubImpl.java | 3 +- .../groovy/lang/psi/stubs/GrFileStub.java | 4 ++- .../python/psi/impl/stubs/PyFileStubImpl.java | 4 ++- .../util/xml/stubs/AttributeStub.java | 4 ++- .../com/intellij/util/xml/stubs/DomStub.java | 3 +- .../intellij/util/xml/stubs/ElementStub.java | 3 +- .../xml/stubs/builder/DomStubBuilder.java | 5 ++-- 23 files changed, 87 insertions(+), 44 deletions(-) diff --git a/java/java-psi-api/src/com/intellij/psi/stubs/PsiClassHolderFileStub.java b/java/java-psi-api/src/com/intellij/psi/stubs/PsiClassHolderFileStub.java index 85ec57b3cda4..6d47d6e4ed49 100644 --- a/java/java-psi-api/src/com/intellij/psi/stubs/PsiClassHolderFileStub.java +++ b/java/java-psi-api/src/com/intellij/psi/stubs/PsiClassHolderFileStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -17,10 +17,12 @@ package com.intellij.psi.stubs; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; /** * @author ilyas */ public interface PsiClassHolderFileStub extends PsiFileStub { + @NotNull PsiClass[] getClasses(); } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaClassElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaClassElementType.java index a389245410df..d461809ed4cf 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaClassElementType.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaClassElementType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -208,7 +208,7 @@ public abstract class JavaClassElementType extends JavaStubElementType implements this(null, StringRef.fromString(packageName), compiled); } + @NotNull @Override public IStubFileElementType getType() { return JavaStubElementTypes.JAVA_FILE; } + @NotNull @Override public PsiClass[] getClasses() { return getChildrenByType(JavaStubElementTypes.CLASS, PsiClass.ARRAY_FACTORY); diff --git a/platform/core-api/src/com/intellij/psi/stubs/BinaryFileStubBuilder.java b/platform/core-api/src/com/intellij/psi/stubs/BinaryFileStubBuilder.java index 39143134ec79..7ce6869fd90d 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/BinaryFileStubBuilder.java +++ b/platform/core-api/src/com/intellij/psi/stubs/BinaryFileStubBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -21,13 +21,14 @@ package com.intellij.psi.stubs; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.indexing.FileContent; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @see com.intellij.psi.stubs.BinaryFileStubBuilders#EXTENSION_POINT_NAME */ public interface BinaryFileStubBuilder { - boolean acceptsFile(VirtualFile file); + boolean acceptsFile(@NotNull VirtualFile file); @Nullable Stub buildStubTree(FileContent fileContent); diff --git a/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java b/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java index a03fb0c5f9b8..635b47d72ed9 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java +++ b/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -40,7 +40,7 @@ public abstract class IStubElementType extends UserDataHolderBase myParent = parent; } + @Override public T getParentStub() { return myParent; } diff --git a/platform/core-api/src/com/intellij/psi/stubs/PsiFileStub.java b/platform/core-api/src/com/intellij/psi/stubs/PsiFileStub.java index b53e63047461..59dee07f858b 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/PsiFileStub.java +++ b/platform/core-api/src/com/intellij/psi/stubs/PsiFileStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable; public interface PsiFileStub extends StubElement, UserDataHolder { PsiFileStub[] EMPTY_ARRAY = new PsiFileStub[0]; + @NotNull StubFileElementType getType(); @NotNull diff --git a/platform/core-api/src/com/intellij/psi/stubs/Stub.java b/platform/core-api/src/com/intellij/psi/stubs/Stub.java index 71471c4bfcd9..b60f48bdbef2 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/Stub.java +++ b/platform/core-api/src/com/intellij/psi/stubs/Stub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -15,6 +15,8 @@ */ package com.intellij.psi.stubs; +import org.jetbrains.annotations.NotNull; + import java.util.List; /** @@ -22,8 +24,8 @@ import java.util.List; * Date: 8/2/12 */ public interface Stub { - Stub getParentStub(); + @NotNull List getChildrenStubs(); ObjectStubSerializer getStubType(); diff --git a/platform/core-api/src/com/intellij/psi/stubs/StubBase.java b/platform/core-api/src/com/intellij/psi/stubs/StubBase.java index 33363411b243..c59265a4f91b 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/StubBase.java +++ b/platform/core-api/src/com/intellij/psi/stubs/StubBase.java @@ -64,7 +64,7 @@ public abstract class StubBase extends ObjectStubBase StubElement

findChildStubByType(final IStubElementType elementType) { + public

StubElement

findChildStubByType(@NotNull final IStubElementType elementType) { final List childrenStubs = getChildrenStubs(); final int size = childrenStubs.size(); @@ -102,6 +102,7 @@ public abstract class StubBase extends ObjectStubBase E[] getChildrenByType(@NotNull final IElementType elementType, E[] array) { final int count = countChildren(elementType); @@ -113,6 +114,7 @@ public abstract class StubBase extends ObjectStubBase E[] getChildrenByType(@NotNull final TokenSet filter, E[] array) { final int count = countChildren(filter); @@ -124,6 +126,7 @@ public abstract class StubBase extends ObjectStubBase E[] getChildrenByType(@NotNull final IElementType elementType, @NotNull final ArrayFactory f) { int count = countChildren(elementType); @@ -182,6 +185,7 @@ public abstract class StubBase extends ObjectStubBase E[] getChildrenByType(@NotNull final TokenSet filter, @NotNull final ArrayFactory f) { final int count = countChildren(filter); diff --git a/platform/core-api/src/com/intellij/psi/stubs/StubElement.java b/platform/core-api/src/com/intellij/psi/stubs/StubElement.java index 87f113476e54..cbb3e01c45be 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/StubElement.java +++ b/platform/core-api/src/com/intellij/psi/stubs/StubElement.java @@ -38,14 +38,18 @@ public interface StubElement extends Stub { List getChildrenStubs(); @Nullable -

StubElement

findChildStubByType(IStubElementType elementType); +

StubElement

findChildStubByType(@NotNull IStubElementType elementType); T getPsi(); + @NotNull E[] getChildrenByType(@NotNull IElementType elementType, final E[] array); + @NotNull E[] getChildrenByType(@NotNull TokenSet filter, final E[] array); + @NotNull E[] getChildrenByType(@NotNull IElementType elementType, @NotNull ArrayFactory f); + @NotNull E[] getChildrenByType(@NotNull TokenSet filter, @NotNull ArrayFactory f); @Nullable diff --git a/platform/core-api/src/com/intellij/psi/stubs/StubIndexKey.java b/platform/core-api/src/com/intellij/psi/stubs/StubIndexKey.java index 1af1b18b41cd..ee09c7250c0f 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/StubIndexKey.java +++ b/platform/core-api/src/com/intellij/psi/stubs/StubIndexKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -22,13 +22,15 @@ package com.intellij.psi.stubs; import com.intellij.psi.PsiElement; import com.intellij.util.indexing.ID; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; public final class StubIndexKey extends ID { private StubIndexKey(@NonNls String name) { super(name); } - public static synchronized StubIndexKey createIndexKey(@NonNls String name) { + @NotNull + public static synchronized StubIndexKey createIndexKey(@NonNls @NotNull String name) { return new StubIndexKey(name); } diff --git a/platform/core-api/src/com/intellij/psi/stubs/StubOutputStream.java b/platform/core-api/src/com/intellij/psi/stubs/StubOutputStream.java index b7cc20789df1..79fca29c3be6 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/StubOutputStream.java +++ b/platform/core-api/src/com/intellij/psi/stubs/StubOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -15,7 +15,10 @@ */ package com.intellij.psi.stubs; -import com.intellij.util.io.*; +import com.intellij.util.io.AbstractStringEnumerator; +import com.intellij.util.io.DataInputOutputUtil; +import com.intellij.util.io.DataOutputStream; +import com.intellij.util.io.IOUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,7 +32,7 @@ public class StubOutputStream extends DataOutputStream { private final AbstractStringEnumerator myNameStorage; private final byte[] myStringIOBuffer = IOUtil.allocReadWriteUTFBuffer(); - public StubOutputStream(OutputStream out, AbstractStringEnumerator nameStorage) { + public StubOutputStream(@NotNull OutputStream out, @NotNull AbstractStringEnumerator nameStorage) { super(out); myNameStorage = nameStorage; } diff --git a/platform/core-api/src/com/intellij/psi/stubs/StubSerializationUtil.java b/platform/core-api/src/com/intellij/psi/stubs/StubSerializationUtil.java index 33611d9c0e3b..7e16ff57f894 100644 --- a/platform/core-api/src/com/intellij/psi/stubs/StubSerializationUtil.java +++ b/platform/core-api/src/com/intellij/psi/stubs/StubSerializationUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -15,13 +15,15 @@ */ package com.intellij.psi.stubs; +import org.jetbrains.annotations.NotNull; + /** * Author: dmitrylomov */ public abstract class StubSerializationUtil { private StubSerializationUtil() {} - public static ObjectStubSerializer getSerializer(Stub rootStub) { + public static ObjectStubSerializer getSerializer(@NotNull Stub rootStub) { if (rootStub instanceof PsiFileStub) { final PsiFileStub fileStub = (PsiFileStub)rootStub; return fileStub.getType(); diff --git a/platform/core-api/src/com/intellij/util/indexing/ID.java b/platform/core-api/src/com/intellij/util/indexing/ID.java index 77ba1ee983e3..8435c15ccdb3 100644 --- a/platform/core-api/src/com/intellij/util/indexing/ID.java +++ b/platform/core-api/src/com/intellij/util/indexing/ID.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -33,7 +33,7 @@ import java.io.*; public class ID { private static final TIntObjectHashMap ourRegistry = new TIntObjectHashMap(); private static final TObjectIntHashMap ourNameToIdRegistry = new TObjectIntHashMap(); - public static final int MAX_NUMBER_OF_INDICES = Short.MAX_VALUE; + static final int MAX_NUMBER_OF_INDICES = Short.MAX_VALUE; private final String myName; private final short myUniqueId; @@ -119,7 +119,7 @@ public class ID { } } - public static ID create(@NonNls String name) { + public static ID create(@NonNls @NotNull String name) { final ID found = findByName(name); return found != null ? found : new ID(name); } diff --git a/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java b/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java index b3e5a4623105..73f868cc4eeb 100644 --- a/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java +++ b/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java @@ -138,7 +138,7 @@ public class StubBasedPsiElementBase extends ASTDelegateP return node; } - private ASTNode failedToBindStubToAst(PsiFileImpl file, FileElement fileElement) { + private ASTNode failedToBindStubToAst(@NotNull PsiFileImpl file, @NotNull FileElement fileElement) { VirtualFile vFile = file.getVirtualFile(); StubTree stubTree = file.getStubTree(); String stubString = stubTree != null ? ((PsiFileStubImpl)stubTree.getRoot()).printTree() : "is null"; @@ -159,7 +159,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP throw new IllegalArgumentException(message); } - private String dumpCreationTraces(FileElement fileElement) { + @NotNull + private String dumpCreationTraces(@NotNull FileElement fileElement) { final StringBuilder traces = new StringBuilder("\nNow " + Thread.currentThread() + "\n"); traces.append("My creation trace:\n").append(getUserData(CREATION_TRACE)); traces.append("AST creation traces:\n"); @@ -180,7 +181,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP return traces.toString(); } - private ASTNode notBoundInExistingAst(PsiFileImpl file, FileElement treeElement) { + @SuppressWarnings({"NonConstantStringShouldBeStringBuffer", "StringConcatenationInLoop"}) + private ASTNode notBoundInExistingAst(@NotNull PsiFileImpl file, @NotNull FileElement treeElement) { String message = "file=" + file + "; tree=" + treeElement; PsiElement each = this; while (each != null) { @@ -188,7 +190,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP if (each instanceof StubBasedPsiElementBase) { message += "; node=" + ((StubBasedPsiElementBase)each).myNode + "; stub=" + ((StubBasedPsiElementBase)each).myStub; each = ((StubBasedPsiElementBase)each).getParentByStub(); - } else { + } + else { if (each instanceof PsiFile) { message += "; same file=" + (each == file) + "; current tree= " + file.getTreeElement() + "; stubTree=" + file.getStubTree() + "; physical=" + file.isPhysical(); } @@ -383,7 +386,7 @@ public class StubBasedPsiElementBase extends ASTDelegateP * @return a child of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ @Nullable - public Psi getStubOrPsiChild(final IStubElementType elementType) { + public Psi getStubOrPsiChild(@NotNull IStubElementType elementType) { T stub = myStub; if (stub != null) { //noinspection unchecked @@ -406,7 +409,7 @@ public class StubBasedPsiElementBase extends ASTDelegateP * @return a not-null child of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ @NotNull - public Psi getRequiredStubOrPsiChild(final IStubElementType elementType) { + public Psi getRequiredStubOrPsiChild(@NotNull IStubElementType elementType) { Psi result = getStubOrPsiChild(elementType); assert result != null: "Missing required child of type " + elementType + "; tree: "+DebugUtil.psiToString(this, false); return result; @@ -415,7 +418,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP /** * @return children of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ - public Psi[] getStubOrPsiChildren(final IStubElementType elementType, Psi[] array) { + @NotNull + public Psi[] getStubOrPsiChildren(@NotNull IStubElementType elementType, @NotNull Psi[] array) { T stub = myStub; if (stub != null) { //noinspection unchecked @@ -436,7 +440,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP /** * @return children of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ - public Psi[] getStubOrPsiChildren(final IStubElementType elementType, ArrayFactory f) { + @NotNull + public Psi[] getStubOrPsiChildren(@NotNull IStubElementType elementType, @NotNull ArrayFactory f) { T stub = myStub; if (stub != null) { //noinspection unchecked @@ -456,7 +461,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP /** * @return children of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ - public Psi[] getStubOrPsiChildren(TokenSet filter, Psi[] array) { + @NotNull + public Psi[] getStubOrPsiChildren(@NotNull TokenSet filter, @NotNull Psi[] array) { T stub = myStub; if (stub != null) { //noinspection unchecked @@ -477,7 +483,8 @@ public class StubBasedPsiElementBase extends ASTDelegateP /** * @return children of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ - public Psi[] getStubOrPsiChildren(TokenSet filter, ArrayFactory f) { + @NotNull + public Psi[] getStubOrPsiChildren(@NotNull TokenSet filter, @NotNull ArrayFactory f) { T stub = myStub; if (stub != null) { //noinspection unchecked @@ -498,7 +505,7 @@ public class StubBasedPsiElementBase extends ASTDelegateP * @return a first ancestor of specified type, in stub hierarchy (if this element is currently stub-based) or AST hierarchy (otherwise). */ @Nullable - protected E getStubOrPsiParentOfType(final Class parentClass) { + protected E getStubOrPsiParentOfType(@NotNull Class parentClass) { T stub = myStub; if (stub != null) { //noinspection unchecked diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java index f1c76f048f71..4f9874ec8071 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/SharedImplUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -158,7 +158,8 @@ public class SharedImplUtil { return node.getTreeParent().getPsi().getManager(); } - public static ASTNode[] getChildrenOfType(ASTNode node, IElementType elementType) { + @NotNull + public static ASTNode[] getChildrenOfType(@NotNull ASTNode node, @NotNull IElementType elementType) { int count = countChildrenOfType(node, elementType); if (count == 0) { return ASTNode.EMPTY_ARRAY; diff --git a/platform/core-impl/src/com/intellij/psi/stubs/PsiFileStubImpl.java b/platform/core-impl/src/com/intellij/psi/stubs/PsiFileStubImpl.java index a62752c6e2c9..e2ed643b6ae2 100644 --- a/platform/core-impl/src/com/intellij/psi/stubs/PsiFileStubImpl.java +++ b/platform/core-impl/src/com/intellij/psi/stubs/PsiFileStubImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -72,6 +72,7 @@ public class PsiFileStubImpl extends StubBase implements P return null; } + @NotNull @Override public IStubFileElementType getType() { return TYPE; diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFileStub.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFileStub.java index abe676008c09..d819ae355419 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFileStub.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFileStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -19,6 +19,7 @@ import com.intellij.psi.stubs.PsiFileStubImpl; import com.intellij.psi.tree.IStubFileElementType; import com.intellij.util.ArrayUtil; import com.intellij.util.io.StringRef; +import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.parser.GroovyParserDefinition; import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.packaging.GrPackageDefinition; @@ -50,6 +51,7 @@ public class GrFileStub extends PsiFileStubImpl { myAnnotations = annotations; } + @NotNull @Override public IStubFileElementType getType() { return GroovyParserDefinition.GROOVY_FILE; diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubImpl.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubImpl.java index 21fa3c75f583..585fb1b25ee9 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -24,6 +24,7 @@ import com.jetbrains.python.psi.FutureFeature; import com.jetbrains.python.psi.PyFile; import com.jetbrains.python.psi.impl.PyFileImpl; import com.jetbrains.python.psi.stubs.PyFileStub; +import org.jetbrains.annotations.NotNull; import java.util.BitSet; import java.util.List; @@ -72,6 +73,7 @@ public class PyFileStubImpl extends PsiFileStubImpl implements PyFileStu return myDeprecationMessage == null ? null : myDeprecationMessage.getString(); } + @NotNull @Override public IStubFileElementType getType() { return (IStubFileElementType) LanguageParserDefinitions.INSTANCE.forLanguage(PythonLanguage.getInstance()).getFileNodeType(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/AttributeStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/AttributeStub.java index 4ea707e70e88..5b7d6fe3198e 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/AttributeStub.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/AttributeStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -17,6 +17,7 @@ package com.intellij.util.xml.stubs; import com.intellij.psi.stubs.ObjectStubSerializer; import com.intellij.util.io.StringRef; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; @@ -38,6 +39,7 @@ public class AttributeStub extends DomStub { return myValue; } + @NotNull @Override public List getChildrenStubs() { return Collections.emptyList(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java index 8ddf4632a40a..1d13b9643701 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -51,6 +51,7 @@ public abstract class DomStub extends ObjectStubBase { myLocalName = localName; } + @NotNull @Override public abstract List getChildrenStubs(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java index 5a006fd3dda4..ef540a505daf 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -56,6 +56,7 @@ public class ElementStub extends DomStub { myChildren.add(child); } + @NotNull @Override public List getChildrenStubs() { return myChildren; diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/builder/DomStubBuilder.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/builder/DomStubBuilder.java index bf9ae16de8b5..98a3e0b5aa60 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/builder/DomStubBuilder.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/builder/DomStubBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -36,6 +36,7 @@ import com.intellij.util.xml.impl.DomApplicationComponent; import com.intellij.util.xml.impl.DomManagerImpl; import com.intellij.util.xml.stubs.FileStub; import com.intellij.xml.util.XmlUtil; +import org.jetbrains.annotations.NotNull; /** * @author Dmitry Avdeev @@ -45,7 +46,7 @@ public class DomStubBuilder implements BinaryFileStubBuilder { private static final Logger LOG = Logger.getInstance(DomStubBuilder.class); @Override - public boolean acceptsFile(VirtualFile file) { + public boolean acceptsFile(@NotNull VirtualFile file) { FileType fileType = file.getFileType(); return fileType == XmlFileType.INSTANCE && !FileBasedIndexImpl.isProjectOrWorkspaceFile(file, fileType); }