From e760009aaa72d5acfdfb6ba28dfdd309401934b0 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 6 Feb 2017 16:50:34 +0300 Subject: [PATCH] cleanup --- .../psi/impl/file/impl/PsiEventsTest.java | 45 ++++++++----------- .../openapi/editor/EditorFactory.java | 2 +- .../openapi/editor/LogicalPosition.java | 14 +++--- .../editor/event/EditorFactoryListener.java | 2 +- .../openapi/fileEditor/FileEditorState.java | 7 +-- .../impl/text/PsiAwareTextEditorProvider.java | 1 + .../com/intellij/openapi/MnemonicWrapper.java | 11 ----- .../ide/actions/JumpToLastEditAction.java | 2 + .../openapi/editor/impl/CaretImpl.java | 20 ++++----- .../impl/IdeDocumentHistoryImpl.java | 15 +++---- .../impl/text/TextEditorProvider.java | 3 +- .../fileEditor/impl/text/TextEditorState.java | 31 +++++++------ .../intellij/util/io/PersistentHashMap.java | 12 ++--- .../util/ui/EdtInvocationManager.java | 2 +- 14 files changed, 72 insertions(+), 95 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java index beabfdabaf75..9681d9e2bc82 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java @@ -17,7 +17,6 @@ package com.intellij.psi.impl.file.impl; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.WriteCommandAction; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileTypes.FileTypeManager; @@ -43,8 +42,6 @@ import java.io.IOException; @SkipSlowTestLocally public class PsiEventsTest extends PsiTestCase { - private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.file.impl.PsiEventsTest"); - private VirtualFile myPrjDir1; private VirtualFile myPrjDir2; private VirtualFile mySrcDir1; @@ -338,12 +335,9 @@ public class PsiEventsTest extends PsiTestCase { final EventsTestListener listener = new EventsTestListener(); myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable()); - ApplicationManager.getApplication().runWriteAction(new ThrowableComputable() { - @Override - public Object compute() throws IOException { - ReadOnlyAttributeUtil.setReadOnlyAttribute(file, true); - return null; - } + ApplicationManager.getApplication().runWriteAction((ThrowableComputable)() -> { + ReadOnlyAttributeUtil.setReadOnlyAttribute(file, true); + return null; }); @@ -358,12 +352,9 @@ public class PsiEventsTest extends PsiTestCase { } }.assertCompleted(listener.getEventsString()); - ApplicationManager.getApplication().runWriteAction(new ThrowableComputable() { - @Override - public Object compute() throws IOException { - ReadOnlyAttributeUtil.setReadOnlyAttribute(file, false); - return null; - } + ApplicationManager.getApplication().runWriteAction((ThrowableComputable)() -> { + ReadOnlyAttributeUtil.setReadOnlyAttribute(file, false); + return null; }); } @@ -583,10 +574,10 @@ public class PsiEventsTest extends PsiTestCase { rename(virtualFile, "b.xml"); } - String newText; - String original; - String eventsFired = ""; - PsiTreeChangeListener listener; + private String newText; + private String original; + private String eventsFired = ""; + private PsiTreeChangeListener listener; public void testBeforeAfterChildrenChange() throws Throwable { listener = new PsiTreeChangeListener() { @Override @@ -753,32 +744,32 @@ public class PsiEventsTest extends PsiTestCase { @Override public void childAdded(@NotNull PsiTreeChangeEvent event) { - checkCommitted(true, event); + checkCommitted(event); } @Override public void childRemoved(@NotNull PsiTreeChangeEvent event) { - checkCommitted(true, event); + checkCommitted(event); } @Override public void childReplaced(@NotNull PsiTreeChangeEvent event) { - checkCommitted(true, event); + checkCommitted(event); } @Override public void childrenChanged(@NotNull PsiTreeChangeEvent event) { - checkCommitted(true, event); + checkCommitted(event); } @Override public void childMoved(@NotNull PsiTreeChangeEvent event) { - checkCommitted(true, event); + checkCommitted(event); } @Override public void propertyChanged(@NotNull PsiTreeChangeEvent event) { - checkCommitted(true, event); + checkCommitted(event); } }, getTestRootDisposable()); @@ -792,11 +783,11 @@ public class PsiEventsTest extends PsiTestCase { assertTrue(documentManager.isCommitted(document)); } - private static void checkCommitted(boolean shouldBeCommitted, PsiTreeChangeEvent event) { + private static void checkCommitted(PsiTreeChangeEvent event) { PsiFile file = event.getFile(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(file.getProject()); Document document = documentManager.getDocument(file); - assertEquals(shouldBeCommitted, documentManager.isCommitted(document)); + assertTrue(documentManager.isCommitted(document)); } public void testTreeChangePreprocessorThrowsException() throws Exception { diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java index f11ad8f67ebc..bb27cfbcdf27 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java @@ -184,7 +184,7 @@ public abstract class EditorFactory { /** * Registers a listener for receiving notifications when editor instances are created and released - * and removes the listener when the 'parentDisposable' gets disposed. + * and removes the listener when the {@code parentDisposable} gets disposed. * * @param listener the listener instance. * @param parentDisposable the Disposable which triggers the removal of the listener diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java index b16857c0421e..48bcb63d919b 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java @@ -16,6 +16,7 @@ package com.intellij.openapi.editor; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.awt.Point; @@ -25,7 +26,7 @@ import java.awt.Point; * will have the line number 10 in its logical position. *

* Logical position may store additional parameters that define its mapping to {@link VisualPosition}. Rationale is that - * single logical (line; column) pair matches soft wrap-introduced virtual space, i.e. different visual positions + * single logical {@code (line; column)} pair matches soft wrap-introduced virtual space, i.e. different visual positions * correspond to the same logical position. It's convenient to store exact visual location details within the logical * position in order to relief further {@code 'logical position' -> 'visual position'} mapping. *

@@ -68,7 +69,7 @@ public class LogicalPosition implements Comparable { * to the current logical position. *

* Instead of directly using this value, EditorUtil.getSoftWrapCountAfterLineStart(Editor, LogicalPosition) method can be used, - * it will work regardless of whether current LogicalPosition instance is {@link #visualPositionAware}. + * it will work regardless of whether current {@code LogicalPosition} instance is {@link #visualPositionAware}. * * @see #visualPositionAware */ @@ -96,11 +97,11 @@ public class LogicalPosition implements Comparable { public final int foldingColumnDiff; /** - * If true, this position is associated with succeeding character (in logical order), otherwise it's associated with + * If {@code true}, this position is associated with succeeding character (in logical order), otherwise it's associated with * preceding character. This can make difference in bidirectional text, where logical positions which differ only in this flag's value * can have different visual positions. *

- * This field has no impact on equality and comparison relationships between LogicalPosition instances. + * This field has no impact on equality and comparison relationships between {@code LogicalPosition} instances. */ public final boolean leansForward; @@ -183,7 +184,7 @@ public class LogicalPosition implements Comparable { } /** - * Constructs a new LogicalPosition instance with a given value of {@link #leansForward} flag. + * Constructs a new {@code LogicalPosition} instance with a given value of {@link #leansForward} flag. */ public LogicalPosition leanForward(boolean value) { return new LogicalPosition(line, column, value); @@ -214,7 +215,8 @@ public class LogicalPosition implements Comparable { + (leansForward ? "; leans forward" : ""); } - public int compareTo(LogicalPosition position) { + @Override + public int compareTo(@NotNull LogicalPosition position) { if (line != position.line) return line - position.line; if (column != position.column) return column - position.column; if (softWrapLinesBeforeCurrentLogicalLine != position.softWrapLinesBeforeCurrentLogicalLine) return softWrapLinesBeforeCurrentLogicalLine - position.softWrapLinesBeforeCurrentLogicalLine; diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/event/EditorFactoryListener.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/event/EditorFactoryListener.java index 2418a5e6f53a..c5fc951f8d02 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/event/EditorFactoryListener.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/event/EditorFactoryListener.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull; import java.util.EventListener; /** - * @see {@link com.intellij.openapi.editor.EditorFactory#addEditorFactoryListener(EditorFactoryListener, com.intellij.openapi.Disposable)} + * see {@link com.intellij.openapi.editor.EditorFactory#addEditorFactoryListener(EditorFactoryListener, com.intellij.openapi.Disposable)} */ public interface EditorFactoryListener extends EventListener { /** diff --git a/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java index f8557358ac00..c74c39a80d01 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java @@ -23,12 +23,7 @@ package com.intellij.openapi.fileEditor; * @author Vladimir Kondratyev */ public interface FileEditorState { - FileEditorState INSTANCE = new FileEditorState() { - @Override - public boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level) { - return true; - } - }; + FileEditorState INSTANCE = (__0, __1) -> true; boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level); } diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java index c7425745d242..2bd157951928 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java @@ -92,6 +92,7 @@ public class PsiAwareTextEditorProvider extends TextEditorProvider { } } + @NotNull @Override protected TextEditorState getStateImpl(final Project project, @NotNull final Editor editor, @NotNull final FileEditorStateLevel level) { final TextEditorState state = super.getStateImpl(project, editor, level); diff --git a/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java b/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java index 54f14ec4b509..1d178939ef4a 100644 --- a/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java @@ -203,17 +203,6 @@ abstract class MnemonicWrapper implements Runnable, Propert return stroke; } - private static class MenuWrapper extends ButtonWrapper { - private MenuWrapper(AbstractButton component) { - super(component); - } - - @Override - boolean isDisabled() { - return UISettings.getShadowInstance().DISABLE_MNEMONICS; - } - } - private static class ButtonWrapper extends MnemonicWrapper { private KeyStroke myStrokePressed; private KeyStroke myStrokeReleased; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java b/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java index 3f77cde853a7..5f48a92ea136 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java @@ -21,12 +21,14 @@ import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; public class JumpToLastEditAction extends AnAction implements DumbAware { + @Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); if (project == null) return; IdeDocumentHistory.getInstance(project).navigatePreviousChange(); } + @Override public void update(AnActionEvent event){ Presentation presentation = event.getPresentation(); DataContext dataContext = event.getDataContext(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java index 0b243ba3b4cc..62c7d4a42372 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java @@ -69,9 +69,9 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { private boolean mySkipChangeRequests; /** * Initial horizontal caret position during vertical navigation. - * Similar to {@link #myDesiredX}, but represents logical caret position (getLogicalPosition().column) rather than visual. + * Similar to {@link #myDesiredX}, but represents logical caret position ({@code getLogicalPosition().column}) rather than visual. */ - private int myLastColumnNumber = 0; + private int myLastColumnNumber; private int myDesiredSelectionStartColumn = -1; private int myDesiredSelectionEndColumn = -1; /** @@ -104,7 +104,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { private volatile VisualPosition myRangeMarkerStartPosition; private volatile VisualPosition myRangeMarkerEndPosition; private volatile boolean myRangeMarkerEndPositionIsLead; - boolean myUnknownDirection; + private boolean myUnknownDirection; private int myDocumentUpdateCounter; @@ -922,7 +922,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { * That's why we allow to specify that the direction is unknown and {@link #isUnknownDirection() expose this information} * later. *

- * Note: when this method is called with 'true', subsequent calls are guaranteed to return 'true' + * Note: when this method is called with {@code 'true'}, subsequent calls are guaranteed to return {@code true} * until selection is changed. 'Unknown direction' flag is automatically reset then. * */ @@ -1374,7 +1374,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { @Override public String toString() { return "Caret at " + (myDocumentUpdateCounter == myEditor.getCaretModel().myDocumentUpdateCounter ? myVisibleCaret : getOffset()) + - (mySelectionMarker == null ? "" : (", selection marker: " + mySelectionMarker.toString())); + (mySelectionMarker == null ? "" : ", selection marker: " + mySelectionMarker); } @Override @@ -1424,7 +1424,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { } /** - * Encapsulates information about target vertical range info - its 'y' coordinate and height in pixels. + * Encapsulates information about target vertical range info - its {@code 'y'} coordinate and height in pixels. */ private static class VerticalInfo { public final int y; @@ -1452,7 +1452,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { return myRangeMarkerEndPosition; } - void setRangeMarkerEndPosition(@NotNull VisualPosition endPosition) { + private void setRangeMarkerEndPosition(@NotNull VisualPosition endPosition) { myRangeMarkerEndPosition = endPosition; } @@ -1460,7 +1460,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { return myRangeMarkerEndPositionIsLead; } - void setRangeMarkerEndPositionIsLead(boolean endPositionIsLead) { + private void setRangeMarkerEndPositionIsLead(boolean endPositionIsLead) { myRangeMarkerEndPositionIsLead = endPositionIsLead; } @@ -1550,7 +1550,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { setIntervalStart(newOffset); setIntervalEnd(newOffset); } - if (oldOffset >= e.getOffset() && oldOffset <= (e.getOffset() + e.getOldLength()) && e.getNewLength() == 0 && + if (oldOffset >= e.getOffset() && oldOffset <= e.getOffset() + e.getOldLength() && e.getNewLength() == 0 && myEditor.getInlayModel().hasInlineElementAt(e.getOffset())) { myLeansTowardsLargerOffsets = true; } @@ -1634,7 +1634,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable { @Override public String toString() { - return super.toString() + (hasVirtualSelection() ? (" virtual selection: " + startVirtualOffset + "-" + endVirtualOffset) : ""); + return super.toString() + (hasVirtualSelection() ? " virtual selection: " + startVirtualOffset + "-" + endVirtualOffset : ""); } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java index 56e6ddc2780e..531c752ee803 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java @@ -39,6 +39,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; +import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.util.*; @@ -144,7 +145,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec public static class RecentlyChangedFilesState { // don't make it private, see: IDEA-130363 Recently Edited Files list should survive restart - public List CHANGED_PATHS = new ArrayList<>(); + @SuppressWarnings("WeakerAccess") public List CHANGED_PATHS = new ArrayList<>(); public void register(VirtualFile file) { final String path = file.getPath(); @@ -439,12 +440,9 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec private void gotoPlaceInfo(@NotNull PlaceInfo info) { // TODO: Msk final boolean wasActive = myToolWindowManager.isEditorComponentActive(); EditorWindow wnd = info.getWindow(); - final Pair editorsWithProviders; - if (wnd != null && wnd.isValid()) { - editorsWithProviders = myEditorManager.openFileWithProviders(info.getFile(), wasActive, wnd); - } else { - editorsWithProviders = myEditorManager.openFileWithProviders(info.getFile(), wasActive, false); - } + final Pair editorsWithProviders = wnd != null && wnd.isValid() + ? myEditorManager.openFileWithProviders(info.getFile(), wasActive, wnd) + : myEditorManager.openFileWithProviders(info.getFile(), wasActive, false); myEditorManager.setSelectedEditor(info.getFile(), info.getEditorTypeId()); @@ -504,11 +502,10 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec } private static final class PlaceInfo { - private final VirtualFile myFile; private final FileEditorState myNavigationState; private final String myEditorTypeId; - private final WeakReference myWindow; + private final Reference myWindow; PlaceInfo(@NotNull VirtualFile file, @NotNull FileEditorState navigationState, diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java index ec51ebdfe263..49183dce590d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java @@ -207,6 +207,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware { editor.putUserData(TEXT_EDITOR_KEY, textEditor); } + @NotNull protected TextEditorState getStateImpl(final Project project, @NotNull Editor editor, @NotNull FileEditorStateLevel level){ TextEditorState state = new TextEditorState(); CaretModel caretModel = editor.getCaretModel(); @@ -310,7 +311,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware { protected class EditorWrapper extends UserDataHolderBase implements TextEditor { private final Editor myEditor; - public EditorWrapper(@NotNull Editor editor) { + EditorWrapper(@NotNull Editor editor) { myEditor = editor; } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorState.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorState.java index d433f79c63b2..d9a18e0626b3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorState.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorState.java @@ -28,16 +28,15 @@ import java.util.Arrays; * @author Vladimir Kondratyev */ public final class TextEditorState implements FileEditorState { + CaretState[] CARETS; - public CaretState[] CARETS; - - public int RELATIVE_CARET_POSITION; // distance from primary caret to the top of editor's viewable area in pixels + int RELATIVE_CARET_POSITION; // distance from primary caret to the top of editor's viewable area in pixels /** * State which describes how editor is folded. - * This field can be null. + * This field can be {@code null}. */ - private CodeFoldingState myFoldingState; + private CodeFoldingState myFoldingState; @Nullable private Producer myDelayedFoldInfoProducer; private static final int MIN_CHANGE_DISTANCE = 4; @@ -54,12 +53,12 @@ public final class TextEditorState implements FileEditorState { * * @param producer delayed folding info producer */ - public void setDelayedFoldState(@NotNull Producer producer) { + void setDelayedFoldState(@NotNull Producer producer) { myDelayedFoldInfoProducer = producer; } @Nullable - public CodeFoldingState getFoldingState() { + CodeFoldingState getFoldingState() { // Assuming single-thread access here. if (myFoldingState == null && myDelayedFoldInfoProducer != null) { myFoldingState = myDelayedFoldInfoProducer.produce(); @@ -70,7 +69,7 @@ public final class TextEditorState implements FileEditorState { return myFoldingState; } - public void setFoldingState(@Nullable CodeFoldingState foldingState) { + void setFoldingState(@Nullable CodeFoldingState foldingState) { myFoldingState = foldingState; myDelayedFoldInfoProducer = null; } @@ -117,14 +116,14 @@ public final class TextEditorState implements FileEditorState { return Arrays.toString(CARETS); } - public static class CaretState { - public int LINE; - public int COLUMN; - public boolean LEAN_FORWARD; - public int SELECTION_START_LINE; - public int SELECTION_START_COLUMN; - public int SELECTION_END_LINE; - public int SELECTION_END_COLUMN; + static class CaretState { + int LINE; + int COLUMN; + boolean LEAN_FORWARD; + int SELECTION_START_LINE; + int SELECTION_START_COLUMN; + int SELECTION_END_LINE; + int SELECTION_END_COLUMN; public boolean equals(Object o) { if (!(o instanceof CaretState)) { diff --git a/platform/util/src/com/intellij/util/io/PersistentHashMap.java b/platform/util/src/com/intellij/util/io/PersistentHashMap.java index decd15b71183..e9465f3d760d 100644 --- a/platform/util/src/com/intellij/util/io/PersistentHashMap.java +++ b/platform/util/src/com/intellij/util/io/PersistentHashMap.java @@ -71,10 +71,10 @@ public class PersistentHashMap extends PersistentEnumeratorDelegate< } @NonNls - public static final String DATA_FILE_EXTENSION = ".values"; + static final String DATA_FILE_EXTENSION = ".values"; private long myLiveAndGarbageKeysCounter; // first four bytes contain live keys count (updated via LIVE_KEY_MASK), last four bytes - number of dead keys private int myReadCompactionGarbageSize; - private static final long LIVE_KEY_MASK = (1L << 32); + private static final long LIVE_KEY_MASK = 1L << 32; private static final long USED_LONG_VALUE_MASK = 1L << 62; private static final int POSITIVE_VALUE_SHIFT = 1; private final int myParentValueRefOffset; @@ -114,7 +114,7 @@ public class PersistentHashMap extends PersistentEnumeratorDelegate< private final SLRUCache myAppendCache; private boolean canUseIntAddressForNewRecord(long size) { - return myCanReEnumerate ? size + POSITIVE_VALUE_SHIFT < Integer.MAX_VALUE: false; + return myCanReEnumerate && size + POSITIVE_VALUE_SHIFT < Integer.MAX_VALUE; } private final LowMemoryWatcher myAppendCacheFlusher = LowMemoryWatcher.register(new Runnable() { @@ -293,7 +293,7 @@ public class PersistentHashMap extends PersistentEnumeratorDelegate< } } - public int getGarbageSize() { + int getGarbageSize() { return (int)myLiveAndGarbageKeysCounter; } @@ -302,7 +302,7 @@ public class PersistentHashMap extends PersistentEnumeratorDelegate< } @TestOnly // public for tests - public boolean makesSenseToCompact() { + boolean makesSenseToCompact() { if (myIsReadOnly) return false; final long fileSize = myValueStorage.getSize(); @@ -320,7 +320,7 @@ public class PersistentHashMap extends PersistentEnumeratorDelegate< return deadKeys > liveKeys || avgValueSize *deadKeys > benefitSize || - myReadCompactionGarbageSize > (fileSize / 2); + myReadCompactionGarbageSize > fileSize / 2; } return false; } diff --git a/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java b/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java index 3cef94d2490c..fecb6e16b5d1 100644 --- a/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java +++ b/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java @@ -50,7 +50,7 @@ public abstract class EdtInvocationManager { } /** - * 'True' {@link EdtInvocationManager} implementation which works with real EDT. + * The default {@link EdtInvocationManager} implementation which works with the EDT via SwingUtilities. */ private static class SwingEdtInvocationManager extends EdtInvocationManager { @Override