diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocTokenImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocTokenImpl.java index 5fcf7791b850..85301458d047 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocTokenImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocTokenImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -23,7 +23,7 @@ import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; public class PsiDocTokenImpl extends LeafPsiElement implements PsiDocToken{ - public PsiDocTokenImpl(IElementType type, CharSequence text) { + public PsiDocTokenImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/CoreJavaASTFactory.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/CoreJavaASTFactory.java index dc7b6e576871..9c888c006b99 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/CoreJavaASTFactory.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/CoreJavaASTFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -27,6 +27,7 @@ import com.intellij.psi.impl.source.tree.java.PsiKeywordImpl; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.java.IJavaDocElementType; import com.intellij.psi.tree.java.IJavaElementType; +import org.jetbrains.annotations.NotNull; /** * @author yole @@ -35,7 +36,7 @@ public class CoreJavaASTFactory extends ASTFactory implements Constants { private final DefaultASTFactory myDefaultASTFactory = ServiceManager.getService(DefaultASTFactory.class); @Override - public LeafElement createLeaf(final IElementType type, final CharSequence text) { + public LeafElement createLeaf(@NotNull final IElementType type, final CharSequence text) { if (type == C_STYLE_COMMENT || type == END_OF_LINE_COMMENT) { return myDefaultASTFactory.createComment(type, text); } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiJavaTokenImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiJavaTokenImpl.java index b5759a188084..38447a9bc324 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiJavaTokenImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiJavaTokenImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -23,7 +23,7 @@ import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; public class PsiJavaTokenImpl extends LeafPsiElement implements PsiJavaToken{ - public PsiJavaTokenImpl(IElementType type, CharSequence text) { + public PsiJavaTokenImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiKeywordImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiKeywordImpl.java index fa69e5c28083..f39a88e8b35c 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiKeywordImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiKeywordImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; public class PsiKeywordImpl extends LeafPsiElement implements PsiKeyword, PsiJavaToken { - public PsiKeywordImpl(IElementType type, CharSequence text) { + public PsiKeywordImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } diff --git a/java/manifest/src/org/jetbrains/lang/manifest/psi/impl/ManifestTokenImpl.java b/java/manifest/src/org/jetbrains/lang/manifest/psi/impl/ManifestTokenImpl.java index 4bd603ad6e6a..ada18d864cae 100644 --- a/java/manifest/src/org/jetbrains/lang/manifest/psi/impl/ManifestTokenImpl.java +++ b/java/manifest/src/org/jetbrains/lang/manifest/psi/impl/ManifestTokenImpl.java @@ -25,6 +25,7 @@ package org.jetbrains.lang.manifest.psi.impl; import com.intellij.psi.impl.source.tree.LeafPsiElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.lang.manifest.psi.ManifestToken; import org.jetbrains.lang.manifest.psi.ManifestTokenType; @@ -32,7 +33,7 @@ import org.jetbrains.lang.manifest.psi.ManifestTokenType; * @author Robert F. Beeger (robert@beeger.net) */ public class ManifestTokenImpl extends LeafPsiElement implements ManifestToken { - public ManifestTokenImpl(ManifestTokenType type, CharSequence text) { + public ManifestTokenImpl(@NotNull ManifestTokenType type, CharSequence text) { super(type, text); } diff --git a/platform/core-impl/src/com/intellij/core/CoreASTFactory.java b/platform/core-impl/src/com/intellij/core/CoreASTFactory.java index a70a1eb13b1f..d4e19d280bb9 100644 --- a/platform/core-impl/src/com/intellij/core/CoreASTFactory.java +++ b/platform/core-impl/src/com/intellij/core/CoreASTFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -48,7 +48,7 @@ public class CoreASTFactory extends ASTFactory implements DefaultASTFactory { @Override @NotNull - public LeafElement createLeaf(final IElementType type, final CharSequence text) { + public LeafElement createLeaf(@NotNull final IElementType type, final CharSequence text) { final Language lang = type.getLanguage(); final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(lang); if (parserDefinition != null) { @@ -61,7 +61,7 @@ public class CoreASTFactory extends ASTFactory implements DefaultASTFactory { } @Override - public LeafElement createComment(IElementType type, CharSequence text) { + public LeafElement createComment(@NotNull IElementType type, CharSequence text) { return new PsiCoreCommentImpl(type, text); } } diff --git a/platform/core-impl/src/com/intellij/lang/ASTFactory.java b/platform/core-impl/src/com/intellij/lang/ASTFactory.java index cc8b2a251104..d923204915b3 100644 --- a/platform/core-impl/src/com/intellij/lang/ASTFactory.java +++ b/platform/core-impl/src/com/intellij/lang/ASTFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -46,7 +46,7 @@ public abstract class ASTFactory { } @Nullable - public LeafElement createLeaf(final IElementType type, final CharSequence text) { + public LeafElement createLeaf(@NotNull IElementType type, final CharSequence text) { return null; } diff --git a/platform/core-impl/src/com/intellij/lang/TokenWrapper.java b/platform/core-impl/src/com/intellij/lang/TokenWrapper.java index 8b85fa50eff2..ade2dc884314 100644 --- a/platform/core-impl/src/com/intellij/lang/TokenWrapper.java +++ b/platform/core-impl/src/com/intellij/lang/TokenWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -20,17 +20,19 @@ package com.intellij.lang; import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; public class TokenWrapper extends IElementType { private final IElementType myDelegate; private final String myValue; - public TokenWrapper(IElementType delegate, CharSequence value) { + public TokenWrapper(@NotNull IElementType delegate, CharSequence value) { super("Wrapper", delegate.getLanguage(), false); myDelegate = delegate; myValue = value.toString(); } + @NotNull public IElementType getDelegate() { return myDelegate; } diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/Factory.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/Factory.java index 215788f935ce..eb869ffb4c35 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/Factory.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/Factory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -30,7 +30,7 @@ import org.jetbrains.annotations.Nullable; public class Factory { private Factory() {} - public static LeafElement createSingleLeafElement(IElementType type, CharSequence buffer, int startOffset, int endOffset, CharTable table, PsiManager manager, PsiFile originalFile) { + public static LeafElement createSingleLeafElement(@NotNull IElementType type, CharSequence buffer, int startOffset, int endOffset, CharTable table, PsiManager manager, PsiFile originalFile) { DummyHolder dummyHolder = DummyHolderFactory.createHolder(manager, table, type.getLanguage()); dummyHolder.setOriginalFile(originalFile); @@ -43,7 +43,7 @@ public class Factory { return newElement; } - public static LeafElement createSingleLeafElement(IElementType type, CharSequence buffer, int startOffset, int endOffset, CharTable table, PsiManager manager, boolean generatedFlag) { + public static LeafElement createSingleLeafElement(@NotNull IElementType type, CharSequence buffer, int startOffset, int endOffset, CharTable table, PsiManager manager, boolean generatedFlag) { final FileElement holderElement = DummyHolderFactory.createHolder(manager, table, type.getLanguage()).getTreeElement(); final LeafElement newElement = ASTFactory.leaf(type, holderElement.getCharTable().intern( buffer, startOffset, endOffset)); @@ -52,11 +52,11 @@ public class Factory { return newElement; } - public static LeafElement createSingleLeafElement(IElementType type, CharSequence buffer, CharTable table, PsiManager manager) { + public static LeafElement createSingleLeafElement(@NotNull IElementType type, CharSequence buffer, CharTable table, PsiManager manager) { return createSingleLeafElement(type, buffer, 0, buffer.length(), table, manager); } - public static LeafElement createSingleLeafElement(IElementType type, CharSequence buffer, int startOffset, int endOffset, @Nullable CharTable table, PsiManager manager) { + public static LeafElement createSingleLeafElement(@NotNull IElementType type, CharSequence buffer, int startOffset, int endOffset, @Nullable CharTable table, PsiManager manager) { return createSingleLeafElement(type, buffer, startOffset, endOffset, table, manager, true); } @@ -65,7 +65,7 @@ public class Factory { } @NotNull - public static CompositeElement createCompositeElement(final IElementType type, + public static CompositeElement createCompositeElement(@NotNull IElementType type, final CharTable charTableByTree, final PsiManager manager) { final FileElement treeElement = DummyHolderFactory.createHolder(manager, null, charTableByTree).getTreeElement(); diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/ForeignLeafPsiElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/ForeignLeafPsiElement.java index e55ea9c606dd..ae8a38e1f939 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/ForeignLeafPsiElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/ForeignLeafPsiElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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,12 +28,13 @@ import org.jetbrains.annotations.NotNull; public class ForeignLeafPsiElement extends LeafPsiElement { private final ForeignLeafType myForeignType; - public ForeignLeafPsiElement(ForeignLeafType type, CharSequence text) { + public ForeignLeafPsiElement(@NotNull ForeignLeafType type, CharSequence text) { super(dereferenceElementType(type.getDelegate()), text); myForeignType = type; } - private static IElementType dereferenceElementType(IElementType type) { + @NotNull + private static IElementType dereferenceElementType(@NotNull IElementType type) { while ( type instanceof TokenWrapper) type = (( TokenWrapper ) type ).getDelegate(); diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java index 0df2c3f08a13..929737177052 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -37,7 +37,7 @@ public abstract class LeafElement extends TreeElement { private final CharSequence myText; - protected LeafElement(IElementType type, CharSequence text) { + protected LeafElement(@NotNull IElementType type, CharSequence text) { super(type); myText = text; } diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafPsiElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafPsiElement.java index 4391df4c6823..46290e9bebdf 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafPsiElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafPsiElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -41,12 +41,12 @@ import org.jetbrains.annotations.NotNull; public class LeafPsiElement extends LeafElement implements PsiElement, NavigationItem { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.LeafPsiElement"); - public LeafPsiElement(IElementType type, CharSequence text) { + public LeafPsiElement(@NotNull IElementType type, CharSequence text) { super(type, text); } @Deprecated - public LeafPsiElement(IElementType type, CharSequence buffer, int startOffset, int endOffset, CharTable table) { + public LeafPsiElement(@NotNull IElementType type, CharSequence buffer, int startOffset, int endOffset, CharTable table) { super(type, table.intern(buffer, startOffset, endOffset)); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/OwnBufferLeafPsiElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/OwnBufferLeafPsiElement.java index 653a4f418aad..7d1abe377f1a 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/OwnBufferLeafPsiElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/OwnBufferLeafPsiElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -35,7 +35,7 @@ import org.jetbrains.annotations.NotNull; public class OwnBufferLeafPsiElement extends LeafElement implements PsiElement { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.LeafPsiElement"); - public OwnBufferLeafPsiElement(IElementType type, CharSequence text) { + public OwnBufferLeafPsiElement(@NotNull IElementType type, CharSequence text) { super(type, text); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/PlainTextASTFactory.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/PlainTextASTFactory.java index ac2350550de7..8674773ac469 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/PlainTextASTFactory.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/PlainTextASTFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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,14 @@ package com.intellij.psi.impl.source.tree; import com.intellij.lang.ASTFactory; import com.intellij.psi.PlainTextTokenTypes; import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class PlainTextASTFactory extends ASTFactory { @Override @Nullable - public LeafElement createLeaf(final IElementType type, CharSequence text) { + public LeafElement createLeaf(@NotNull final IElementType type, CharSequence text) { if (type == PlainTextTokenTypes.PLAIN_TEXT) { return new PsiPlainTextImpl(text); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCoreCommentImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCoreCommentImpl.java index 58a3eb349e5e..a616a7ea2b86 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCoreCommentImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCoreCommentImpl.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 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. + */ package com.intellij.psi.impl.source.tree; import com.intellij.psi.PsiComment; @@ -11,7 +26,7 @@ import org.jetbrains.annotations.NotNull; * @author yole */ public class PsiCoreCommentImpl extends LeafPsiElement implements PsiComment { - public PsiCoreCommentImpl(IElementType type, CharSequence text) { + public PsiCoreCommentImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeElement.java index fde4f52baa46..0ad193116c80 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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 TreeElement extends ElementBase implements ASTNode, Clonea private final IElementType myType; private volatile int myStartOffsetInParent = -1; - public TreeElement(IElementType type) { + public TreeElement(@NotNull IElementType type) { myType = type; } @@ -390,6 +390,7 @@ public abstract class TreeElement extends ElementBase implements ASTNode, Clonea } @Override + @NotNull public IElementType getElementType() { return myType; } diff --git a/platform/lang-api/src/com/intellij/psi/stubs/NamedStubBase.java b/platform/lang-api/src/com/intellij/psi/stubs/NamedStubBase.java index 3e18e808759f..7ea95e9ac7fe 100644 --- a/platform/lang-api/src/com/intellij/psi/stubs/NamedStubBase.java +++ b/platform/lang-api/src/com/intellij/psi/stubs/NamedStubBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package com.intellij.psi.stubs; import com.intellij.psi.PsiNamedElement; import com.intellij.util.io.StringRef; +import org.jetbrains.annotations.NotNull; /** * @author yole @@ -25,12 +26,12 @@ import com.intellij.util.io.StringRef; public abstract class NamedStubBase extends StubBase implements NamedStub { private final StringRef myName; - protected NamedStubBase(StubElement parent, IStubElementType elementType, StringRef name) { + protected NamedStubBase(StubElement parent, @NotNull IStubElementType elementType, StringRef name) { super(parent, elementType); myName = name; } - protected NamedStubBase(final StubElement parent, final IStubElementType elementType, final String name) { + protected NamedStubBase(final StubElement parent, @NotNull IStubElementType elementType, final String name) { this(parent, elementType, StringRef.fromString(name)); } diff --git a/platform/lang-impl/src/com/intellij/lang/DefaultASTFactoryImpl.java b/platform/lang-impl/src/com/intellij/lang/DefaultASTFactoryImpl.java index 39497bb2d786..84b79498e050 100644 --- a/platform/lang-impl/src/com/intellij/lang/DefaultASTFactoryImpl.java +++ b/platform/lang-impl/src/com/intellij/lang/DefaultASTFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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,10 +19,11 @@ import com.intellij.core.CoreASTFactory; import com.intellij.psi.impl.source.tree.LeafElement; import com.intellij.psi.impl.source.tree.PsiCommentImpl; import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; public class DefaultASTFactoryImpl extends CoreASTFactory implements DefaultASTFactory { @Override - public LeafElement createComment(IElementType type, CharSequence text) { + public LeafElement createComment(@NotNull IElementType type, CharSequence text) { return new PsiCommentImpl(type, text); } } diff --git a/platform/lang-impl/src/com/intellij/psi/templateLanguages/OuterLanguageElementImpl.java b/platform/lang-impl/src/com/intellij/psi/templateLanguages/OuterLanguageElementImpl.java index 099e3655a9ee..f89f1cea04c5 100644 --- a/platform/lang-impl/src/com/intellij/psi/templateLanguages/OuterLanguageElementImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/templateLanguages/OuterLanguageElementImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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,7 +24,7 @@ import org.jetbrains.annotations.NotNull; * @author peter */ public class OuterLanguageElementImpl extends LeafPsiElement implements OuterLanguageElement { - public OuterLanguageElementImpl(IElementType type, CharSequence text) { + public OuterLanguageElementImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } diff --git a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java index c75b6109f8dd..00f8cfe409eb 100644 --- a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java +++ b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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,10 +51,10 @@ public class TemplateDataElementType extends IFileElementType implements ITempla public static final LanguageExtension TREE_PATCHER = new LanguageExtension("com.intellij.lang.treePatcher", new SimpleTreePatcher()); - private final IElementType myTemplateElementType; - private final IElementType myOuterElementType; + @NotNull private final IElementType myTemplateElementType; + @NotNull private final IElementType myOuterElementType; - public TemplateDataElementType(@NonNls String debugName, Language language, IElementType templateElementType, IElementType outerElementType) { + public TemplateDataElementType(@NonNls String debugName, Language language, @NotNull IElementType templateElementType, @NotNull IElementType outerElementType) { super(debugName, language); myTemplateElementType = templateElementType; myOuterElementType = outerElementType; @@ -188,7 +188,7 @@ public class TemplateDataElementType extends IFileElementType implements ITempla } protected OuterLanguageElementImpl createOuterLanguageElement(final Lexer lexer, final CharTable table, - final IElementType outerElementType) { + @NotNull IElementType outerElementType) { final CharSequence buffer = lexer.getBufferSequence(); final int tokenStart = lexer.getTokenStart(); if (tokenStart < 0 || tokenStart > buffer.length()) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java index eb55247c8ad1..eb26f6afa441 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java @@ -27,6 +27,7 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.AstBufferUtil; +import com.intellij.psi.impl.source.tree.Factory; import com.intellij.psi.infos.CandidateInfo; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.tree.IElementType; @@ -92,7 +93,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static com.intellij.psi.impl.source.tree.Factory.createSingleLeafElement; import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.*; import static org.jetbrains.plugins.groovy.lang.lexer.TokenSets.RELATIONS; import static org.jetbrains.plugins.groovy.lang.lexer.TokenSets.SHIFT_SIGNS; @@ -410,10 +410,12 @@ public class PsiImplUtil { if (qName == null) return null; final List orderEntries = idx.getOrderEntriesForFile(vFile); PsiClass original = facade.findClass(qName, new GlobalSearchScope(facade.getProject()) { + @Override public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) { return 0; } + @Override public boolean contains(@NotNull VirtualFile file) { // order for file and vFile has non empty intersection. List entries = idx.getOrderEntriesForFile(file); @@ -425,10 +427,12 @@ public class PsiImplUtil { return false; } + @Override public boolean isSearchInModuleContent(@NotNull Module aModule) { return false; } + @Override public boolean isSearchInLibraries() { return true; } @@ -535,7 +539,7 @@ public class PsiImplUtil { } final String substring = text.substring(second); container.getNode() - .replaceChild(node, createSingleLeafElement(type, substring, 0, substring.length(), null, container.getManager())); + .replaceChild(node, Factory.createSingleLeafElement(type, substring, 0, substring.length(), null, container.getManager())); return; } else { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFieldStub.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFieldStub.java index 294ec0d0b441..27bc0007c369 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFieldStub.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrFieldStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -44,7 +44,7 @@ public class GrFieldStub extends StubBase implements NamedStub StringRef name, final String[] annotations, String[] namedParameters, - final IStubElementType elemType, + @NotNull IStubElementType elemType, byte flags, @Nullable String typeText) { super(parent, elemType); myName = name; @@ -54,6 +54,7 @@ public class GrFieldStub extends StubBase implements NamedStub myTypeText = typeText; } + @Override @NotNull public String getName() { return StringRef.toString(myName); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrImportStatementStub.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrImportStatementStub.java index dd678bb215a0..3408d3f0a495 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrImportStatementStub.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrImportStatementStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.stubs; import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement; @@ -33,7 +34,7 @@ public class GrImportStatementStub extends StubBase implement private final String myAliasName; public GrImportStatementStub(StubElement parent, - IStubElementType elementType, + @NotNull IStubElementType elementType, @Nullable String referenceText, @Nullable String aliasName, byte flags) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrMethodStub.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrMethodStub.java index 803f7e31a69a..0bcb1fd4c475 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrMethodStub.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrMethodStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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,8 +40,8 @@ public class GrMethodStub extends StubBase implements NamedStub implements NamedStub implements StubElement { private final int myFlags; - public GrModifierListStub(StubElement parent, IStubElementType elementType, int flags) { + public GrModifierListStub(StubElement parent, @NotNull IStubElementType elementType, int flags) { super(parent, elementType); this.myFlags = flags; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrPackageDefinitionStub.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrPackageDefinitionStub.java index 7383013d7660..f7f03d1db6f3 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrPackageDefinitionStub.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrPackageDefinitionStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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,12 +19,13 @@ import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; import com.intellij.util.io.StringRef; +import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.packaging.GrPackageDefinition; public class GrPackageDefinitionStub extends StubBase implements StubElement { private final StringRef myPackageName; - public GrPackageDefinitionStub(StubElement parent, IStubElementType elementType, StringRef packageName) { + public GrPackageDefinitionStub(StubElement parent, @NotNull IStubElementType elementType, StringRef packageName) { super(parent, elementType); this.myPackageName = packageName; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrReferenceListStub.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrReferenceListStub.java index 6c11bbc1da63..a3bcecf3f2b9 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrReferenceListStub.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrReferenceListStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.stubs; import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrReferenceList; /** @@ -27,7 +28,7 @@ public class GrReferenceListStub extends StubBase implements St private final String[] myRefNames; - public GrReferenceListStub(final StubElement parentStub, IStubElementType elemtType, final String[] refNames) { + public GrReferenceListStub(final StubElement parentStub, @NotNull IStubElementType elemtType, final String[] refNames) { super(parentStub, elemtType); myRefNames = refNames; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrTypeDefinitionStub.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrTypeDefinitionStub.java index 0abc94d76fd8..4f9f6d19bee1 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrTypeDefinitionStub.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrTypeDefinitionStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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,6 +21,7 @@ import com.intellij.psi.stubs.NamedStub; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; import com.intellij.util.io.StringRef; +import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrAnonymousClassDefinition; import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition; @@ -45,7 +46,7 @@ public class GrTypeDefinitionStub extends StubBase implements public GrTypeDefinitionStub(StubElement parent, final String name, final String[] supers, - final IStubElementType elementType, + @NotNull IStubElementType elementType, final String qualifiedName, String[] annotations, byte flags) { @@ -61,6 +62,7 @@ public class GrTypeDefinitionStub extends StubBase implements return mySuperClasses; } + @Override public String getName() { return StringRef.toString(myName); } diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesASTFactory.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesASTFactory.java index 1ccb30236ff6..ef7e73dad6d4 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesASTFactory.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesASTFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -20,12 +20,14 @@ import com.intellij.lang.properties.parsing.PropertiesTokenTypes; import com.intellij.psi.impl.source.tree.*; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IFileElementType; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author cdr */ public class PropertiesASTFactory extends ASTFactory { + @Override @Nullable public CompositeElement createComposite(final IElementType type) { if (type instanceof IFileElementType) { @@ -34,8 +36,9 @@ public class PropertiesASTFactory extends ASTFactory { return new CompositeElement(type); } + @Override @Nullable - public LeafElement createLeaf(final IElementType type, CharSequence text) { + public LeafElement createLeaf(@NotNull final IElementType type, CharSequence text) { if (type == PropertiesTokenTypes.VALUE_CHARACTERS) { return new PropertyValueImpl(type, text); } diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyValueImpl.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyValueImpl.java index 9091aeb5e9f8..f4121b630bb8 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyValueImpl.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertyValueImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -26,15 +26,17 @@ import org.jetbrains.annotations.NotNull; * @author cdr */ public class PropertyValueImpl extends LeafPsiElement { - public PropertyValueImpl(IElementType type, CharSequence text) { + public PropertyValueImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } + @Override @NotNull public PsiReference[] getReferences() { return ReferenceProvidersRegistry.getReferencesFromProviders(this, PropertyValueImpl.class); } + @Override public PsiReference getReference() { PsiReference[] references = getReferences(); return references.length == 0 ? null : references[0]; diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlASTFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlASTFactory.java index d8dafcefef4c..b8dac87836b2 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlASTFactory.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlASTFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -29,10 +29,12 @@ import com.intellij.psi.templateLanguages.ITemplateDataElementType; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.ILazyParseableElementType; import com.intellij.psi.tree.xml.IXmlLeafElementType; +import org.jetbrains.annotations.NotNull; import static com.intellij.psi.xml.XmlElementType.*; public class XmlASTFactory extends ASTFactory { + @Override public CompositeElement createComposite(final IElementType type) { if (type == XML_TAG) { return new XmlTagImpl(); @@ -133,7 +135,8 @@ public class XmlASTFactory extends ASTFactory { return null; } - public LeafElement createLeaf(final IElementType type, CharSequence text) { + @Override + public LeafElement createLeaf(@NotNull final IElementType type, CharSequence text) { if (type instanceof IXmlLeafElementType) { if (type == XML_REAL_WHITE_SPACE) { return new PsiWhiteSpaceImpl(text); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java index 172afda55a69..5d700875ce13 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -31,14 +31,16 @@ import org.jetbrains.annotations.NotNull; * @author ik */ public class XmlTokenImpl extends LeafPsiElement implements XmlToken, Navigatable { - public XmlTokenImpl(IElementType type, CharSequence text) { + public XmlTokenImpl(@NotNull IElementType type, CharSequence text) { super(type, text); } + @Override public boolean processElements(PsiElementProcessor processor, PsiElement place) { return false; } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlToken(this); @@ -57,10 +59,12 @@ public class XmlTokenImpl extends LeafPsiElement implements XmlToken, Navigatabl // Implementation specific + @Override public IElementType getTokenType() { return getElementType(); } + @Override @NotNull public PsiReference[] getReferences() { final IElementType elementType = getElementType(); @@ -79,6 +83,7 @@ public class XmlTokenImpl extends LeafPsiElement implements XmlToken, Navigatabl return super.getReferences(); } + @Override public void navigate(boolean requestFocus) { Navigatable descriptor = PsiNavigationSupport.getInstance().getDescriptor(this); if (descriptor != null) { @@ -86,10 +91,12 @@ public class XmlTokenImpl extends LeafPsiElement implements XmlToken, Navigatabl } } + @Override public boolean canNavigate() { return getTokenType() == XmlTokenType.XML_NAME && PsiNavigationSupport.getInstance().canNavigate(this); } + @Override public boolean canNavigateToSource() { return canNavigate(); }