From 7913cc6dacc9b8f860194ca47937e5a09901ffdf Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 8 Oct 2019 18:07:11 +0200 Subject: [PATCH] Cleanup (warnings; typos; default methods) GitOrigin-RevId: 1ef5c5f7ff16c454feeb76b861bba719dd1e1289 --- .../inferNullity/AnnotateTask.java | 24 +------- .../OptimizeImportsRefactoringHelper.java | 8 --- .../vfs/newvfs/FileSystemInterface.java | 28 ++++----- .../src/com/intellij/util/SequentialTask.java | 35 ++++------- .../actions/AbstractLayoutCodeProcessor.java | 4 -- .../ex/PerformFixesModalTask.java | 9 +-- .../SuppressActionSequentialTask.java | 6 +- .../com/intellij/ide/util/DeleteHandler.java | 35 ++++------- .../CodeStyleSettingsCodeFragmentFilter.java | 8 --- .../refactoring/util/RefactoringUIUtil.java | 44 ++++---------- .../util/SequentialModalProgressTask.java | 59 ++++--------------- .../editor/ex/FocusChangeListener.java | 5 +- .../progress/util/PotemkinProgress.java | 10 ++-- .../vfs/impl/local/LocalFileSystemBase.java | 6 +- .../actions/UpdateCopyrightAction.java | 3 - ...ConvertSchemaPrefixToDefaultIntention.java | 9 --- 16 files changed, 65 insertions(+), 228 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java index deadcc7ada59..2ee2997a7f63 100644 --- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java +++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java @@ -1,18 +1,4 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.inferNullity; import com.intellij.codeInsight.NullableNotNullManager; @@ -38,10 +24,6 @@ class AnnotateTask implements SequentialTask { myTotal = infos.length; } - @Override - public void prepare() { - } - @Override public boolean isDone() { return myCount > myTotal - 1; @@ -58,8 +40,4 @@ class AnnotateTask implements SequentialTask { return isDone(); } - - @Override - public void stop() { - } } \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java b/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java index 8ff7246c78ba..554333d6faa7 100644 --- a/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java +++ b/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java @@ -111,10 +111,6 @@ class OptimizeImportsTask implements SequentialTask { myPointers = pointers.iterator(); } - @Override - public void prepare() { - } - @Override public boolean isDone() { return !myPointers.hasNext(); @@ -157,8 +153,4 @@ class OptimizeImportsTask implements SequentialTask { return isDone(); } - - @Override - public void stop() { - } } \ No newline at end of file diff --git a/platform/analysis-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java b/platform/analysis-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java index f802aa782ec0..7c36fa0f121c 100644 --- a/platform/analysis-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java +++ b/platform/analysis-api/src/com/intellij/openapi/vfs/newvfs/FileSystemInterface.java @@ -30,32 +30,24 @@ public interface FileSystemInterface { void setWritable(@NotNull VirtualFile file, boolean writableFlag) throws IOException; boolean isSymLink(@NotNull VirtualFile file); - @Nullable - String resolveSymLink(@NotNull VirtualFile file); + @Nullable String resolveSymLink(@NotNull VirtualFile file); - @NotNull - VirtualFile createChildDirectory(@Nullable Object requestor, @NotNull VirtualFile parent, @NotNull String dir) throws IOException; + @NotNull VirtualFile createChildDirectory(@Nullable Object requestor, @NotNull VirtualFile parent, @NotNull String dir) throws IOException; + @NotNull VirtualFile createChildFile(@Nullable Object requestor, @NotNull VirtualFile parent, @NotNull String file) throws IOException; - @NotNull - VirtualFile createChildFile(@Nullable Object requestor, @NotNull VirtualFile parent, @NotNull String file) throws IOException; + void deleteFile(Object requestor, @NotNull VirtualFile file) throws IOException; + void moveFile(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent) throws IOException; + void renameFile(Object requestor, @NotNull VirtualFile file, @NotNull String newName) throws IOException; - void deleteFile(final Object requestor, @NotNull VirtualFile file) throws IOException; - void moveFile(final Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent) throws IOException; - void renameFile(final Object requestor, @NotNull VirtualFile file, @NotNull String newName) throws IOException; + @NotNull VirtualFile copyFile(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent, @NotNull String copyName) throws IOException; - @NotNull - VirtualFile copyFile(final Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent, @NotNull String copyName) throws IOException; - - @NotNull - byte[] contentsToByteArray(@NotNull VirtualFile file) throws IOException; + @NotNull byte[] contentsToByteArray(@NotNull VirtualFile file) throws IOException; /** Does NOT strip the BOM from the beginning of the stream, unlike the {@link VirtualFile#getInputStream()} */ - @NotNull - InputStream getInputStream(@NotNull VirtualFile file) throws IOException; + @NotNull InputStream getInputStream(@NotNull VirtualFile file) throws IOException; /** Does NOT add the BOM to the beginning of the stream, unlike the {@link VirtualFile#getOutputStream(Object)} */ - @NotNull - OutputStream getOutputStream(@NotNull VirtualFile file, final Object requestor, final long modStamp, final long timeStamp) throws IOException; + @NotNull OutputStream getOutputStream(@NotNull VirtualFile file, Object requestor, long modStamp, long timeStamp) throws IOException; long getLength(@NotNull VirtualFile file); } \ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/util/SequentialTask.java b/platform/lang-api/src/com/intellij/util/SequentialTask.java index 6d5aebe5c51f..36f23a5d8656 100644 --- a/platform/lang-api/src/com/intellij/util/SequentialTask.java +++ b/platform/lang-api/src/com/intellij/util/SequentialTask.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import com.intellij.openapi.progress.ProgressIndicator; @@ -21,25 +7,24 @@ import org.jetbrains.annotations.NotNull; /** * Defines general contract for processing that may be executed by parts, i.e. it remembers the state after every iteration * and allows to resume the processing any time. - * + * * @author Denis Zhdanov */ public interface SequentialTask { - /** * Callback method that is assumed to be called before the processing. */ - void prepare(); + default void prepare() { } /** - * @return {@code true} if the processing is complete; {@code false} otherwise + * Returns {@code true} if the processing is complete, {@code false} otherwise. */ boolean isDone(); /** - * Asks current task to perform one more processing iteration. - * - * @return {@code true} if the processing is done; {@code false} otherwise + * Asks the current task to perform one more processing iteration. + * + * @return {@code true} if the processing is done, {@code false} otherwise. */ boolean iteration(); @@ -48,7 +33,7 @@ public interface SequentialTask { } /** - * Asks current task to stop the processing (if any). + * Asks the current task to stop the processing (if any). */ - void stop(); -} + default void stop() { } +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java index 1e5cd637093b..e513c961aedb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java @@ -452,10 +452,6 @@ public abstract class AbstractLayoutCodeProcessor { myProgressIndicator = indicator; } - @Override - public void prepare() { - } - @Override public boolean isDone() { return myStopFormatting; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/PerformFixesModalTask.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/PerformFixesModalTask.java index 5830c8327cec..628330762ff2 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/PerformFixesModalTask.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/PerformFixesModalTask.java @@ -44,10 +44,6 @@ public abstract class PerformFixesModalTask implements SequentialTask { myReformattingAspect = PostprocessReformattingAspect.getInstance(myProject); } - @Override - public void prepare() { - } - @Override public boolean isDone() { return myPackIdx > myDescriptorPacks.size() - 1; @@ -112,9 +108,6 @@ public abstract class PerformFixesModalTask implements SequentialTask { return isDone(); } - @Override - public void stop() {} - protected abstract void applyFix(Project project, CommonProblemDescriptor descriptor); private Pair nextDescriptor() { @@ -128,4 +121,4 @@ public abstract class PerformFixesModalTask implements SequentialTask { } return Pair.create(descriptor, shouldDoPostponedOperations); } -} +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java index 886292e92e12..e84ed0a4ca35 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java @@ -77,10 +77,6 @@ public class SuppressActionSequentialTask implements SequentialTask { return myCount > myNodesToSuppress.length - 1; } - @Override - public void stop() { - } - @Override public void prepare() { final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); @@ -133,4 +129,4 @@ public class SuppressActionSequentialTask implements SequentialTask { node.removeSuppressActionFromAvailable(mySuppressAction); } -} +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/ide/util/DeleteHandler.java b/platform/lang-impl/src/com/intellij/ide/util/DeleteHandler.java index 90423a5a13d2..e9c3aeeab710 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/DeleteHandler.java +++ b/platform/lang-impl/src/com/intellij/ide/util/DeleteHandler.java @@ -1,19 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util; import com.intellij.CommonBundle; @@ -62,8 +47,7 @@ import java.util.Collection; import java.util.List; public class DeleteHandler { - private DeleteHandler() { - } + private DeleteHandler() { } public static class DefaultDeleteProvider implements DeleteProvider { @Override @@ -201,19 +185,19 @@ public class DeleteHandler { private static void deleteInCommand(Project project, PsiElement[] elements) { CommandProcessor.getInstance().executeCommand(project, () -> NonProjectFileWritingAccessProvider.disableChecksDuring(() -> { SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(project); - List pointers = ContainerUtil.map(elements, smartPointerManager::createSmartPsiElementPointer); + List> pointers = ContainerUtil.map(elements, smartPointerManager::createSmartPsiElementPointer); if (!makeWritable(project, elements)) return; // deleted from project view or something like that. - if (CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext()) == null) { + @SuppressWarnings("deprecation") DataContext context = DataManager.getInstance().getDataContext(); + if (CommonDataKeys.EDITOR.getData(context) == null) { CommandProcessor.getInstance().markCurrentCommandAsGlobal(project); } - for (SmartPsiElementPointer pointer : pointers) { + for (SmartPsiElementPointer pointer : pointers) { PsiElement elementToDelete = pointer.getElement(); if (elementToDelete == null) continue; //was already deleted - doDelete(project, elementToDelete); } }), RefactoringBundle.message("safe.delete.command", RefactoringUIUtil.calculatePsiElementDescriptionList(elements)), null); @@ -223,7 +207,7 @@ public class DeleteHandler { if (elementToDelete instanceof PsiDirectory) { VirtualFile virtualFile = ((PsiDirectory)elementToDelete).getVirtualFile(); if (virtualFile.isInLocalFileSystem() && !virtualFile.is(VFileProperty.SYMLINK)) { - ArrayList readOnlyFiles = new ArrayList<>(); + List readOnlyFiles = new ArrayList<>(); CommonRefactoringUtil.collectReadOnlyFiles(virtualFile, readOnlyFiles); if (!readOnlyFiles.isEmpty()) { @@ -264,6 +248,7 @@ public class DeleteHandler { if (!clearFileReadOnlyFlags(project, element)) return; try { + //noinspection deprecation element.checkDelete(); } catch (IncorrectOperationException ex) { @@ -275,7 +260,7 @@ public class DeleteHandler { try { element.delete(); } - catch (final IncorrectOperationException ex) { + catch (IncorrectOperationException ex) { ApplicationManager.getApplication().invokeLater( () -> Messages.showMessageDialog(project, ex.getMessage(), CommonBundle.getErrorTitle(), Messages.getErrorIcon())); } @@ -312,4 +297,4 @@ public class DeleteHandler { } return true; } -} +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java index e9fdd9e277a5..3732a20b5216 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java @@ -239,10 +239,6 @@ public class CodeStyleSettingsCodeFragmentFilter { return oldValue; } - - @Override - public void prepare() { - } } public interface CodeStyleSettingsToShow { @@ -319,10 +315,6 @@ class CompositeSequentialTask implements SequentialTask { } } - @Override - public void prepare() { - } - @Override public void stop() { if (myCurrentTask != null) myCurrentTask.stop(); diff --git a/platform/lang-impl/src/com/intellij/refactoring/util/RefactoringUIUtil.java b/platform/lang-impl/src/com/intellij/refactoring/util/RefactoringUIUtil.java index eaf266ff2e7a..f97daa6c3ad7 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/util/RefactoringUIUtil.java +++ b/platform/lang-impl/src/com/intellij/refactoring/util/RefactoringUIUtil.java @@ -1,19 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.refactoring.util; import com.intellij.codeInsight.lookup.LookupManager; @@ -32,7 +17,6 @@ import com.intellij.usageView.UsageViewUtil; import com.intellij.util.Function; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -41,31 +25,27 @@ import java.util.Arrays; * @author yole */ public class RefactoringUIUtil { - private RefactoringUIUtil() { - } + private RefactoringUIUtil() { } public static String getDescription(@NotNull PsiElement element, boolean includeParent) { - return ElementDescriptionUtil.getElementDescription(element, includeParent - ? RefactoringDescriptionLocation.WITH_PARENT - : RefactoringDescriptionLocation.WITHOUT_PARENT); + RefactoringDescriptionLocation location = includeParent ? RefactoringDescriptionLocation.WITH_PARENT : RefactoringDescriptionLocation.WITHOUT_PARENT; + return ElementDescriptionUtil.getElementDescription(element, location); } - public static void processIncorrectOperation(final Project project, IncorrectOperationException e) { - @NonNls String message = e.getMessage(); - final int index = message != null ? message.indexOf("java.io.IOException") : -1; + public static void processIncorrectOperation(Project project, IncorrectOperationException e) { + String message = e.getMessage(); + int index = message != null ? message.indexOf("java.io.IOException") : -1; if (index > 0) { message = message.substring(index + "java.io.IOException".length()); } - final String s = message; + String s = message; ApplicationManager.getApplication().invokeLater( () -> Messages.showMessageDialog(project, s, RefactoringBundle.message("error.title"), Messages.getErrorIcon())); } public static String calculatePsiElementDescriptionList(PsiElement[] elements) { - final Function presentationFun = element -> UsageViewUtil.getType(element) + - " " + - DescriptiveNameUtil.getDescriptiveName(element); + Function presentationFun = e -> UsageViewUtil.getType(e) + ' ' + DescriptiveNameUtil.getDescriptiveName(e); return StringUtil.join(ContainerUtil.map2LinkedSet(Arrays.asList(elements), presentationFun), ", "); } @@ -76,9 +56,5 @@ public class RefactoringUIUtil { editor.getSelectionModel().setSelection(0, editor.getDocument().getTextLength()); } } - - @Override - public void focusLost(@NotNull Editor editor) { - } }); -} +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/util/SequentialModalProgressTask.java b/platform/lang-impl/src/com/intellij/util/SequentialModalProgressTask.java index d11e6cea2998..832049daeb6a 100644 --- a/platform/lang-impl/src/com/intellij/util/SequentialModalProgressTask.java +++ b/platform/lang-impl/src/com/intellij/util/SequentialModalProgressTask.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import com.intellij.openapi.application.ApplicationManager; @@ -23,16 +9,14 @@ import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.lang.reflect.InvocationTargetException; - /** - * Allows to execute {@link SequentialTask} under modal progress. - * + * Allows executing {@link SequentialTask} under modal progress. + * * @author Denis Zhdanov */ public class SequentialModalProgressTask extends Task.Modal { private static final Logger LOG = Logger.getInstance(SequentialModalProgressTask.class); - + private static final long DEFAULT_MIN_ITERATION_MIN_TIME = 500; /** @@ -69,17 +53,17 @@ public class SequentialModalProgressTask extends Task.Modal { } } - public void doRun(@NotNull ProgressIndicator indicator) throws InvocationTargetException, InterruptedException { + public void doRun(@NotNull ProgressIndicator indicator) { final SequentialTask task = myTask; if (task == null) { return; } - + myIndicator = indicator; indicator.setIndeterminate(false); prepare(task); - - // We need to sync background thread and EDT here in order to avoid situation when event queue is full of processing requests. + + // We need to sync background thread and EDT here in order to avoid a situation when event queue is full of processing requests. while (!task.isDone()) { if (indicator.isCanceled()) { task.stop(); @@ -107,36 +91,17 @@ public class SequentialModalProgressTask extends Task.Modal { public void setTask(@Nullable SequentialTask task) { myTask = task; } - + public ProgressIndicator getIndicator() { return myIndicator; } /** * Executes preliminary jobs prior to the target sequential task processing ({@link SequentialTask#prepare()} by default). - * - * @param task task to be executed + * + * @param task task to be executed */ protected void prepare(@NotNull SequentialTask task) { task.prepare(); } - - public abstract static class Adapter extends SequentialModalProgressTask implements SequentialTask { - public Adapter(@Nullable Project project, @NotNull String title) { - super(project, title); - setTask(this); - } - - public Adapter(@Nullable Project project, @NotNull String title, boolean canBeCancelled) { - super(project, title, canBeCancelled); - } - - @Override - public void prepare() { - } - - @Override - public void stop() { - } - } -} +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/FocusChangeListener.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/FocusChangeListener.java index 9c7e3b27fd3f..668c3d8ce324 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/FocusChangeListener.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/FocusChangeListener.java @@ -12,8 +12,7 @@ import java.util.EventListener; */ public interface FocusChangeListener extends EventListener { void focusGained(@NotNull Editor editor); - default void focusLost(@NotNull Editor editor) { - } + default void focusLost(@NotNull Editor editor) { } default void focusLost(@NotNull Editor editor, @SuppressWarnings("unused") @NotNull FocusEvent event) { focusLost(editor); @@ -21,4 +20,4 @@ public interface FocusChangeListener extends EventListener { default void focusGained(@NotNull Editor editor, @SuppressWarnings("unused") @NotNull FocusEvent event) { focusGained(editor); } -} +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/PotemkinProgress.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/PotemkinProgress.java index 1a011c3eb9de..378571b8b71d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/util/PotemkinProgress.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/PotemkinProgress.java @@ -58,12 +58,14 @@ public class PotemkinProgress extends ProgressWindow implements PingProgress { } private static boolean isUrgentInvocationEvent(AWTEvent event) { - // LWCToolkit does invokeAndWait which blocks native event processing until finished. The OS considers that blockage to be + // LWCToolkit does 'invokeAndWait', which blocks native event processing until finished. The OS considers that blockage to be // app freeze, stops rendering UI and shows beach-ball cursor. We want the UI to act (almost) normally in write-action progresses, // so we let these specific events to be dispatched, hoping they wouldn't access project/code model. // problem (IDEA-192282): LWCToolkit event might be posted before PotemkinProgress appears, // and it then just sits in the queue blocking the whole UI until the progress is finished. + + //noinspection SpellCheckingInspection return event.toString().contains(",runnable=sun.lwawt.macosx.LWCToolkit") || event instanceof MyInvocationEvent; } @@ -171,7 +173,7 @@ public class PotemkinProgress extends ProgressWindow implements PingProgress { /** * Repaint just the dialog panel. We must not call custom paint methods during write action, - * because they might access the model which might be inconsistent at that moment. + * because they might access the model, which might be inconsistent at that moment. */ private void paintProgress() { getDialog().myRepaintRunnable.run(); @@ -228,8 +230,8 @@ public class PotemkinProgress extends ProgressWindow implements PingProgress { } private static class MyInvocationEvent extends InvocationEvent { - public MyInvocationEvent(Object source, Runnable runnable) { + MyInvocationEvent(Object source, Runnable runnable) { super(source, runnable); } } -} +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java index e6be91eed295..5c22b5488b51 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java @@ -731,12 +731,10 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { @Override public boolean hasChildren(@NotNull VirtualFile file) { if (file.getParent() == null) { - // assume roots always have children - return true; + return true; // assume roots always have children } - // make sure to not load all children try (DirectoryStream stream = Files.newDirectoryStream(Paths.get(file.getPath()))) { - return stream.iterator().hasNext(); + return stream.iterator().hasNext(); // make sure to not load all children } catch (InvalidPathException | IOException | SecurityException e) { return true; diff --git a/plugins/copyright/src/com/maddyhome/idea/copyright/actions/UpdateCopyrightAction.java b/plugins/copyright/src/com/maddyhome/idea/copyright/actions/UpdateCopyrightAction.java index 2df052e5f5e3..d67d90caf3d3 100644 --- a/plugins/copyright/src/com/maddyhome/idea/copyright/actions/UpdateCopyrightAction.java +++ b/plugins/copyright/src/com/maddyhome/idea/copyright/actions/UpdateCopyrightAction.java @@ -169,9 +169,6 @@ public class UpdateCopyrightAction extends BaseAnalysisAction { mySize = runnables.size(); } - @Override - public void prepare() {} - @Override public boolean isDone() { return myIdx > mySize - 1; diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/ConvertSchemaPrefixToDefaultIntention.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/ConvertSchemaPrefixToDefaultIntention.java index 390288e728a3..db330b94d172 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/ConvertSchemaPrefixToDefaultIntention.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/ConvertSchemaPrefixToDefaultIntention.java @@ -110,10 +110,6 @@ public class ConvertSchemaPrefixToDefaultIntention extends PsiElementBaseIntenti int tagIndex = 0; int attrIndex = 0; - @Override - public void prepare() { - } - @Override public boolean isDone() { return tagIndex + attrIndex >= totalCount; @@ -139,11 +135,6 @@ public class ConvertSchemaPrefixToDefaultIntention extends PsiElementBaseIntenti return isDone(); } - - @Override - public void stop() { - - } }); ProgressManager.getInstance().run(progressTask); }