diff --git a/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java b/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java index c3319d2d2ce7..aae94191f942 100644 --- a/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java +++ b/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -34,13 +34,13 @@ import org.jetbrains.annotations.Nullable; * User: cdr */ class AnchorElementInfo extends SelfElementInfo { - private int stubId = -1; + private int stubId; private IStubElementType myStubElementType; AnchorElementInfo(@NotNull PsiElement anchor, @NotNull PsiFile containingFile) { - super(containingFile.getProject(), ProperTextRange.create(anchor.getTextRange()), anchor.getClass(), containingFile, - LanguageUtil.getRootLanguage(anchor)); + super(containingFile.getProject(), ProperTextRange.create(anchor.getTextRange()), anchor.getClass(), containingFile, LanguageUtil.getRootLanguage(anchor)); assert !(anchor instanceof PsiFile) : "FileElementInfo must be used for file: "+anchor; + stubId = -1; } // will restore by stub index until file tree get loaded AnchorElementInfo(@NotNull PsiElement anchor, diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java index d141a79f5703..ceb856e077e6 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -16,7 +16,6 @@ package com.intellij.psi.impl.smartPointers; import com.intellij.lang.Language; -import com.intellij.lang.LanguageUtil; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.RangeMarker; @@ -47,15 +46,11 @@ public class SelfElementInfo implements SmartPointerElementInfo { private volatile RangeMarker myRangeMarker; //maintains hard reference during modification protected final Language myLanguage; - protected SelfElementInfo(@NotNull Project project, @NotNull PsiElement anchor) { - this(project, ProperTextRange.create(anchor.getTextRange()), anchor.getClass(), anchor.getContainingFile(), - LanguageUtil.getRootLanguage(anchor)); - } - public SelfElementInfo(@NotNull Project project, - @NotNull ProperTextRange range, - @NotNull Class anchorClass, - @NotNull PsiFile containingFile, - @NotNull Language language) { + SelfElementInfo(@NotNull Project project, + @NotNull ProperTextRange range, + @NotNull Class anchorClass, + @NotNull PsiFile containingFile, + @NotNull Language language) { myLanguage = language; myVirtualFile = PsiUtilCore.getVirtualFile(containingFile); myType = anchorClass; diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java index d7b70398cf74..326d6b050250 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -126,7 +126,9 @@ class SmartPsiElementPointerImpl implements SmartPointerEx } @NotNull - static SmartPointerElementInfo createElementInfo(@NotNull Project project, @NotNull E element, PsiFile containingFile) { + private static SmartPointerElementInfo createElementInfo(@NotNull Project project, + @NotNull E element, + PsiFile containingFile) { if (element instanceof PsiDirectory) { return new DirElementInfo((PsiDirectory)element); } @@ -185,7 +187,7 @@ class SmartPsiElementPointerImpl implements SmartPointerEx return myElementInfo; } - protected static boolean pointsToTheSameElementAs(@NotNull SmartPsiElementPointer pointer1, @NotNull SmartPsiElementPointer pointer2) { + static boolean pointsToTheSameElementAs(@NotNull SmartPsiElementPointer pointer1, @NotNull SmartPsiElementPointer pointer2) { if (pointer1 == pointer2) return true; if (pointer1 instanceof SmartPsiElementPointerImpl && pointer2 instanceof SmartPsiElementPointerImpl) { SmartPsiElementPointerImpl impl1 = (SmartPsiElementPointerImpl)pointer1; diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java index 0ef1af849fd1..81369fcd59af 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -239,8 +239,8 @@ public class BlockSupportImpl extends BlockSupport { } @NotNull - private static DiffLog replaceElementWithEvents(final CompositeElement oldRoot, - final CompositeElement newRoot) { + private static DiffLog replaceElementWithEvents(@NotNull CompositeElement oldRoot, + @NotNull CompositeElement newRoot) { DiffLog diffLog = new DiffLog(); diffLog.appendReplaceElementWithEvents(oldRoot, newRoot); return diffLog; diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/text/DiffLog.java b/platform/core-impl/src/com/intellij/psi/impl/source/text/DiffLog.java index 386fb2dea0e9..32edb4d4e0e7 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/text/DiffLog.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/text/DiffLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -70,11 +70,11 @@ public class DiffLog implements DiffTreeChangeBuilder { } } - public void appendReplaceElementWithEvents(CompositeElement oldRoot, CompositeElement newRoot) { + void appendReplaceElementWithEvents(@NotNull CompositeElement oldRoot, @NotNull CompositeElement newRoot) { myEntries.add(new ReplaceElementWithEvents(oldRoot, newRoot)); } - public void appendReplaceFileElement(FileElement oldNode, FileElement newNode) { + void appendReplaceFileElement(@NotNull FileElement oldNode, @NotNull FileElement newNode) { myEntries.add(new ReplaceFileElement(oldNode, newNode)); } @@ -92,7 +92,7 @@ public class DiffLog implements DiffTreeChangeBuilder { private final ASTNode myOldChild; private final ASTNode myNewChild; - public ReplaceEntry(@NotNull ASTNode oldNode, @NotNull ASTNode newNode) { + private ReplaceEntry(@NotNull ASTNode oldNode, @NotNull ASTNode newNode) { myOldChild = oldNode; myNewChild = newNode; ASTNode parent = oldNode.getTreeParent(); @@ -133,10 +133,10 @@ public class DiffLog implements DiffTreeChangeBuilder { } private static class DeleteEntry extends LogEntry { - private final ASTNode myOldParent; - private final ASTNode myOldNode; + @NotNull private final ASTNode myOldParent; + @NotNull private final ASTNode myOldNode; - public DeleteEntry(ASTNode oldParent, ASTNode oldNode) { + private DeleteEntry(@NotNull ASTNode oldParent, @NotNull ASTNode oldNode) { myOldParent = oldParent; myOldNode = oldNode; } @@ -167,11 +167,11 @@ public class DiffLog implements DiffTreeChangeBuilder { } private static class InsertEntry extends LogEntry { - private final ASTNode myOldParent; - private final ASTNode myNewNode; + @NotNull private final ASTNode myOldParent; + @NotNull private final ASTNode myNewNode; private final int myPos; - public InsertEntry(@NotNull ASTNode oldParent, @NotNull ASTNode newNode, int pos) { + private InsertEntry(@NotNull ASTNode oldParent, @NotNull ASTNode newNode, int pos) { assert oldParent instanceof CompositeElement : oldParent; myOldParent = oldParent; myNewNode = newNode; @@ -226,10 +226,10 @@ public class DiffLog implements DiffTreeChangeBuilder { } private static class ReplaceFileElement extends LogEntry { - private final FileElement myOldNode; - private final FileElement myNewNode; + @NotNull private final FileElement myOldNode; + @NotNull private final FileElement myNewNode; - public ReplaceFileElement(FileElement oldNode, FileElement newNode) { + private ReplaceFileElement(@NotNull FileElement oldNode, @NotNull FileElement newNode) { myOldNode = oldNode; myNewNode = newNode; } @@ -250,10 +250,10 @@ public class DiffLog implements DiffTreeChangeBuilder { } private static class ReplaceElementWithEvents extends LogEntry { - private final CompositeElement myOldRoot; - private final CompositeElement myNewRoot; + @NotNull private final CompositeElement myOldRoot; + @NotNull private final CompositeElement myNewRoot; - public ReplaceElementWithEvents(CompositeElement oldRoot, CompositeElement newRoot) { + private ReplaceElementWithEvents(@NotNull CompositeElement oldRoot, @NotNull CompositeElement newRoot) { myOldRoot = oldRoot; myNewRoot = newRoot; } diff --git a/xml/tests/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMoverTest.java b/xml/tests/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMoverTest.java index 308163ba8815..69a939721c1b 100644 --- a/xml/tests/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMoverTest.java +++ b/xml/tests/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMoverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -20,6 +20,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.testFramework.LightPlatformCodeInsightTestCase; import com.intellij.testFramework.PlatformTestUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.io.File; @@ -85,6 +86,7 @@ public class XmlMoverTest extends LightPlatformCodeInsightTestCase { return "/mover"; } + @NotNull @Override protected String getTestDataPath() { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData";