From 43673ee4bdd39490ba6555c515c448ed8f3f9037 Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Tue, 24 May 2016 12:25:16 +0200 Subject: [PATCH] block lambda -> expr lambda --- .../compiler/BaseCompilerTestCase.java | 4 +- .../debugger/actions/ExportThreadsAction.java | 4 +- .../actions/ForceEarlyReturnAction.java | 10 +- .../actions/ToggleFieldBreakpointAction.java | 4 +- .../debugger/engine/JavaStackFrame.java | 4 +- .../intellij/debugger/engine/JavaValue.java | 4 +- ...AlternativeSourceNotificationProvider.java | 4 +- .../ui/breakpoints/BreakpointManager.java | 4 +- .../ApplicationRunLineMarkerProvider.java | 4 +- .../impl/DefaultJavaProgramRunner.java | 8 +- .../testDiscovery/TestDiscoveryExtension.java | 4 +- .../com/intellij/ide/impl/NewProjectUtil.java | 4 +- .../ide/projectWizard/ProjectTypeStep.java | 4 +- .../newProjectWizard/modes/ImportMode.java | 4 +- .../util/projectWizard/JdkChooserPanel.java | 4 +- .../openapi/projectRoots/ui/SdkEditor.java | 4 +- .../IdeaProjectSettingsService.java | 16 +- .../ui/configuration/ModulesConfigurator.java | 8 +- .../libraryEditor/LibraryRootsComponent.java | 4 +- .../ModuleStructureConfigurable.java | 4 +- .../SuppressWarningsFoldingBuilder.java | 8 +- .../quickfix/DeleteRepeatedInterfaceFix.java | 4 +- .../quickfix/FlipIntersectionSidesFix.java | 4 +- .../SimplifyBooleanExpressionFix.java | 8 +- .../dataFlow/DfaInstructionState.java | 4 +- .../dataFlow/DfaMemoryStateImpl.java | 4 +- .../codeInspection/dataFlow/DfaUtil.java | 8 +- .../dataFlow/MethodContract.java | 4 +- .../nullable/NullableStuffInspectionBase.java | 4 +- .../reference/RefClassImpl.java | 4 +- .../reference/RefFieldImpl.java | 4 +- .../reference/RefMethodImpl.java | 4 +- .../reference/RefPackageImpl.java | 4 +- .../reference/RefParameterImpl.java | 4 +- .../UnusedLibrariesInspection.java | 4 +- .../ExternalAnnotationsManagerImpl.java | 6 +- .../MakeInferredAnnotationExplicit.java | 6 +- .../completion/JavaCompletionUtil.java | 8 +- .../JavaSmartCompletionContributor.java | 4 +- .../SameSignatureCallParametersProvider.java | 4 +- .../TypeArgumentCompletionProvider.java | 4 +- .../daemon/impl/actions/AddImportAction.java | 4 +- ...ieldInitializerToConstructorThrowsFix.java | 4 +- .../impl/quickfix/AddMethodQualifierFix.java | 4 +- .../ChangeMethodSignatureFromUsageFix.java | 4 +- .../quickfix/ChangeParameterClassFix.java | 8 +- ...reateConstructorParameterFromFieldFix.java | 4 +- .../CreateEnumConstantFromUsageFix.java | 4 +- .../impl/quickfix/CreateFromUsageBaseFix.java | 4 +- .../CreateMethodFromMethodReferenceFix.java | 4 +- .../quickfix/CreatePropertyFromUsageFix.java | 4 +- .../quickfix/CreateStaticMethodQuickFix.java | 4 +- .../InitializeFinalFieldInConstructorFix.java | 8 +- .../daemon/impl/quickfix/OrderEntryFix.java | 4 +- .../quickFix/CreateClassOrPackageFix.java | 4 +- ...RedundantLambdaParameterTypeIntention.java | 8 +- .../CopyPasteReferenceProcessor.java | 4 +- .../GenerateAccessorProviderRegistrar.java | 4 +- .../GenerateConstructorHandler.java | 8 +- .../JavaOverrideImplementMemberChooser.java | 4 +- .../generation/OverrideImplementUtil.java | 8 +- .../impls/ReferenceParameterInfoHandler.java | 4 +- ...pyAbstractMethodImplementationHandler.java | 4 +- .../javadoc/JavaDocInfoGenerator.java | 4 +- .../template/macro/GroovyScriptMacro.java | 4 +- .../JavaPostfixTemplateProvider.java | 12 +- ...anBeReplacedWithConstructorInspection.java | 4 +- .../emptyMethod/EmptyMethodInspection.java | 8 +- .../InferNullityAnnotationsAction.java | 4 +- .../inferNullity/NullityInferrer.java | 4 +- .../java18StreamApi/AddMethodsDialog.java | 4 +- .../PseudoLambdaReplaceTemplate.java | 4 +- .../method/OverrideImplementMethodAction.java | 58 +++--- .../internal/StaticIconFieldsAction.java | 4 +- .../projectRoots/impl/JavaSdkImpl.java | 8 +- .../impl/LanguageLevelUsagesCollector.java | 4 +- .../psi/refResolve/RefResolveServiceImpl.java | 8 +- .../psi/stubsHierarchy/impl/PsiEnter.java | 4 +- .../impl/PsiHierachyConnector.java | 4 +- .../impl/test/TestStubHierarchyAction.java | 4 +- .../TypeParameterInfo.java | 4 +- .../extractMethod/ExtractMethodProcessor.java | 4 +- .../ExtractMethodObjectHandler.java | 12 +- .../extractclass/ExtractClassProcessor.java | 4 +- .../inline/InlineMethodProcessor.java | 4 +- .../inline/InlineToAnonymousClassHandler.java | 4 +- .../ReplaceConstructorUsageInfo.java | 8 +- .../usageInfo/ReplaceReferenceUsageInfo.java | 4 +- .../ReplaceStaticImportUsageInfo.java | 4 +- .../ReplaceWithSubtypeUsageInfo.java | 4 +- .../MoveClassToInnerProcessor.java | 4 +- .../MoveClassesOrPackagesDialog.java | 4 +- .../MoveClassesOrPackagesImpl.java | 6 +- .../MoveClassesOrPackagesUtil.java | 4 +- .../move/moveInner/MoveInnerProcessor.java | 4 +- .../JavaSafeDeleteDelegateImpl.java | 4 +- .../safeDelete/JavaSafeDeleteProcessor.java | 4 +- .../SafeDeleteJavaCalleeChooser.java | 4 +- .../SafeDeleteJavaCallerChooser.java | 4 +- .../TurnRefsToSuperProcessorBase.java | 4 +- .../typeMigration/TypeEvaluator.java | 4 +- .../typeMigration/TypeMigrationLabeler.java | 8 +- .../typeMigration/TypeMigrationProcessor.java | 4 +- .../typeMigration/ui/MigrationPanel.java | 4 +- .../intellij/refactoring/util/InlineUtil.java | 4 +- .../duplicates/MethodDuplicatesHandler.java | 4 +- .../createTest/GenerateMissedTestsAction.java | 4 +- .../createTest/JavaTestGenerator.java | 4 +- .../createTest/MissedTestsDialog.java | 4 +- .../intellij/unscramble/UnscrambleDialog.java | 4 +- .../impl/search/AllClassesSearchExecutor.java | 4 +- .../JavaFunctionalExpressionSearcher.java | 4 +- .../graphInference/InferenceVariable.java | 8 + .../StrictSubtypingConstraint.java | 4 +- .../constraints/TypeEqualityConstraint.java | 4 +- .../codeInsight/ExternalJavadocUrlsTest.java | 4 +- .../codeInsight/GenerateEquals15Test.java | 4 +- .../codeInsight/GenerateEqualsTestCase.java | 8 +- .../GenerateSuperMethodCallTest.java | 4 +- .../daemon/HighlightStressTest.java | 4 +- .../daemon/UnusedSymbolLocalTest.java | 4 +- .../impl/DaemonRespondToChangesTest.java | 40 ++--- .../daemon/impl/JavaGotoSuperTest.java | 8 +- .../daemon/quickFix/I18nizeTest.java | 8 +- .../daemon/quickFix/OrderEntryTest.java | 4 +- .../surroundWith/JavaSurroundWithTest.java | 8 +- .../FileIndentProviderTest.java | 12 +- .../intention/SplitIfActionTest.java | 4 +- .../navigation/RunLineMarkerTest.java | 4 +- .../codeInsight/psi/ControlFlowTest.java | 4 +- .../template/TemplateBuilderTest.java | 4 +- .../com/intellij/find/FindManagerTest.java | 20 +-- ...gProcessingOnDocumentModificationTest.java | 4 +- .../roots/impl/DirectoryIndexTest.java | 12 +- .../roots/impl/ProjectLibrariesTest.java | 4 +- .../projectView/ProjectViewUpdatingTest.java | 14 +- .../psi/ArrayIndexOutOfBoundsTest.java | 4 +- .../com/intellij/psi/CodeFragmentsTest.java | 4 +- .../com/intellij/psi/LibraryOrderTest.java | 4 +- .../testSrc/com/intellij/psi/MiscPsiTest.java | 12 +- .../psi/NormalizeDeclarationTest.java | 8 +- .../psi/PsiConcurrencyStressTest.java | 4 +- .../psi/PsiModificationTrackerTest.java | 16 +- .../intellij/psi/SrcRepositoryUseTest.java | 12 +- .../TreeIsCorrectAfterDiffReparseTest.java | 4 +- .../java/DefaultProjectFormatterTest.java | 4 +- .../java/JavaFormatterInEditorTest.java | 4 +- .../psi/impl/file/impl/PsiEventsTest.java | 12 +- .../impl/file/impl/TempFileSystemTest.java | 4 +- .../SmartPsiElementPointersTest.java | 78 +++----- .../tree/java/ExtendsBoundListTest.java | 12 +- .../tree/java/JavadocParamTagsTest.java | 12 +- .../psi/resolve/ResolvePerformanceTest.java | 4 +- .../refactoring/ChangeSignatureTest.java | 24 +-- .../intellij/refactoring/CopyClassTest.java | 4 +- .../intellij/refactoring/MoveMembersTest.java | 4 +- .../intellij/refactoring/SafeDeleteTest.java | 4 +- .../refactoring/TurnRefsToSuperTest.java | 4 +- .../com/intellij/roots/InheritedJdkTest.java | 24 +-- .../roots/ManagingContentRootsTest.java | 4 +- .../roots/MultiModuleEditingTest.java | 12 +- .../intellij/roots/libraries/LibraryTest.java | 8 +- .../codeInsight/CodeInsightTestCase.java | 4 +- .../completion/CompletionTestCase.java | 4 +- .../quickFix/LightQuickFixTestCase.java | 4 +- .../projectWizard/ProjectWizardTestCase.java | 16 +- .../refactoring/MultiFileTestCase.java | 4 +- .../testFramework/ResolveTestCase.java | 4 +- .../TestSourceBasedTestCase.java | 4 +- .../refactoring/TypeMigrationTestBase.java | 4 +- .../JsonStructureViewElement.java | 4 +- .../impl/JsonBySchemaObjectAnnotator.java | 4 +- .../impl/JsonSchemaServiceImpl.java | 4 +- .../JsonSchemaCrossReferencesTest.java | 16 +- .../schemaFile/JsonSchemaFileResolveTest.java | 16 +- .../com/intellij/analysis/AnalysisScope.java | 8 +- .../intention/IntentionActionBean.java | 4 +- .../daemon/InspectionProfileConvertor.java | 4 +- .../daemon/impl/HighlightInfo.java | 4 +- .../SuppressIntentionActionFromFix.java | 4 +- .../ex/GlobalInspectionContextBase.java | 4 +- .../ex/InspectionProfileImpl.java | 4 +- .../reference/RefDirectoryImpl.java | 4 +- .../reference/RefEntityImpl.java | 4 +- .../codeInspection/reference/RefFileImpl.java | 4 +- .../reference/RefModuleImpl.java | 4 +- .../providers/NullFileReferenceHelper.java | 4 +- .../intellij/diff/DiffContentFactoryImpl.java | 4 +- .../diff/actions/DocumentsSynchronizer.java | 6 +- .../diff/impl/CacheDiffRequestProcessor.java | 4 +- .../intellij/diff/impl/DiffWindowBase.java | 8 +- .../intellij/diff/merge/TextMergeChange.java | 12 +- .../intellij/diff/merge/TextMergeViewer.java | 46 ++--- .../diff/requests/TextMergeRequestImpl.java | 4 +- .../intellij/diff/tools/ErrorDiffTool.java | 4 +- .../tools/binary/TwosideBinaryDiffViewer.java | 4 +- .../tools/external/ExternalDiffToolUtil.java | 8 +- .../tools/fragmented/UnifiedDiffViewer.java | 4 +- .../diff/tools/simple/SimpleDiffChange.java | 4 +- .../diff/tools/simple/SimpleDiffViewer.java | 8 +- .../diff/tools/util/SyncScrollSupport.java | 4 +- .../TransferableFileEditorStateSupport.java | 4 +- .../tools/util/base/HighlightingLevel.java | 12 +- .../src/com/intellij/diff/util/DiffUtil.java | 18 +- .../psi/impl/search/PsiSearchHelperImpl.java | 4 +- .../daemon/RelatedItemLineMarkerInfo.java | 4 +- .../com/intellij/execution/RunManager.java | 4 +- .../facet/frameworks/beans/ArtifactItem.java | 4 +- .../facet/ui/FacetDependentToolWindow.java | 4 +- .../ide/util/projectWizard/ModuleBuilder.java | 4 +- .../codeInsight/AutoPopupController.java | 20 +-- .../actions/AbstractLayoutCodeProcessor.java | 12 +- .../completion/StatisticsWeigher.java | 4 +- .../actions/HippieWordCompletionHandler.java | 4 +- .../impl/LiftShorterItemsClassifier.java | 4 +- .../daemon/impl/GutterIntentionAction.java | 4 +- .../impl/IntentionHintComponent.java | 4 +- .../intention/impl/QuickEditHandler.java | 8 +- .../config/IntentionDescriptionPanel.java | 4 +- .../lookup/ComparingClassifier.java | 4 +- .../navigation/BackgroundUpdaterTask.java | 4 +- .../actions/SaveAsTemplateAction.java | 4 +- .../template/impl/EditVariableDialog.java | 14 +- .../LiveTemplateLookupActionProvider.java | 4 +- .../impl/LiveTemplateSettingsEditor.java | 12 +- .../template/impl/TemplateManagerImpl.java | 4 +- .../template/impl/TemplateState.java | 4 +- .../templates/PostfixLiveTemplate.java | 18 +- ...PostfixTemplateWithExpressionSelector.java | 4 +- .../codeInspection/InspectionApplication.java | 4 +- .../ex/InspectionManagerEx.java | 4 +- .../ex/InspectionProfileManagerImpl.java | 12 +- ...entVariablesTextFieldWithBrowseButton.java | 12 +- .../console/LanguageConsoleImpl.java | 4 +- .../console/RunIdeConsoleAction.java | 12 +- ...ctRunConfigurationTypeUsagesCollector.java | 4 +- .../execution/lineMarker/ExecutorAction.java | 8 +- .../ProjectStartupConfigurationBase.java | 4 +- .../ui/layout/impl/RunnerContentUi.java | 4 +- .../invalid/MultipleInvalidFacetEditor.java | 4 +- .../statistics/FrameworkUsagesCollector.java | 4 +- .../statistics/ModuleTypeUsagesCollector.java | 4 +- .../find/findUsages/FindUsagesManager.java | 8 +- .../PsiElement2UsageTargetComposite.java | 4 +- .../com/intellij/find/impl/FindDialog.java | 8 +- .../intellij/find/impl/FindPopupPanel.java | 4 +- .../SelectedTextFormatter.java | 8 +- .../ide/actions/ApplyIntentionAction.java | 4 +- .../favoritesTreeView/FavoritesManager.java | 8 +- .../UsageProjectTreeNode.java | 4 +- .../actions/CreateFromTemplateActionBase.java | 4 +- .../impl/AllFileTemplatesConfigurable.java | 12 +- .../impl/FileTemplateTabAsTree.java | 4 +- .../intellij/ide/impl/PatchProjectUtil.java | 4 +- .../ide/navigationToolbar/NavBarModel.java | 4 +- .../projectView/BaseProjectTreeBuilder.java | 4 +- .../projectView/impl/RenameModuleHandler.java | 4 +- .../ide/scopeView/EditScopesAction.java | 4 +- .../ide/scopeView/ScopeTreeViewPanel.java | 4 +- .../intellij/ide/scopeView/ScopeViewPane.java | 4 +- .../intellij/ide/scratch/LRUPopupBuilder.java | 14 +- .../intellij/ide/util/FileStructurePopup.java | 4 +- .../ide/util/PlatformPackageUtil.java | 4 +- .../ide/util/TreeFileChooserDialog.java | 4 +- .../gotoByName/GotoActionItemProvider.java | 14 +- .../formattingblocks/BlockTreeNode.java | 4 +- .../actions/GotoModuleDirectory.java | 4 +- .../fileTypes/FileTypeUsagesCollector.java | 4 +- .../impl/SdkConfigurationUtil.java | 8 +- .../impl/libraries/RenameLibraryHandler.java | 4 +- .../PlatformContentEntriesConfigurable.java | 4 +- .../openapi/util/registry/RegistryUi.java | 4 +- .../ui/DependenciesPanel.java | 4 +- .../ui/DependenciesUsagesPanel.java | 4 +- .../platform/ModuleAttachProcessor.java | 4 +- .../renameProject/RenameProjectHandler.java | 4 +- .../SaveProjectAsTemplateDialog.java | 4 +- .../ui/InspectionsAggregationUtil.java | 4 +- .../ui/SingleInspectionProfilePanel.java | 8 +- .../ui/table/ScopesAndSeveritiesTable.java | 4 +- .../ui/table/SeverityRenderer.java | 4 +- .../CodeStyleSettingsCodeFragmentFilter.java | 4 +- .../common/InjectedLanguageBlockWrapper.java | 4 +- .../source/PostprocessReformattingAspect.java | 4 +- .../tree/injected/MultiHostRegistrarImpl.java | 4 +- .../com/intellij/psi/stubs/StubIndexImpl.java | 4 +- .../psi/stubs/StubProcessingHelper.java | 4 +- .../TemplateDataLanguagePatterns.java | 4 +- .../changeSignature/CallerChooserBase.java | 4 +- .../changeSignature/MethodNodeBase.java | 4 +- .../extractMethod/ExtractMethodHelper.java | 4 +- .../inplace/AbstractInplaceIntroducer.java | 8 +- .../lang/ExtractIncludeFileBase.java | 4 +- .../refactoring/rename/RenameProcessor.java | 4 +- .../inplace/VariableInplaceRenamer.java | 8 +- .../rename/naming/NameSuggester.java | 4 +- .../refactoring/ui/RefactoringDialog.java | 4 +- .../debugger/extensions/PlaybackDebugger.java | 8 +- .../com/intellij/usageView/UsageViewUtil.java | 4 +- .../util/LogicalRootsManagerImpl.java | 8 +- .../packaging/InstalledPackagesPanel.java | 6 +- .../packaging/ManagePackagesDialog.java | 8 +- .../history/integration/IdeaGateway.java | 4 +- .../com/intellij/execution/util/ExecUtil.java | 8 +- .../ide/util/BrowseFilesListener.java | 4 +- .../openapi/diff/DocumentsSynchronizer.java | 4 +- .../openapi/ui/ComponentWithBrowseButton.java | 4 +- .../openapi/ui/MasterDetailsComponent.java | 4 +- .../intellij/ui/EditorNotificationPanel.java | 4 +- .../com/intellij/ui/tabs/impl/TabLabel.java | 8 +- .../util/net/ssl/CertificateTreeBuilder.java | 4 +- .../util/ui/update/MergingUpdateQueue.java | 8 +- .../diagnostic/GroupedLogMessage.java | 4 +- .../execution/DelayedDocumentWatcher.java | 8 +- .../intellij/ide/CommandLineProcessor.java | 4 +- .../ide/MacOSApplicationProvider.java | 4 +- .../com/intellij/ide/actions/Switcher.java | 8 +- .../ide/dnd/LinuxDragAndDropSupport.java | 4 +- .../DisabledPluginsUsagesCollector.java | 4 +- .../plugins/InstalledPluginsManagerMain.java | 8 +- .../plugins/InstalledPluginsTableModel.java | 4 +- .../NonBundledPluginsUsagesCollector.java | 4 +- .../intellij/ide/plugins/PluginInstaller.java | 8 +- .../plugins/PluginManagerConfigurable.java | 4 +- .../ide/plugins/PluginManagerMain.java | 12 +- .../com/intellij/ide/plugins/PluginTable.java | 8 +- .../ide/startupWizard/SelectPluginsStep.java | 4 +- .../internal/statistic/UsageTrigger.java | 4 +- .../connect/StatisticsConnectionService.java | 4 +- .../com/intellij/notification/EventLog.java | 4 +- .../impl/NotificationsManagerImpl.java | 4 +- .../openapi/diff/actions/MergeOperations.java | 4 +- .../diff/impl/incrementalMerge/Change.java | 4 +- .../ui/ApplyNonConflicts.java | 22 ++- .../diff/impl/mergeTool/MergeVersion.java | 8 +- .../openapi/editor/impl/CaretModelImpl.java | 4 +- .../actions/GotoDesktopDirAction.java | 4 +- .../fileChooser/actions/GotoHomeAction.java | 4 +- .../actions/GotoProjectDirectory.java | 4 +- .../openapi/fileChooser/ex/LocalFsFinder.java | 4 +- .../impl/FileDocumentManagerImpl.java | 34 ++-- .../fileEditor/impl/http/HttpFileEditor.java | 4 +- .../openapi/fileTypes/ex/FileTypeChooser.java | 4 +- .../impl/ApproveRemovedMappingsActivity.java | 4 +- .../fileTypes/impl/FileTypeManagerImpl.java | 4 +- .../progress/impl/ProgressManagerImpl.java | 8 +- .../progress/util/BackgroundTaskUtil.java | 4 +- .../openapi/progress/util/ProgressDialog.java | 4 +- .../project/impl/ProjectManagerImpl.java | 4 +- .../intellij/openapi/ui/ex/MessagesEx.java | 4 +- .../commands/AlphaNumericTypeCommand.java | 4 +- .../playback/commands/KeyCodeTypeCommand.java | 4 +- .../ui/playback/util/EditorPlaybackCall.java | 8 +- .../util/WindowSystemPlaybackCall.java | 12 +- .../impl/UpdateCheckerComponent.java | 4 +- .../PluginsAdvertiser.java | 4 +- .../intellij/openapi/util/RequestsMerger.java | 4 +- .../readOnlyHandler/ReadOnlyStatusDialog.java | 4 +- .../vfs/impl/jar/JarFileSystemImpl.java | 4 +- .../openapi/vfs/impl/local/FileWatcher.java | 4 +- .../newvfs/persistent/PersistentFSImpl.java | 4 +- .../openapi/wm/impl/PaintersHelper.java | 4 +- .../welcomeScreen/RecentProjectPanel.java | 4 +- .../compiler/PatternCompilerImpl.java | 4 +- .../platform/OpenDirectoryProjectAction.java | 4 +- .../PlatformProjectOpenProcessor.java | 4 +- .../intellij/platform/ProjectSetReader.java | 4 +- .../impl/StatisticsManagerImpl.java | 4 +- .../src/com/intellij/ui/EditorComboBox.java | 14 +- .../src/com/intellij/ui/EditorTextField.java | 18 +- .../src/com/intellij/ui/FocusTrackback.java | 16 +- .../src/com/intellij/ui/TableSpeedSearch.java | 4 +- .../ui/mac/MacFileChooserDialogImpl.java | 20 +-- .../com/intellij/ui/popup/AbstractPopup.java | 4 +- .../intellij/ui/popup/PopupFactoryImpl.java | 4 +- .../src/com/intellij/util/ui/SwingHelper.java | 4 +- .../SelectionQuotingTypedHandlerTest.java | 4 +- .../process/AnsiEscapeDecoderTest.java | 4 +- .../formatting/TestFormattingModel.java | 4 +- .../history/integration/BasicsTest.java | 18 +- .../integration/IntegrationTestCase.java | 8 +- .../CodeSamplesCorrectnessTest.java | 4 +- .../impl/LightFileTemplatesTest.java | 4 +- .../intellij/module/ModulePointerTest.java | 4 +- .../application/impl/ApplicationImplTest.java | 8 +- .../application/impl/LaterInvocatorTest.java | 4 +- .../intellij/openapi/editor/DocumentTest.java | 16 +- .../intellij/openapi/editor/FoldingTest.java | 16 +- .../openapi/editor/impl/EditorImplTest.java | 2 +- .../impl/TrailingSpacesStripperTest.java | 4 +- ...apApplianceOnDocumentModificationTest.java | 20 +-- .../view/LogicalPositionCacheStressTest.java | 12 +- .../richcopy/SyntaxInfoConstructionTest.java | 4 +- .../FileDocumentManagerImplTest.java | 60 ++----- .../fileEditor/FileEditorManagerTest.java | 4 +- .../FileTypeUsagesCollectorTest.java | 8 +- .../openapi/fileTypes/impl/FileTypesTest.java | 162 +++++++---------- .../progress/impl/ProgressIndicatorTest.java | 4 +- .../vfs/impl/VirtualFilePointerTest.java | 4 +- .../psi/impl/PsiDocumentManagerImplTest.java | 56 ++---- .../intellij/usages/impl/UsageViewTest.java | 8 +- .../com/intellij/util/JdkBundleTest.java | 4 +- .../concurrency/BoundedTaskExecutorTest.java | 30 ++-- .../intellij/util/ui/tree/TreeUtilTest.java | 4 +- .../options/ReplacePathToMacroMap.java | 4 +- .../module/impl/ModuleManagerImpl.java | 8 +- .../projectRoots/impl/ProjectJdkImpl.java | 4 +- .../roots/impl/OrderEnumeratorBase.java | 4 +- .../impl/libraries/LibraryTableBase.java | 4 +- .../RemoteServerListConfigurable.java | 4 +- .../runtime/ui/tree/ServersTreeStructure.java | 4 +- .../util/CloudServerRuntimeInstance.java | 4 +- .../actions/AbstractImportTestsAction.java | 4 +- .../history/actions/ImportTestsGroup.java | 4 +- .../states/TestComparisonFailedStates.java | 4 +- .../impl/matcher/MatcherImpl.java | 4 +- .../plugin/replace/impl/Replacer.java | 4 +- .../plugin/ui/EditVarConstraintsDialog.java | 2 +- .../structuralsearch/plugin/ui/UIUtil.java | 4 +- .../arrangement/AbstractRearrangerTest.java | 7 +- .../psi/formatter/FormatterTestCase.java | 4 +- .../LightPlatformCodeInsightTestCase.java | 4 +- .../testFramework/LightPlatformTestCase.java | 4 +- .../impl/CodeInsightTestFixtureImpl.java | 8 +- .../openapi/keymap/KeymapsTestCase.java | 8 +- .../usages/impl/SearchForUsagesRunnable.java | 12 +- .../intellij/usages/impl/UsageViewImpl.java | 4 +- .../intellij/openapi/util/io/IoTestUtil.java | 4 +- .../com/intellij/util/diff/DiffTreeTest.java | 4 +- .../MoveChangesToAnotherListAction.java | 4 +- .../changes/patch/tool/ApplyPatchChange.java | 12 +- .../changes/patch/tool/ApplyPatchViewer.java | 4 +- .../openapi/vcs/ex/LineStatusTracker.java | 4 +- .../vcs/impl/projectlevelman/NewMappings.java | 2 +- .../vcs/log/ui/frame/VcsLogGraphTable.java | 4 +- .../intellij/vcs/log/util/PersistentUtil.java | 8 +- .../actions/AttachToLocalProcessAction.java | 4 +- .../breakpoints/ui/BreakpointsDialog.java | 4 +- .../intellij/xdebugger/XDebuggerTestCase.java | 4 +- .../intellij/xdebugger/XDebuggerTestUtil.java | 4 +- .../AttachToLocalProcessActionTest.java | 24 ++- ...ProtectedMemberInFinalClassInspection.java | 4 +- .../inject/java/LanguageReference.java | 6 +- .../inject/java/RegExpEnumReference.java | 4 +- .../inject/EditInjectionSettingsAction.java | 4 +- .../inject/UnInjectLanguageAction.java | 4 +- .../inject/config/BaseInjection.java | 4 +- .../intelliLang/util/StringMatcher.java | 4 +- .../ConvertInterfaceToClassIntention.java | 4 +- .../ipp/modifiers/ModifierIntention.java | 4 +- .../lang/ant/config/explorer/AntExplorer.java | 4 +- .../ant/config/impl/AntConfigurationImpl.java | 12 +- .../actions/AbstractFileProcessor.java | 4 +- .../coverage/CoverageSuitesBundle.java | 4 +- .../intellij/coverage/SrcFileAnnotator.java | 4 +- .../src/dom/impl/IdeaPluginConverter.java | 4 +- .../impl/PropertyKeyReferenceProvider.java | 4 +- .../quickfix/CreateHtmlDescriptionFix.java | 8 +- .../src/projectRoots/IdeaJdkConfigurable.java | 4 +- .../TestCaseAsRelatedFileProvider.java | 4 +- .../DevKitGutterTargetsChecker.java | 4 +- .../export/ExportEclipseProjectsAction.java | 4 +- .../importWizard/EclipseImportBuilder.java | 12 +- .../GenerateToStringActionHandlerImpl.java | 4 +- .../github/GithubCreateGistAction.java | 4 +- .../plugins/github/GithubRebaseAction.java | 4 +- .../github/tasks/GithubRepository.java | 12 +- .../ui/GithubCreatePullRequestDialog.java | 4 +- .../plugins/github/util/GithubUtil.java | 4 +- .../actions/AddGradleDslPluginActionTest.java | 4 +- .../AddGradleDslDependencyActionTest.java | 4 +- .../ClashingTraitMethodsInspectionBase.java | 4 +- .../type/GroovyTypeCheckVisitor.java | 4 +- .../groovy/config/GroovyConfigUtils.java | 4 +- .../LiteralConstructorReference.java | 4 +- .../gpp/GppClosureParameterTypeProvider.java | 4 +- .../gpp/GppExpectedTypesContributor.java | 4 +- .../GroovyExpectedTypesProvider.java | 4 +- .../lang/psi/impl/GrLiteralClassType.java | 4 +- .../lang/psi/impl/GrMapTypeFromNamedArgs.java | 4 +- .../groovy/lang/psi/impl/GrTraitType.java | 8 +- .../groovy/lang/psi/impl/GroovyNamesUtil.java | 4 +- .../FromAbstractTypeMethodsHintProcessor.java | 4 +- .../plugins/groovy/util/LibrariesUtil.java | 4 +- .../equals/GroovyGenerateEqualsHandler.java | 4 +- .../intentions/GrCreateFromUsageBaseFix.java | 4 +- .../dynamic/DynamicManagerImpl.java | 8 +- .../ExcludeFromStubGenerationAction.java | 4 +- .../GroovyStubNotificationProvider.java | 28 ++- ...aultGroovyFrameworkConfigNotification.java | 4 +- .../debugger/GroovyCodeFragmentFactory.java | 4 +- .../blocks/GroovyBlockGenerator.java | 4 +- .../other/GrAliasImportIntention.java | 4 +- .../ConvertParameterToMapEntryIntention.java | 8 +- .../lang/completion/GroovyCompletionUtil.java | 4 +- .../GroovyTypeParameterInfoHandler.java | 4 +- .../groovy/mvc/MvcModuleStructureUtil.java | 4 +- .../MvcProjectWithoutLibraryNotificator.java | 4 +- .../GrChangeSignatureDialog.java | 8 +- .../convertToJava/ClassItemGeneratorImpl.java | 4 +- .../GrAbstractInplaceIntroducer.java | 4 +- .../JavaSafeDeleteDelegateForGroovy.java | 4 +- .../intentions/ConvertMapToClassTest.java | 10 +- .../java/decompiler/SingleClassesTest.java | 4 +- .../codeInspection/i18n/I18nizeAction.java | 24 ++- .../sceneBuilder/SceneBuilderEditor.java | 4 +- .../intellij/execution/junit/TestObject.java | 4 +- .../JUnitConfigurationModel.java | 4 +- .../dom/generate/GenerateDependencyUtil.java | 8 +- .../MojoClassAnnotationTagProvider.java | 4 +- .../idea/maven/project/MavenProjectsTree.java | 4 +- .../maven/server/MavenEmbedderWrapper.java | 4 +- .../idea/maven/server/MavenServerManager.java | 4 +- .../jetbrains/idea/maven/utils/MavenUtil.java | 12 +- .../library/RepositoryAttachHandler.java | 4 +- .../library/RepositoryLibrarySupport.java | 4 +- .../RepositoryLibraryPropertiesEditor.java | 8 +- .../library/remote/MavenRemoteManager.java | 4 +- .../idea/maven/dom/MavenDomTestCase.java | 4 +- .../maven/dom/MavenPropertyResolverTest.java | 14 +- .../MavenClasspathsAndSearchScopesTest.java | 2 +- .../importing/WorkingWithOpenProjectTest.java | 22 ++- .../maven/project/MavenProjectReaderTest.java | 4 +- .../MavenProjectsTreeIgnoresTest.java | 4 +- .../MavenProjectsTreeReadingTest.java | 4 +- .../lang/properties/CustomResourceBundle.java | 4 +- .../properties/CustomResourceBundleState.java | 4 +- .../properties/ResourceBundleManager.java | 4 +- ...esourceBundleFileStructureViewElement.java | 4 +- .../ResourceBundleEditorInspectionPass.java | 4 +- .../PropertiesDocumentationProvider.java | 4 +- .../CreateResourceBundleDialogComponent.java | 4 +- ...toResourceBundleLocalizationsProvider.java | 4 +- .../properties/editor/NewPropertyAction.java | 6 +- .../editor/PropertiesCopyHandler.java | 8 +- .../editor/ResourceBundleAsVirtualFile.java | 4 +- .../editor/ResourceBundleEditor.java | 60 +++---- .../ResourceBundleStructureViewComponent.java | 4 +- .../IncompletePropertyInspection.java | 12 +- .../references/CreatePropertyFix.java | 18 +- .../properties/CustomResourceBundleTest.java | 24 +-- .../lang/properties/PropertiesFileTest.java | 12 +- ...ResourceBundleEditorInsertManagerTest.java | 6 +- .../tasks/ui/TaskDialogPanelProvider.java | 8 +- .../intellij/tasks/jira/rest/JiraRestApi.java | 4 +- .../tasks/jira/rest/JiraRestTask.java | 30 ++-- .../tasks/jira/soap/JiraLegacyApi.java | 4 +- .../tasks/jira/soap/JiraSoapTask.java | 32 ++-- .../actions/context/LoadContextAction.java | 46 +++-- .../tasks/bugzilla/BugzillaRepository.java | 8 +- .../config/TaskRepositoriesConfigurable.java | 4 +- .../XDebuggerBreakpointsContextProvider.java | 4 +- .../tasks/fogbugz/FogBugzRepository.java | 4 +- .../tasks/generic/GenericRepositoryUtil.java | 4 +- .../generic/JsonPathResponseHandler.java | 4 +- .../tasks/gitlab/GitlabRepository.java | 4 +- .../tasks/impl/TaskCheckinHandlerFactory.java | 4 +- .../intellij/tasks/impl/TaskManagerImpl.java | 4 +- .../intellij/tasks/impl/TaskStateCombo.java | 4 +- .../com/intellij/tasks/impl/TaskUiUtil.java | 4 +- .../lighthouse/LighthouseRepository.java | 4 +- .../tasks/mantis/MantisRepository.java | 4 +- .../com/intellij/tasks/mantis/MantisTask.java | 32 ++-- .../pivotal/PivotalTrackerRepository.java | 4 +- .../tasks/redmine/RedmineRepository.java | 4 +- .../tasks/trello/TrelloRepository.java | 8 +- .../tasks/youtrack/YouTrackIntellisense.java | 8 +- .../tasks/youtrack/YouTrackRepository.java | 4 +- .../YouTrackCompletionContributor.java | 10 +- .../java/BreakpointsContextProvider.java | 4 +- .../integration/BugzillaIntegrationTest.java | 8 +- .../com/intellij/tasks/vcs/TaskVcsTest.java | 4 +- .../configuration/TestNGRunnableState.java | 4 +- .../model/TestNGConfigurationModel.java | 6 +- .../testng/ui/TestNGResults.java | 4 +- .../ui/actions/RerunFailedTestsAction.java | 4 +- .../testng/util/TestNGUtil.java | 4 +- .../designSurface/InplaceEditingLayer.java | 4 +- .../actions/CreateListenerAction.java | 4 +- .../binding/FormReferenceProvider.java | 4 +- .../designSurface/InplaceEditingLayer.java | 4 +- .../InsertComponentProcessor.java | 16 +- .../properties/BindingProperty.java | 28 ++- .../quickFixes/ChangeFieldTypeFix.java | 24 ++- .../quickFixes/CreateClassToBindFix.java | 74 ++++---- .../uiDesigner/quickFixes/CreateFieldFix.java | 4 +- .../snapShooter/CreateSnapShotAction.java | 30 ++-- .../make/FormSourceCodeGeneratorTest.java | 4 +- .../XPathCompletionContributor.java | 8 +- .../xpath/xslt/impl/XsltIncludeIndex.java | 4 +- .../xpath/xslt/quickfix/DownloadManager.java | 4 +- .../lang/xpath/xslt/XsltHighlightingTest.java | 4 +- .../YamlKeyCompletionInsertHandler.java | 8 +- .../YAMLMappingModificationTest.java | 8 +- .../actions/CCFromCourseArchive.java | 12 +- .../coursecreator/actions/CCShowPreview.java | 4 +- .../jetbrains/edu/learning/StudyUtils.java | 4 +- .../edu/learning/checker/StudyCheckUtils.java | 4 +- .../learning/checker/StudySmartChecker.java | 4 +- .../jetbrains/edu/learning/core/EduUtils.java | 8 +- .../edu/learning/courseFormat/Course.java | 4 +- .../StudyProjectGenerator.java | 8 +- .../learning/stepic/EduStepicConnector.java | 4 +- .../edu/PyCharmEduInitialConfigurator.java | 4 +- .../edu/learning/PyStudyCheckAction.java | 86 +++++---- .../python/PyCharmInitialConfigurator.java | 4 +- .../python/buildout/BuildoutConfigurable.java | 4 +- .../PythonBaseProjectGenerator.java | 4 +- .../python/packaging/PyRequirement.java | 4 +- .../python/facet/PythonSdkTableListener.java | 44 +++-- .../PyActiveSdkConfigurable.java | 4 +- .../PyContentEntriesModuleConfigurable.java | 4 +- .../sphinx/RunSphinxQuickStartAction.java | 4 +- .../python/buildout/BuildoutConfigPanel.java | 4 +- .../PyConvertTripleQuotedStringIntention.java | 4 +- .../codeInsight/override/PyMethodMember.java | 4 +- .../attach/PyLocalAttachDebuggerProvider.java | 4 +- .../PythonDocumentationProvider.java | 4 +- .../docstrings/DocStringFormat.java | 4 +- .../docstrings/SectionBasedDocString.java | 12 +- .../editor/PythonCopyPasteProcessor.java | 4 +- .../PyPackageRequirementsInspection.java | 4 +- .../inspections/PyTypeCheckerInspection.java | 4 +- .../CompatibilityPrintCallQuickFix.java | 4 +- .../python/packaging/PyPackageUtil.java | 4 +- .../setupPy/SetupTaskChooserAction.java | 4 +- .../psi/impl/PyFromImportStatementImpl.java | 4 +- .../psi/impl/PyImportStatementImpl.java | 4 +- .../resolve/CompletionVariantsProcessor.java | 4 +- .../refactoring/PyReplaceExpressionUtil.java | 4 +- .../classes/PyClassRefactoringUtil.java | 4 +- .../move/PyMoveModuleMembersDialog.java | 8 +- .../move/PyMoveModuleMembersProcessor.java | 4 +- .../jetbrains/python/sdk/PythonSdkType.java | 4 +- .../python/sdk/PythonSdkUpdater.java | 24 ++- .../sdk/skeletons/PySkeletonRefresher.java | 4 +- .../commandLine/CommandTestTools.java | 4 +- .../env/python/console/PyConsoleTask.java | 4 +- .../env/python/debug/PyBaseDebuggerTask.java | 4 +- .../com/jetbrains/python/PyAddImportTest.java | 4 +- .../com/jetbrains/python/PyFormatterTest.java | 4 +- .../fixtures/PyMultiFileResolveTestCase.java | 4 +- .../jetbrains/python/fixtures/PyTestCase.java | 4 +- .../python/refactoring/PyInlineLocalTest.java | 4 +- .../python/refactoring/PyMoveTest.java | 4 +- .../PyChangeSignatureTest.java | 4 +- .../classes/PyClassRefactoringTest.java | 4 +- .../python/sdkTools/PyTestSdkTools.java | 4 +- .../actions/SpellingPopupActionGroup.java | 18 +- .../NavigationGutterIconRenderer.java | 4 +- .../DomElementsHighlightingUtil.java | 6 +- .../util/xml/impl/DomInvocationHandler.java | 4 +- .../util/xml/impl/DynamicGenericInfo.java | 4 +- .../util/xml/model/impl/DomModelImpl.java | 4 +- .../intellij/util/xml/ui/ComboControl.java | 4 +- .../intellij/util/xml/DomChildrenTest.java | 8 +- .../xml/impl/IncrementalUpdateEventsTest.java | 4 +- .../xml/impl/TreeIncrementalUpdateTest.java | 4 +- .../impl/quickfix/FetchExtResourceAction.java | 20 +-- .../quickfix/IgnoreExtResourceAction.java | 4 +- .../template/emmet/EmmetPreviewUtil.java | 4 +- .../template/emmet/ZenCodingTemplate.java | 42 +++-- .../emmet/filters/BemEmmetFilter.java | 4 +- .../emmet/filters/TrimZenCodingFilter.java | 4 +- .../intellij/javaee/EditLocationDialog.java | 4 +- .../xml/actions/EscapeEntitiesAction.java | 4 +- .../actions/validate/StdErrorReporter.java | 4 +- .../XmlEnumeratedValueReferenceProvider.java | 4 +- .../relaxNG/compact/RncCompletionData.java | 4 +- .../RngXmlAttributeDescriptor.java | 4 +- .../model/resolve/RelaxIncludeIndex.java | 4 +- .../relaxNG/references/FileReferenceUtil.java | 4 +- .../plugins/relaxNG/HighlightingTestBase.java | 4 +- .../intellij/codeInsight/XmlEventsTest.java | 12 +- .../intellij/codeInsight/XmlReparseTest.java | 4 +- .../com/intellij/codeInsight/XmlTagTest.java | 170 +++++++----------- .../intellij/codeInsight/XmlTagWriteTest.java | 4 +- .../completion/XmlSyncTagTest.java | 16 +- .../daemon/XmlHighlightingTest.java | 40 ++--- .../daemon/quickFix/RealFetchTest.java | 12 +- .../html/MicrodataCompletionTest.java | 16 +- .../psi/formatter/XmlFormatterTestBase.java | 12 +- .../xml/index/XmlSchemaIndexTest.java | 4 +- .../javaee/ExternalResourceManagerExImpl.java | 16 +- .../xml/impl/dtd/XmlElementsGroupImpl.java | 4 +- .../structureView/HtmlTagTreeElement.java | 4 +- 686 files changed, 1601 insertions(+), 3522 deletions(-) diff --git a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java index 6e0175945352..3e34ee657a4c 100644 --- a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java +++ b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java @@ -225,9 +225,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { } protected CompilationLog rebuild() { - return compile(false, compileStatusNotification -> { - getCompilerManager().rebuild(compileStatusNotification); - }); + return compile(false, compileStatusNotification -> getCompilerManager().rebuild(compileStatusNotification)); } protected CompilationLog compile(final boolean errorsExpected, final ParameterizedRunnable action) { diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java index 1dd711a4ecea..4f5bbdda6d04 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java @@ -48,9 +48,7 @@ public class ExportThreadsAction extends AnAction implements AnAction.Transparen process.getManagerThread().invoke(new DebuggerCommandImpl() { protected void action() throws Exception { final List threads = ThreadDumpAction.buildThreadStates(process.getVirtualMachineProxy()); - ApplicationManager.getApplication().invokeLater(() -> { - ExportToTextFileAction.export(project, ThreadDumpPanel.createToFileExporter(project, threads)); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> ExportToTextFileAction.export(project, ThreadDumpPanel.createToFileExporter(project, threads)), ModalityState.NON_MODAL); } }); } diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ForceEarlyReturnAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ForceEarlyReturnAction.java index 29c34dfa486a..47e29af1c5e8 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ForceEarlyReturnAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ForceEarlyReturnAction.java @@ -172,12 +172,10 @@ public class ForceEarlyReturnAction extends DebuggerAction { } private static void showError(final Project project, final String message) { - ApplicationManager.getApplication().invokeLater(() -> { - Messages.showMessageDialog(project, - message, - UIUtil.removeMnemonic(ActionsBundle.actionText("Debugger.ForceEarlyReturn")), - Messages.getErrorIcon()); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> Messages.showMessageDialog(project, + message, + UIUtil.removeMnemonic(ActionsBundle.actionText("Debugger.ForceEarlyReturn")), + Messages.getErrorIcon()), ModalityState.any()); } public void update(@NotNull AnActionEvent e) { diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ToggleFieldBreakpointAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ToggleFieldBreakpointAction.java index eb47039e76c2..2620f68fc2bb 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ToggleFieldBreakpointAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ToggleFieldBreakpointAction.java @@ -160,9 +160,7 @@ public class ToggleFieldBreakpointAction extends AnAction { @Override public void threadAction() { - ApplicationManager.getApplication().runReadAction(() -> { - positionRef.set(SourcePositionProvider.getSourcePosition(selectedNode.getDescriptor(), project, debuggerContext)); - }); + ApplicationManager.getApplication().runReadAction(() -> positionRef.set(SourcePositionProvider.getSourcePosition(selectedNode.getDescriptor(), project, debuggerContext))); } }); final SourcePosition sourcePosition = positionRef.get(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java index c1f23635ff67..8d0ef9b775ee 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java @@ -282,9 +282,7 @@ public class JavaStackFrame extends XStackFrame { final SourcePosition sourcePosition = debuggerContext.getSourcePosition(); final Map visibleVariables = ContainerUtil.map2Map(getVisibleVariables(), - var -> { - return Pair.create(var.name(), var); - }); + var -> Pair.create(var.name(), var)); Pair, Set> usedVars = EMPTY_USED_VARS; if (sourcePosition != null) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java index 9e6e545a63a3..80cad77b1512 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java @@ -488,9 +488,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV @Override protected void doAction(@Nullable final SourcePosition sourcePosition) { if (sourcePosition != null) { - ApplicationManager.getApplication().runReadAction(() -> { - navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(sourcePosition)); - }); + ApplicationManager.getApplication().runReadAction(() -> navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(sourcePosition))); } } }); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java b/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java index 0ba1e8147345..d54aae1149a5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java @@ -119,9 +119,7 @@ public class AlternativeSourceNotificationProvider extends EditorNotifications.P ComboBoxClassElement[] elems = ContainerUtil.map2Array(alts, ComboBoxClassElement.class, - psiClass -> { - return new ComboBoxClassElement((PsiClass)psiClass.getNavigationElement()); - }); + psiClass -> new ComboBoxClassElement((PsiClass)psiClass.getNavigationElement())); return new AlternativeSourceNotificationPanel(elems, baseClass, myProject, file); } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java index c27ac1b7c11c..1e8c5c8fc73b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java @@ -479,9 +479,7 @@ public class BreakpointManager { if (breakpoint == null) { return; } - ApplicationManager.getApplication().runWriteAction(() -> { - getXBreakpointManager().removeBreakpoint(breakpoint.myXBreakpoint); - }); + ApplicationManager.getApplication().runWriteAction(() -> getXBreakpointManager().removeBreakpoint(breakpoint.myXBreakpoint)); } public void writeExternal(@NotNull final Element parentNode) { diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java index 52641f8ab4f6..3c82276ab4a8 100644 --- a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java +++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java @@ -41,9 +41,7 @@ public class ApplicationRunLineMarkerProvider extends RunLineMarkerContributor { if (element instanceof PsiClass && PsiMethodUtil.findMainInClass((PsiClass)element) != null || element instanceof PsiMethod && "main".equals(((PsiMethod)element).getName()) && PsiMethodUtil.isMainMethod((PsiMethod)element)) { final AnAction[] actions = ExecutorAction.getActions(0); - return new Info(AllIcons.RunConfigurations.TestState.Run, element1 -> StringUtil.join(ContainerUtil.mapNotNull(actions, action -> { - return getText(action, element1); - }), "\n"), actions); + return new Info(AllIcons.RunConfigurations.TestState.Run, element1 -> StringUtil.join(ContainerUtil.mapNotNull(actions, action -> getText(action, element1)), "\n"), actions); } } return null; diff --git a/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java b/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java index 2f4836551ee3..2a237cc9ca0c 100644 --- a/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java +++ b/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java @@ -219,11 +219,9 @@ public class DefaultJavaProgramRunner extends JavaPatchableProgramRunner { } private void showThreadDump(final String out, final List threadStates) { - ApplicationManager.getApplication().invokeLater(() -> { - AnalyzeStacktraceUtil.addConsole(myProject, threadStates.size() > 1 ? - new ThreadDumpConsoleFactory(myProject, threadStates) : null, - " " + DateFormatUtil.formatDateTime(System.currentTimeMillis()), out); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> AnalyzeStacktraceUtil.addConsole(myProject, threadStates.size() > 1 ? + new ThreadDumpConsoleFactory(myProject, threadStates) : null, + " " + DateFormatUtil.formatDateTime(System.currentTimeMillis()), out), ModalityState.NON_MODAL); } } diff --git a/java/execution/impl/src/com/intellij/execution/testDiscovery/TestDiscoveryExtension.java b/java/execution/impl/src/com/intellij/execution/testDiscovery/TestDiscoveryExtension.java index e2fb9b4cd5cd..eb4dff2eddf2 100644 --- a/java/execution/impl/src/com/intellij/execution/testDiscovery/TestDiscoveryExtension.java +++ b/java/execution/impl/src/com/intellij/execution/testDiscovery/TestDiscoveryExtension.java @@ -156,9 +156,7 @@ public class TestDiscoveryExtension extends RunConfigurationExtension { final TestDiscoveryIndex coverageIndex = TestDiscoveryIndex.getInstance(configuration.getProject()); synchronized (ourTracesLock) { final File tracesDirectoryFile = new File(tracesDirectory); - final File[] testMethodTraces = tracesDirectoryFile.listFiles((dir, name) -> { - return name.endsWith(".tr"); - }); + final File[] testMethodTraces = tracesDirectoryFile.listFiles((dir, name) -> name.endsWith(".tr")); if (testMethodTraces != null) { for (File testMethodTrace : testMethodTraces) { try { diff --git a/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java b/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java index d5028bcbd7d0..568e3a76e255 100644 --- a/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java +++ b/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java @@ -110,9 +110,7 @@ public class NewProjectUtil { final Sdk jdk = dialog.getNewProjectJdk(); if (jdk != null) { - CommandProcessor.getInstance().executeCommand(newProject, () -> ApplicationManager.getApplication().runWriteAction(() -> { - applyJdkToProject(newProject, jdk); - }), null, null); + CommandProcessor.getInstance().executeCommand(newProject, () -> ApplicationManager.getApplication().runWriteAction(() -> applyJdkToProject(newProject, jdk)), null, null); } final String compileOutput = dialog.getNewCompileOutput(); diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java index 3d1257c02706..35b5eae5477b 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java @@ -344,9 +344,7 @@ public class ProjectTypeStep extends ModuleWizardStep implements SettingsStep, D return o1.compareTo(o2); }); - Set groupNames = ContainerUtil.map2Set(groups, group -> { - return group.getParentGroup(); - }); + Set groupNames = ContainerUtil.map2Set(groups, group -> group.getParentGroup()); // move subgroups MultiMap subGroups = new MultiMap(); diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/modes/ImportMode.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/modes/ImportMode.java index 93341434a191..004cb4927dba 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/modes/ImportMode.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/modes/ImportMode.java @@ -58,9 +58,7 @@ public class ImportMode extends WizardMode { final String productName = ApplicationNamesInfo.getInstance().getFullProductName(); return ProjectBundle.message("project.new.wizard.import.description", productName, context.getPresentationName(), StringUtil.join( Arrays.asList(Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER)), - provider -> { - return provider.getName(); - }, ", ")); + provider -> provider.getName(), ", ")); } @Nullable diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java index f2546564f16b..ecaaa4f9058d 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java @@ -239,9 +239,7 @@ public class JdkChooserPanel extends JPanel { if (jdk == null) { return null; } - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectRootManager.getInstance(project).setProjectSdk(jdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectRootManager.getInstance(project).setProjectSdk(jdk)); return jdk; } diff --git a/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java b/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java index 75f8540ffd0b..7e92e7ca612e 100644 --- a/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java +++ b/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java @@ -216,9 +216,7 @@ public class SdkEditor implements Configurable, Place.Navigator { for (SdkPathEditor pathEditor : myPathEditors.values()) { pathEditor.apply(sdkModificator); } - ApplicationManager.getApplication().runWriteAction(() -> { - sdkModificator.commitChanges(); - }); + ApplicationManager.getApplication().runWriteAction(() -> sdkModificator.commitChanges()); final AdditionalDataConfigurable configurable = getAdditionalDataConfigurable(); if (configurable != null) { configurable.apply(); diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java index e0830afbd0c1..8da7f775f8b8 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java @@ -44,25 +44,19 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement @Override public void openProjectSettings() { final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject); - ShowSettingsUtil.getInstance().editConfigurable(myProject, config, () -> { - config.selectProjectGeneralSettings(true); - }); + ShowSettingsUtil.getInstance().editConfigurable(myProject, config, () -> config.selectProjectGeneralSettings(true)); } @Override public void openGlobalLibraries() { final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject); - ShowSettingsUtil.getInstance().editConfigurable(myProject, config, () -> { - config.selectGlobalLibraries(true); - }); + ShowSettingsUtil.getInstance().editConfigurable(myProject, config, () -> config.selectGlobalLibraries(true)); } @Override public void openLibrary(@NotNull final Library library) { final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject); - ShowSettingsUtil.getInstance().editConfigurable(myProject, config, () -> { - config.selectProjectOrGlobalLibrary(library, true); - }); + ShowSettingsUtil.getInstance().editConfigurable(myProject, config, () -> config.selectProjectOrGlobalLibrary(library, true)); } @Override @@ -102,9 +96,7 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement @Override public void openModuleDependenciesSettings(@NotNull final Module module, @Nullable final OrderEntry orderEntry) { - ShowSettingsUtil.getInstance().editConfigurable(myProject, ProjectStructureConfigurable.getInstance(myProject), () -> { - ProjectStructureConfigurable.getInstance(myProject).selectOrderEntry(module, orderEntry); - }); + ShowSettingsUtil.getInstance().editConfigurable(myProject, ProjectStructureConfigurable.getInstance(myProject), () -> ProjectStructureConfigurable.getInstance(myProject).selectOrderEntry(module, orderEntry)); } @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java index 4c40a9c88e6d..1749ad0857fd 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java @@ -523,9 +523,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change public static boolean showArtifactSettings(@NotNull Project project, @Nullable final Artifact artifact) { final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project); - return ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> { - configurable.select(artifact, true); - }); + return ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> configurable.select(artifact, true)); } public static boolean showFacetSettingsDialog(@NotNull final Facet facet, @@ -545,9 +543,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change public static boolean showDialog(Project project, @Nullable final String moduleToSelect, @Nullable final String editorNameToSelect) { final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(project); - return ShowSettingsUtil.getInstance().editConfigurable(project, config, () -> { - config.select(moduleToSelect, editorNameToSelect, true); - }); + return ShowSettingsUtil.getInstance().editConfigurable(project, config, () -> config.select(moduleToSelect, editorNameToSelect, true)); } public void moduleRenamed(Module module, final String oldName, final String name) { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java index 263ab20698f4..d2ddc4d3650d 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java @@ -452,9 +452,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent private List attachFiles(List roots) { final List rootsToAttach = filterAlreadyAdded(roots); if (!rootsToAttach.isEmpty()) { - ApplicationManager.getApplication().runWriteAction(() -> { - getLibraryEditor().addRoots(rootsToAttach); - }); + ApplicationManager.getApplication().runWriteAction(() -> getLibraryEditor().addRoots(rootsToAttach)); updatePropertiesLabel(); onRootsChanged(); myTreeBuilder.queueUpdate(); diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java index a8b7c0f81022..53d622af1b06 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java @@ -306,9 +306,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple @Override protected Comparator getNodeComparator() { List> comparators = ContainerUtil - .mapNotNull(ModuleStructureExtension.EP_NAME.getExtensions(), moduleStructureExtension -> { - return moduleStructureExtension.getNodeComparator(); - }); + .mapNotNull(ModuleStructureExtension.EP_NAME.getExtensions(), moduleStructureExtension -> moduleStructureExtension.getNodeComparator()); return new MergingComparator(ContainerUtil.concat(comparators, Collections.singletonList(NODE_COMPARATOR))); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java index 9ed21b232289..9a09b7b3f611 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java @@ -62,9 +62,7 @@ public class SuppressWarningsFoldingBuilder extends FoldingBuilderEx { public String getPlaceholderText(@NotNull ASTNode node) { final PsiElement element = node.getPsi(); if (element instanceof PsiAnnotation) { - return "/" + StringUtil.join(((PsiAnnotation)element).getParameterList().getAttributes(), value -> { - return getMemberValueText(value.getValue()); - }, ", ") + "/"; + return "/" + StringUtil.join(((PsiAnnotation)element).getParameterList().getAttributes(), value -> getMemberValueText(value.getValue()), ", ") + "/"; } return element.getText(); } @@ -72,9 +70,7 @@ public class SuppressWarningsFoldingBuilder extends FoldingBuilderEx { private static String getMemberValueText(PsiAnnotationMemberValue memberValue) { if (memberValue instanceof PsiArrayInitializerMemberValue) { final PsiAnnotationMemberValue[] initializers = ((PsiArrayInitializerMemberValue)memberValue).getInitializers(); - return StringUtil.join(initializers, psiAnnotationMemberValue -> { - return getMemberValueText(psiAnnotationMemberValue); - }, ", "); + return StringUtil.join(initializers, psiAnnotationMemberValue -> getMemberValueText(psiAnnotationMemberValue), ", "); } if (memberValue instanceof PsiLiteral) { final Object o = ((PsiLiteral)memberValue).getValue(); diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteRepeatedInterfaceFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteRepeatedInterfaceFix.java index 324e3ddb2573..5b50f77760d5 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteRepeatedInterfaceFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteRepeatedInterfaceFix.java @@ -74,9 +74,7 @@ public class DeleteRepeatedInterfaceFix implements IntentionAction { public boolean value(PsiTypeElement element) { return element != myConjunct; } - }), element -> { - return element.getText(); - }, " & "); + }), element -> element.getText(), " & "); final PsiTypeCastExpression newCastExpr = (PsiTypeCastExpression)JavaPsiFacade.getElementFactory(project).createExpressionFromText("(" + typeText + ")a", castType); CodeStyleManager.getInstance(project).reformat(castType.replace(newCastExpr.getCastType())); diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FlipIntersectionSidesFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FlipIntersectionSidesFix.java index 4da3f485021e..6b0c39d53a6d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FlipIntersectionSidesFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FlipIntersectionSidesFix.java @@ -78,9 +78,7 @@ public class FlipIntersectionSidesFix implements IntentionAction { myConjuncts.remove(myConjunct); myConjuncts.add(0, myConjunct); - final String intersectionTypeText = StringUtil.join(myConjuncts, element -> { - return element.getText(); - }, " & "); + final String intersectionTypeText = StringUtil.join(myConjuncts, element -> element.getText(), " & "); final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project); final PsiTypeCastExpression fixedCast = (PsiTypeCastExpression)elementFactory.createExpressionFromText("(" + intersectionTypeText + ") a", myCastTypeElement); diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java index cc608eed9d3a..e94b653a87c5 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java @@ -83,9 +83,7 @@ public class SimplifyBooleanExpressionFix extends LocalQuickFixOnPsiElement { if (!isAvailable()) return; final PsiExpression expression = getSubExpression(); if (!FileModificationService.getInstance().preparePsiElementForWrite(expression)) return; - ApplicationManager.getApplication().runWriteAction(() -> { - simplifyExpression(project, expression, mySubExpressionValue); - }); + ApplicationManager.getApplication().runWriteAction(() -> simplifyExpression(project, expression, mySubExpressionValue)); } public static void simplifyExpression(Project project, final PsiExpression subExpression, final Boolean subExpressionValue) { @@ -293,9 +291,7 @@ public class SimplifyBooleanExpressionFix extends LocalQuickFixOnPsiElement { if (expressions.isEmpty()) { resultExpression = negate ? trueExpression : falseExpression; } else { - String simplifiedText = StringUtil.join(expressions, expression1 -> { - return expression1.getText(); - }, " ^ "); + String simplifiedText = StringUtil.join(expressions, expression1 -> expression1.getText(), " ^ "); if (negate) { if (expressions.size() > 1) { simplifiedText = "!(" + simplifiedText + ")"; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java index 0e3ba50f3905..96bcd82bda5d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java @@ -115,9 +115,7 @@ class StateQueue { } - return ContainerUtil.map(memoryStates, state1 -> { - return new DfaInstructionState(instruction, state1); - }); + return ContainerUtil.map(memoryStates, state1 -> new DfaInstructionState(instruction, state1)); } private static List mergeGroup(List group) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java index af959256070a..483b3be03206 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java @@ -993,9 +993,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState { @Override public void flushVariable(@NotNull final DfaVariableValue variable) { - List updatedStack = ContainerUtil.map(myStack, value -> { - return handleFlush(variable, value); - }); + List updatedStack = ContainerUtil.map(myStack, value -> handleFlush(variable, value)); myStack.clear(); for (DfaValue value : updatedStack) { myStack.push(value); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java index 5a6413e2f04c..63f461898814 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaUtil.java @@ -53,9 +53,7 @@ public class DfaUtil { ValuableInstructionVisitor.PlaceResult placeResult = value.get(context); final Collection> concatenations = placeResult == null ? null : placeResult.myValues.get(variable); if (concatenations != null) { - return ContainerUtil.map(concatenations, expressions -> { - return concatenateExpressions(expressions); - }); + return ContainerUtil.map(concatenations, expressions -> concatenateExpressions(expressions)); } return Collections.emptyList(); } @@ -256,9 +254,7 @@ public class DfaUtil { return concatenation.getHead(); } String text = StringUtil - .join(ContainerUtil.reverse(new ArrayList(concatenation)), expression -> { - return expression.getText(); - }, "+"); + .join(ContainerUtil.reverse(new ArrayList(concatenation)), expression -> expression.getText(), "+"); try { return JavaPsiFacade.getElementFactory(concatenation.getHead().getProject()).createExpressionFromText(text, concatenation.getHead()); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java index 8e092099302e..0f3ba3ae4aec 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java @@ -47,9 +47,7 @@ public class MethodContract { @Override public String toString() { - return StringUtil.join(arguments, constraint -> { - return constraint.toString(); - }, ", ") + " -> " + returnValue; + return StringUtil.join(arguments, constraint -> constraint.toString(), ", ") + " -> " + returnValue; } public enum ValueConstraint { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java index 967700c15111..40361913399e 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java @@ -387,9 +387,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo Annotated annotated = check(method, holder, method.getReturnType()); List superMethods = ContainerUtil.map( - method.findSuperMethodSignaturesIncludingStatic(true), signature -> { - return signature.getMethod(); - }); + method.findSuperMethodSignaturesIncludingStatic(true), signature -> signature.getMethod()); final NullableNotNullManager nullableManager = NullableNotNullManager.getInstance(holder.getProject()); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java index 6bdf0d5e810f..3cb46565482e 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java @@ -289,9 +289,7 @@ public class RefClassImpl extends RefJavaElementImpl implements RefClass { @Override public void accept(@NotNull final RefVisitor visitor) { if (visitor instanceof RefJavaVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - ((RefJavaVisitor)visitor).visitClass(RefClassImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> ((RefJavaVisitor)visitor).visitClass(RefClassImpl.this)); } else { super.accept(visitor); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefFieldImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefFieldImpl.java index 6b5e588a28b7..fa9c17c35ef3 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefFieldImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefFieldImpl.java @@ -105,9 +105,7 @@ public class RefFieldImpl extends RefJavaElementImpl implements RefField { @Override public void accept(@NotNull final RefVisitor visitor) { if (visitor instanceof RefJavaVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - ((RefJavaVisitor)visitor).visitField(RefFieldImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> ((RefJavaVisitor)visitor).visitField(RefFieldImpl.this)); } else { super.accept(visitor); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java index c28e9d50a0b0..a72a85827bab 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java @@ -338,9 +338,7 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod { @Override public void accept(@NotNull final RefVisitor visitor) { if (visitor instanceof RefJavaVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - ((RefJavaVisitor)visitor).visitMethod(RefMethodImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> ((RefJavaVisitor)visitor).visitMethod(RefMethodImpl.this)); } else { super.accept(visitor); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefPackageImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefPackageImpl.java index b010fc9ca17c..1f26717ad3d6 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefPackageImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefPackageImpl.java @@ -55,9 +55,7 @@ public class RefPackageImpl extends RefEntityImpl implements RefPackage { @Override public void accept(@NotNull final RefVisitor visitor) { if (visitor instanceof RefJavaVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - ((RefJavaVisitor)visitor).visitPackage(RefPackageImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> ((RefJavaVisitor)visitor).visitPackage(RefPackageImpl.this)); } else { super.accept(visitor); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java index a5a1b9b7ca30..2230ac427d92 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java @@ -86,9 +86,7 @@ public class RefParameterImpl extends RefJavaElementImpl implements RefParameter @Override public void accept(@NotNull final RefVisitor visitor) { if (visitor instanceof RefJavaVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - ((RefJavaVisitor)visitor).visitParameter(RefParameterImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> ((RefJavaVisitor)visitor).visitParameter(RefParameterImpl.this)); } else { super.accept(visitor); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java index 32b1e019c3b7..23895730d06f 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java @@ -84,9 +84,7 @@ public class UnusedLibrariesInspection extends GlobalInspectionTool { final Set files = new HashSet(Arrays.asList(((LibraryOrderEntry)entry).getRootFiles(OrderRootType.CLASSES))); files.removeAll(usedRoots); if (!files.isEmpty()) { - final String unusedLibraryRoots = StringUtil.join(files, file -> { - return file.getPresentableName(); - }, ","); + final String unusedLibraryRoots = StringUtil.join(files, file -> file.getPresentableName(), ","); String message = InspectionsBundle.message("unused.library.roots.problem.descriptor", unusedLibraryRoots, entry.getPresentableName()); processor.addProblemElement(refModule, diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java index 554d58eca949..5f8386ae9edf 100644 --- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java @@ -159,10 +159,8 @@ public class ExternalAnnotationsManagerImpl extends ReadableExternalAnnotationsM notifyAfterAnnotationChanging(listOwner, annotationFQName, false); return; } - application.invokeLater(() -> { - DumbService.getInstance(project).withAlternativeResolveEnabled( - () -> setupRootAndAnnotateExternally(entry, project, listOwner, annotationFQName, fromFile, packageName, value)); - }, project.getDisposed()); + application.invokeLater(() -> DumbService.getInstance(project).withAlternativeResolveEnabled( + () -> setupRootAndAnnotateExternally(entry, project, listOwner, annotationFQName, fromFile, packageName, value)), project.getDisposed()); } break; } diff --git a/java/java-impl/src/com/intellij/codeInsight/MakeInferredAnnotationExplicit.java b/java/java-impl/src/com/intellij/codeInsight/MakeInferredAnnotationExplicit.java index 74bf57d177c6..cce827ae2a8d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/MakeInferredAnnotationExplicit.java +++ b/java/java-impl/src/com/intellij/codeInsight/MakeInferredAnnotationExplicit.java @@ -94,10 +94,8 @@ public class MakeInferredAnnotationExplicit extends BaseIntentionAction { return; } - WriteCommandAction.runWriteCommandAction(project, () -> { - DumbService.getInstance(project).withAlternativeResolveEnabled( - () -> JavaCodeStyleManager.getInstance(project).shortenClassReferences(modifierList.addAfter(toInsert, null))); - }); + WriteCommandAction.runWriteCommandAction(project, () -> DumbService.getInstance(project).withAlternativeResolveEnabled( + () -> JavaCodeStyleManager.getInstance(project).shortenClassReferences(modifierList.addAfter(toInsert, null)))); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java index 6167af4a18a9..dea033613fd2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java @@ -112,18 +112,14 @@ public class JavaCompletionUtil { } public static void putAllMethods(LookupElement item, List methods) { - item.putUserData(ALL_METHODS_ATTRIBUTE, ContainerUtil.map(methods, method -> { - return SmartPointerManager.getInstance(method.getProject()).createSmartPsiElementPointer(method); - })); + item.putUserData(ALL_METHODS_ATTRIBUTE, ContainerUtil.map(methods, method -> SmartPointerManager.getInstance(method.getProject()).createSmartPsiElementPointer(method))); } public static List getAllMethods(LookupElement item) { List> pointers = item.getUserData(ALL_METHODS_ATTRIBUTE); if (pointers == null) return null; - return ContainerUtil.mapNotNull(pointers, pointer -> { - return pointer.getElement(); - }); + return ContainerUtil.mapNotNull(pointers, pointer -> pointer.getElement()); } public static String[] completeVariableNameForRefactoring(JavaCodeStyleManager codeStyleManager, @Nullable final PsiType varType, diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java index 47a4418c25e2..b893afb3912f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java @@ -90,9 +90,7 @@ public class JavaSmartCompletionContributor extends CompletionContributor { if (psiElement().afterLeaf(psiElement().withText(".")).withSuperParent(2, psiElement(PsiNewExpression.class)).accepts(element)) { if (((PsiNewExpression)element.getParent().getParent()).getClassReference() == element.getParent()) { PsiType[] types = ExpectedTypesGetter.getExpectedTypes(element, false); - return new OrFilter(ContainerUtil.map2Array(types, ElementFilter.class, (Function)type -> { - return new AssignableFromFilter(type); - })); + return new OrFilter(ContainerUtil.map2Array(types, ElementFilter.class, (Function)type -> new AssignableFromFilter(type))); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SameSignatureCallParametersProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/SameSignatureCallParametersProvider.java index af5d6d814dd0..4a78f330e5ee 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/SameSignatureCallParametersProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/SameSignatureCallParametersProvider.java @@ -76,9 +76,7 @@ class SameSignatureCallParametersProvider extends CompletionProvider { - return psiParameter.getName(); - }, ", "); + final String lookupString = StringUtil.join(parameters, psiParameter -> psiParameter.getName(), ", "); final int w = PlatformIcons.PARAMETER_ICON.getIconWidth(); LayeredIcon icon = new LayeredIcon(2); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java index 6db4a0c3b023..d90d0ed77972 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/TypeArgumentCompletionProvider.java @@ -199,9 +199,7 @@ class TypeArgumentCompletionProvider extends CompletionProvider { - return item.getType().getPresentableText(); - }, ", "); + myLookupString = StringUtil.join(myTypeItems, item -> item.getType().getPresentableText(), ", "); } @NotNull diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/AddImportAction.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/AddImportAction.java index 43ced2a7bc5e..adcd8edc243a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/AddImportAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/AddImportAction.java @@ -210,9 +210,7 @@ public class AddImportAction implements QuestionAction { private void addImport(final PsiReference ref, final PsiClass targetClass) { StatisticsManager.getInstance().incUseCount(JavaStatisticsManager.createInfo(null, targetClass)); - CommandProcessor.getInstance().executeCommand(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> { - DumbService.getInstance(myProject).withAlternativeResolveEnabled(() -> _addImport(ref, targetClass)); - }), QuickFixBundle.message("add.import"), null); + CommandProcessor.getInstance().executeCommand(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> DumbService.getInstance(myProject).withAlternativeResolveEnabled(() -> _addImport(ref, targetClass))), QuickFixBundle.message("add.import"), null); } private void _addImport(PsiReference ref, PsiClass targetClass) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionFromFieldInitializerToConstructorThrowsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionFromFieldInitializerToConstructorThrowsFix.java index e21bad023b76..4f340657e2f6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionFromFieldInitializerToConstructorThrowsFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionFromFieldInitializerToConstructorThrowsFix.java @@ -82,9 +82,7 @@ public class AddExceptionFromFieldInitializerToConstructorThrowsFix extends Base PsiMethod[] constructors = aClass.getConstructors(); if (constructors.length == 0) { final AddDefaultConstructorFix defaultConstructorFix = new AddDefaultConstructorFix(aClass); - ApplicationManager.getApplication().runWriteAction(() -> { - defaultConstructorFix.invoke(project, null, file); - }); + ApplicationManager.getApplication().runWriteAction(() -> defaultConstructorFix.invoke(project, null, file)); constructors = aClass.getConstructors(); LOG.assertTrue(constructors.length != 0); } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java index ab5997d6a3ba..6eed4bdbe223 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java @@ -129,9 +129,7 @@ public class AddMethodQualifierFix implements IntentionAction { @Override public PopupStep onChosen(final PsiVariable selectedValue, final boolean finalChoice) { if (selectedValue != null && finalChoice) { - WriteCommandAction.runWriteCommandAction(selectedValue.getProject(), () -> { - qualify(selectedValue, editor); - }); + WriteCommandAction.runWriteCommandAction(selectedValue.getProject(), () -> qualify(selectedValue, editor)); } return FINAL_CHOICE; } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java index 61fe89b7f421..7ee09739cf3e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java @@ -229,9 +229,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig } }; processor.run(); - ApplicationManager.getApplication().runWriteAction(() -> { - UndoUtil.markPsiFileForUndo(file); - }); + ApplicationManager.getApplication().runWriteAction(() -> UndoUtil.markPsiFileForUndo(file)); return Arrays.asList(newParametersInfo); } else { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java index c4c79c02d31b..08092bfc733c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java @@ -71,9 +71,7 @@ public class ChangeParameterClassFix extends ExtendsListFix { final PsiClass myClass = (PsiClass)startElement; if (!FileModificationService.getInstance().prepareFileForWrite(file)) return; ApplicationManager.getApplication().runWriteAction( - () -> { - invokeImpl(myClass); - } + () -> invokeImpl(myClass) ); final Editor editor1 = CodeInsightUtil.positionCursorAtLBrace(project, myClass.getContainingFile(), myClass); if (editor1 == null) return; @@ -83,9 +81,7 @@ public class ChangeParameterClassFix extends ExtendsListFix { ApplicationManager.getApplication().runWriteAction( () -> { Collection members = - ContainerUtil.map2List(toImplement, s -> { - return new PsiMethodMember(s); - }); + ContainerUtil.map2List(toImplement, s -> new PsiMethodMember(s)); OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(editor1, myClass, members, false); }); } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java index 5dbc30cd978e..0f3a42f40263 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java @@ -103,9 +103,7 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction { PsiMethod[] constructors = myClass.getConstructors(); if (constructors.length == 0) { final AddDefaultConstructorFix defaultConstructorFix = new AddDefaultConstructorFix(myClass); - ApplicationManager.getApplication().runWriteAction(() -> { - defaultConstructorFix.invoke(project, editor, file); - }); + ApplicationManager.getApplication().runWriteAction(() -> defaultConstructorFix.invoke(project, editor, file)); constructors = myClass.getConstructors(); } Arrays.sort(constructors, new Comparator() { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java index ec0ccbaa7934..f8834c2cf68a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java @@ -60,9 +60,7 @@ public class CreateEnumConstantFromUsageFix extends CreateVarFromUsageFix implem final PsiMethod constructor = constructors[0]; final PsiParameter[] parameters = constructor.getParameterList().getParameters(); if (parameters.length > 0) { - final String params = StringUtil.join(parameters, psiParameter -> { - return psiParameter.getName(); - }, ","); + final String params = StringUtil.join(parameters, psiParameter -> psiParameter.getName(), ","); enumConstant = (PsiEnumConstant)enumConstant.replace(elementFactory.createEnumConstantFromText(name + "(" + params + ")", null)); final TemplateBuilderImpl builder = new TemplateBuilderImpl(enumConstant); diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java index ced50080700f..bd7a112f98e6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java @@ -107,9 +107,7 @@ public abstract class CreateFromUsageBaseFix extends BaseIntentionAction { } IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace(); - ApplicationManager.getApplication().runWriteAction(() -> { - invokeImpl(targetClass); - }); + ApplicationManager.getApplication().runWriteAction(() -> invokeImpl(targetClass)); } @Nullable diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java index 8c3c587f9811..3393fd232560 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java @@ -127,9 +127,7 @@ public class CreateMethodFromMethodReferenceFix extends CreateFromUsageBaseFix { final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, classResolveResult); final ExpectedTypeInfo[] expectedTypes = {new ExpectedTypeInfoImpl(interfaceReturnType, ExpectedTypeInfo.TYPE_OR_SUBTYPE, interfaceReturnType, TailType.NONE, null, ExpectedTypeInfoImpl.NULL)}; CreateMethodFromUsageFix.doCreate(targetClass, method, false, - ContainerUtil.map2List(interfaceMethod.getParameterList().getParameters(), parameter -> { - return Pair.create(null, substitutor.substitute(parameter.getType())); - }), + ContainerUtil.map2List(interfaceMethod.getParameterList().getParameters(), parameter -> Pair.create(null, substitutor.substitute(parameter.getType()))), PsiSubstitutor.EMPTY, expectedTypes, context); } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java index d26277ca7246..2a4ca92cdcd2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java @@ -128,9 +128,7 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix implement public FieldExpression(final PsiField field, PsiClass aClass, PsiType[] expectedTypes) { myField = field; myClass = aClass; - myExpectedTypes = ContainerUtil.map(expectedTypes, type -> { - return SmartTypePointerManager.getInstance(field.getProject()).createSmartTypePointer(type); - }); + myExpectedTypes = ContainerUtil.map(expectedTypes, type -> SmartTypePointerManager.getInstance(field.getProject()).createSmartTypePointer(type)); myDefaultFieldName = field.getName(); } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateStaticMethodQuickFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateStaticMethodQuickFix.java index 6a176a439d45..cdaa2aad68ff 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateStaticMethodQuickFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateStaticMethodQuickFix.java @@ -66,9 +66,7 @@ public class CreateStaticMethodQuickFix implements LocalQuickFix { } PsiUtil.setModifierProperty(method, PsiModifier.STATIC, true); - List> args = ContainerUtil.map(types, s -> { - return new Pair(null, PsiType.getTypeByName(s, project, GlobalSearchScope.allScope(project))); - }); + List> args = ContainerUtil.map(types, s -> new Pair(null, PsiType.getTypeByName(s, project, GlobalSearchScope.allScope(project)))); CreateMethodFromUsageFix.doCreate(targetClass, method, false, args, PsiSubstitutor.UNKNOWN, diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InitializeFinalFieldInConstructorFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InitializeFinalFieldInConstructorFix.java index 3eae157e3722..f7b2e1a075b6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InitializeFinalFieldInConstructorFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InitializeFinalFieldInConstructorFix.java @@ -87,9 +87,7 @@ public class InitializeFinalFieldInConstructorFix implements IntentionAction { final List constructors = choose(filterIfFieldAlreadyAssigned(myField, myClass.getConstructors()), project); - ApplicationManager.getApplication().runWriteAction(() -> { - addFieldInitialization(constructors, myField, project, editor); - }); + ApplicationManager.getApplication().runWriteAction(() -> addFieldInitialization(constructors, myField, project, editor)); } private static void addFieldInitialization(@NotNull List constructors, @@ -182,9 +180,7 @@ public class InitializeFinalFieldInConstructorFix implements IntentionAction { private static void createDefaultConstructor(PsiClass psiClass, @NotNull final Project project, final Editor editor, final PsiFile file) { final AddDefaultConstructorFix defaultConstructorFix = new AddDefaultConstructorFix(psiClass); - ApplicationManager.getApplication().runWriteAction(() -> { - defaultConstructorFix.invoke(project, editor, file); - }); + ApplicationManager.getApplication().runWriteAction(() -> defaultConstructorFix.invoke(project, editor, file)); } private static PsiMethod[] filterIfFieldAlreadyAssigned(@NotNull PsiField field, @NotNull PsiMethod[] ctors) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java index f40d7ebd476f..feeb6642cd99 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java @@ -214,9 +214,7 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix { @NotNull public static List refreshAndConvertToUrls(@NotNull List jarPaths) { - return ContainerUtil.map(jarPaths, path -> { - return refreshAndConvertToUrl(path); - }); + return ContainerUtil.map(jarPaths, path -> refreshAndConvertToUrl(path)); } @NotNull diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/CreateClassOrPackageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/CreateClassOrPackageFix.java index 39bcce5b0833..80d010bfb8a2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/CreateClassOrPackageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/CreateClassOrPackageFix.java @@ -134,9 +134,7 @@ public class CreateClassOrPackageFix extends LocalQuickFixAndIntentionActionOnPs protected void run(@NotNull Result result) throws Throwable { final PsiDirectory directory = chooseDirectory(project, file); if (directory == null) return; - ApplicationManager.getApplication().runWriteAction(() -> { - doCreate(directory, startElement); - }); + ApplicationManager.getApplication().runWriteAction(() -> doCreate(directory, startElement)); } }.execute(); } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java index 3f8b378ef813..38eacc30395a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java @@ -75,9 +75,7 @@ public class RedundantLambdaParameterTypeIntention extends PsiElementBaseIntenti final PsiExpression[] arguments = ((PsiExpressionList)lambdaParent).getExpressions(); final JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project); arguments[idx] = javaPsiFacade.getElementFactory().createExpressionFromText( - "(" + StringUtil.join(expression.getParameterList().getParameters(), parameter -> { - return parameter.getName(); - }, ", ") + ") -> {}", expression); + "(" + StringUtil.join(expression.getParameterList().getParameters(), parameter -> parameter.getName(), ", ") + ") -> {}", expression); final PsiParameter[] methodParams = method.getParameterList().getParameters(); final PsiSubstitutor substitutor = javaPsiFacade.getResolveHelper() .inferTypeArguments(typeParameters, methodParams, arguments, ((MethodCandidateInfo)resolveResult).getSiteSubstitutor(), @@ -123,9 +121,7 @@ public class RedundantLambdaParameterTypeIntention extends PsiElementBaseIntenti text = parameters[0].getName(); } else { - text = "(" + StringUtil.join(parameters, parameter -> { - return parameter.getName(); - }, ", ") + ")"; + text = "(" + StringUtil.join(parameters, parameter -> parameter.getName(), ", ") + ")"; } final PsiLambdaExpression expression = (PsiLambdaExpression)JavaPsiFacade.getElementFactory(lambdaExpression.getProject()) .createExpressionFromText(text + "->{}", lambdaExpression); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java index 701e6c83d98d..a38ff4a59404 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java @@ -121,9 +121,7 @@ public abstract class CopyPasteReferenceProcessor exten askReferencesToRestore(project, refs, referenceData); } PsiDocumentManager.getInstance(project).commitAllDocuments(); - ApplicationManager.getApplication().runWriteAction(() -> { - restoreReferences(referenceData, refs); - }); + ApplicationManager.getApplication().runWriteAction(() -> restoreReferences(referenceData, refs)); } protected static void addReferenceData(final PsiElement element, diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateAccessorProviderRegistrar.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateAccessorProviderRegistrar.java index f1e63fd84d53..9a97137d4c43 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateAccessorProviderRegistrar.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateAccessorProviderRegistrar.java @@ -47,8 +47,6 @@ public class GenerateAccessorProviderRegistrar { } protected synchronized static List getEncapsulatableClassMembers(final PsiClass psiClass) { - return ContainerUtil.concat(ourProviders, s -> { - return s.fun(psiClass); - }); + return ContainerUtil.concat(ourProviders, s -> s.fun(psiClass)); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java index d75058de9430..d8f8501d8717 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java @@ -95,9 +95,7 @@ public class GenerateConstructorHandler extends GenerateMembersHandlerBase { } else { final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(baseClass, aClass, PsiSubstitutor.EMPTY); - PsiMethodMember[] constructors = ContainerUtil.map2Array(array, PsiMethodMember.class, s -> { - return new PsiMethodMember(s, substitutor); - }); + PsiMethodMember[] constructors = ContainerUtil.map2Array(array, PsiMethodMember.class, s -> new PsiMethodMember(s, substitutor)); MemberChooser chooser = new MemberChooser(constructors, false, true, project); chooser.setTitle(CodeInsightBundle.message("generate.constructor.super.constructor.chooser.title")); chooser.show(); @@ -296,9 +294,7 @@ public class GenerateConstructorHandler extends GenerateMembersHandlerBase { generator.generateSuperCallIfNeeded(buffer, baseConstructor.getParameterList().getParameters()); } final PsiParameter[] parameters = fieldParams.toArray(new PsiParameter[fieldParams.size()]); - final List existingNames = ContainerUtil.map(dummyConstructor.getParameterList().getParameters(), parameter -> { - return parameter.getName(); - }); + final List existingNames = ContainerUtil.map(dummyConstructor.getParameterList().getParameters(), parameter -> parameter.getName()); if (generator instanceof ConstructorBodyGeneratorEx) { ((ConstructorBodyGeneratorEx)generator).generateFieldInitialization(buffer, fields, parameters, existingNames); } diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/JavaOverrideImplementMemberChooser.java b/java/java-impl/src/com/intellij/codeInsight/generation/JavaOverrideImplementMemberChooser.java index 6b705ef8bb82..9d1152d528fb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/JavaOverrideImplementMemberChooser.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/JavaOverrideImplementMemberChooser.java @@ -185,9 +185,7 @@ public class JavaOverrideImplementMemberChooser extends MemberChooser candidates) { - return ContainerUtil.map2Array(candidates, PsiMethodMember.class, s -> { - return new PsiMethodMember(s); - }); + return ContainerUtil.map2Array(candidates, PsiMethodMember.class, s -> new PsiMethodMember(s)); } private class MySortByOverridingAction extends ToggleAction { diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java index 0858f5d9176d..4ad2d7e766de 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java @@ -281,9 +281,7 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil { boolean toCopyJavaDoc, boolean toInsertAtOverride) throws IncorrectOperationException { - List candidateInfos = ContainerUtil.map2List(candidates, s -> { - return new CandidateInfo(s.getElement(), s.getSubstitutor()); - }); + List candidateInfos = ContainerUtil.map2List(candidates, s -> new CandidateInfo(s.getElement(), s.getSubstitutor())); final List methods = overrideOrImplementMethodCandidates(aClass, candidateInfos, toCopyJavaDoc, toInsertAtOverride); return convert2GenerationInfos(methods); } @@ -302,9 +300,7 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil { } public static List> convert2GenerationInfos(final Collection methods) { - return ContainerUtil.map2List(methods, s -> { - return createGenerationInfo(s); - }); + return ContainerUtil.map2List(methods, s -> createGenerationInfo(s)); } public static PsiGenerationInfo createGenerationInfo(PsiMethod s) { diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/ReferenceParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/ReferenceParameterInfoHandler.java index 07649f26b5ec..3dc1d803a82a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/ReferenceParameterInfoHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/ReferenceParameterInfoHandler.java @@ -106,9 +106,7 @@ public class ReferenceParameterInfoHandler implements ParameterInfoHandler { - return t.getPresentableText(); - }, ", ")); + t -> t.getPresentableText(), ", ")); context.setupUIComponentPresentation(buffer.toString(), 0, highlightEndOffset, false, false, false, context.getDefaultParameterColor()); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java index ccb306c80985..f01848a282bf 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java @@ -65,9 +65,7 @@ public class CopyAbstractMethodImplementationHandler { } public void invoke() { - ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> { - searchExistingImplementations(); - }), CodeInsightBundle.message("searching.for.implementations"), false, myProject); + ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> searchExistingImplementations()), CodeInsightBundle.message("searching.for.implementations"), false, myProject); if (mySourceMethods.isEmpty()) { Messages.showErrorDialog(myProject, CodeInsightBundle.message("copy.abstract.method.no.existing.implementations.found"), CodeInsightBundle.message("copy.abstract.method.title")); diff --git a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java index b9cb797331c3..d9ad26085d16 100644 --- a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java +++ b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java @@ -446,9 +446,7 @@ public class JavaDocInfoGenerator { buffer.append(""); } String errorSection = "

Following external urls were checked:
   " + - StringUtil.join(docURLs, url -> { - return XmlStringUtil.escapeString(url); - }, "
   ") + + StringUtil.join(docURLs, url -> XmlStringUtil.escapeString(url), "
   ") + "
The documentation for this element is not found. Please add all the needed paths to API docs in " + "Project Settings.

"; buffer.insert(buffer.indexOf(""), errorSection); diff --git a/java/java-impl/src/com/intellij/codeInsight/template/macro/GroovyScriptMacro.java b/java/java-impl/src/com/intellij/codeInsight/template/macro/GroovyScriptMacro.java index a0a158cb4e49..4b7b9fe06ab3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/macro/GroovyScriptMacro.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/macro/GroovyScriptMacro.java @@ -67,9 +67,7 @@ public class GroovyScriptMacro extends Macro { Result paramResult = params[i].calculateResult(context); Object value = null; if (paramResult instanceof ListResult) { - value = ContainerUtil.map2List(((ListResult)paramResult).getComponents(), result1 -> { - return result1.toString(); - }); + value = ContainerUtil.map2List(((ListResult)paramResult).getComponents(), result1 -> result1.toString()); } else if (paramResult != null) { value = paramResult.toString(); } diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java index 1380a5641d24..e3894027d575 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java @@ -83,13 +83,11 @@ public class JavaPostfixTemplateProvider implements PostfixTemplateProvider { ApplicationManager.getApplication().assertIsDispatchThread(); if (isSemicolonNeeded(file, editor)) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().runUndoTransparentAction( - () -> { - EditorModificationUtil.insertStringAtCaret(editor, ";", false, false); - PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument()); - }); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().runUndoTransparentAction( + () -> { + EditorModificationUtil.insertStringAtCaret(editor, ";", false, false); + PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument()); + })); } } diff --git a/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java b/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java index 7e523b53a4a5..0d99c4ef4c3b 100644 --- a/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java @@ -279,9 +279,7 @@ public class CollectionAddAllCanBeReplacedWithConstructorInspection extends Base if (psiExpression instanceof PsiReferenceExpression) { references.add((PsiReferenceExpression)psiExpression); } - return ContainerUtil.mapNotNull(references, (NullableFunction)expression1 -> { - return expression1.resolve(); - }); + return ContainerUtil.mapNotNull(references, (NullableFunction)expression1 -> expression1.resolve()); } private static boolean isReferenceToOneOf(PsiReferenceExpression reference, List elements) { diff --git a/java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java b/java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java index d344ebc9c2b4..44b361bfcdcf 100644 --- a/java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java @@ -333,9 +333,7 @@ public class EmptyMethodInspection extends GlobalJavaBatchInspectionTool { }); } - ApplicationManager.getApplication().invokeLater(() -> { - SafeDeleteHandler.invoke(project, PsiUtilCore.toPsiElementArray(psiElements), false); - }, project.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> SafeDeleteHandler.invoke(project, PsiUtilCore.toPsiElementArray(psiElements), false), project.getDisposed()); } } } @@ -399,9 +397,7 @@ public class EmptyMethodInspection extends GlobalJavaBatchInspectionTool { } } } - ApplicationManager.getApplication().invokeLater(() -> { - SafeDeleteHandler.invoke(project, PsiUtilCore.toPsiElementArray(psiElementsToIgnore), false, refreshViews); - }, project.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> SafeDeleteHandler.invoke(project, PsiUtilCore.toPsiElementArray(psiElementsToIgnore), false, refreshViews), project.getDisposed()); } } } diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java index 2b33f2d50c37..6a9b2a5ffd63 100644 --- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java +++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java @@ -273,9 +273,7 @@ public class InferNullityAnnotationsAction extends BaseAnalysisAction { private void showUsageView(@NotNull Project project, final UsageInfo[] usageInfos, @NotNull AnalysisScope scope) { final UsageTarget[] targets = UsageTarget.EMPTY_ARRAY; final Ref convertUsagesRef = new Ref(); - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> { - convertUsagesRef.set(UsageInfo2UsageAdapter.convert(usageInfos)); - }), "Preprocess Usages", true, project)) return; + if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> convertUsagesRef.set(UsageInfo2UsageAdapter.convert(usageInfos))), "Preprocess Usages", true, project)) return; if (convertUsagesRef.isNull()) return; final Usage[] usages = convertUsagesRef.get(); diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java index 213ff180fb86..83f5d02dbc63 100644 --- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java +++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java @@ -182,9 +182,7 @@ public class NullityInferrer { private static void invoke(final Project project, final PsiModifierListOwner element, final String fqn, final String toRemove) { - WriteCommandAction.runWriteCommandAction(project, () -> { - new AddAnnotationFix(fqn, element, toRemove).invoke(project, null, element.getContainingFile()); - }); + WriteCommandAction.runWriteCommandAction(project, () -> new AddAnnotationFix(fqn, element, toRemove).invoke(project, null, element.getContainingFile())); } public int getCount() { diff --git a/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java b/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java index ff5ba95f034b..0cce907be910 100644 --- a/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java +++ b/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java @@ -209,9 +209,7 @@ public class AddMethodsDialog extends DialogWrapper { final String fqn = aClass.getQualifiedName(); LOG.assertTrue(fqn != null); final String parameters = - StringUtil.join(ContainerUtil.map(method.getParameterList().getParameters(), parameter -> { - return parameter.getName(); - }), ", "); + StringUtil.join(ContainerUtil.map(method.getParameterList().getParameters(), parameter -> parameter.getName()), ", "); final String expressionText = fqn + "." + method.getName() + "(" + parameters + ")"; final PsiExpression psiExpression = JavaPsiFacade.getElementFactory(method.getProject()) .createExpressionFromText(expressionText, null); diff --git a/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/PseudoLambdaReplaceTemplate.java b/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/PseudoLambdaReplaceTemplate.java index bc976a85f807..49a82b8c69a5 100644 --- a/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/PseudoLambdaReplaceTemplate.java +++ b/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/PseudoLambdaReplaceTemplate.java @@ -95,9 +95,7 @@ public class PseudoLambdaReplaceTemplate { public ValidationInfo validate(final PsiMethod method) { final PsiParameter[] parameters = method.getParameterList().getParameters(); final PsiType[] parameterTypes = - ContainerUtil.map2Array(Arrays.asList(parameters), new PsiType[parameters.length], parameter -> { - return parameter.getType(); - }); + ContainerUtil.map2Array(Arrays.asList(parameters), new PsiType[parameters.length], parameter -> parameter.getType()); final PsiType returnType = method.getReturnType(); if (StreamApiConstants.FAKE_FIND_MATCHED.equals(myStreamApiMethodName)) { diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java b/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java index ecbb97ddede9..1fbd0673b5ac 100644 --- a/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java +++ b/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java @@ -47,43 +47,41 @@ abstract class OverrideImplementMethodAction extends AnAction { if (project == null) return; final String commandName = event.getPresentation().getText(); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> { + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { - try{ - final HierarchyNodeDescriptor[] selectedDescriptors = methodHierarchyBrowser.getSelectedDescriptors(); - if (selectedDescriptors.length > 0) { - final List files = new ArrayList(selectedDescriptors.length); - for (HierarchyNodeDescriptor selectedDescriptor : selectedDescriptors) { - final PsiFile containingFile = ((MethodHierarchyNodeDescriptor)selectedDescriptor).getPsiClass().getContainingFile(); - if (containingFile != null) { - final VirtualFile vFile = containingFile.getVirtualFile(); - if (vFile != null) { - files.add(vFile); - } + try{ + final HierarchyNodeDescriptor[] selectedDescriptors = methodHierarchyBrowser.getSelectedDescriptors(); + if (selectedDescriptors.length > 0) { + final List files = new ArrayList(selectedDescriptors.length); + for (HierarchyNodeDescriptor selectedDescriptor : selectedDescriptors) { + final PsiFile containingFile = ((MethodHierarchyNodeDescriptor)selectedDescriptor).getPsiClass().getContainingFile(); + if (containingFile != null) { + final VirtualFile vFile = containingFile.getVirtualFile(); + if (vFile != null) { + files.add(vFile); } } - final ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(VfsUtil.toVirtualFileArray(files)); - if (!status.hasReadonlyFiles()) { - for (HierarchyNodeDescriptor selectedDescriptor : selectedDescriptors) { - final PsiElement aClass = ((MethodHierarchyNodeDescriptor)selectedDescriptor).getPsiClass(); - if (aClass instanceof PsiClass) { - OverrideImplementUtil.overrideOrImplement((PsiClass)aClass, methodHierarchyBrowser.getBaseMethod()); - } + } + final ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(VfsUtil.toVirtualFileArray(files)); + if (!status.hasReadonlyFiles()) { + for (HierarchyNodeDescriptor selectedDescriptor : selectedDescriptors) { + final PsiElement aClass = ((MethodHierarchyNodeDescriptor)selectedDescriptor).getPsiClass(); + if (aClass instanceof PsiClass) { + OverrideImplementUtil.overrideOrImplement((PsiClass)aClass, methodHierarchyBrowser.getBaseMethod()); } - ToolWindowManager.getInstance(project).activateEditorComponent(); } - else { - ApplicationManager.getApplication().invokeLater( - () -> Messages.showErrorDialog(project, status.getReadonlyFilesMessage(), commandName)); - } + ToolWindowManager.getInstance(project).activateEditorComponent(); + } + else { + ApplicationManager.getApplication().invokeLater( + () -> Messages.showErrorDialog(project, status.getReadonlyFilesMessage(), commandName)); } } - catch(IncorrectOperationException e){ - LOG.error(e); - } - }, commandName, null); - }); + } + catch(IncorrectOperationException e){ + LOG.error(e); + } + }, commandName, null)); } public final void update(final AnActionEvent e) { diff --git a/java/java-impl/src/com/intellij/internal/StaticIconFieldsAction.java b/java/java-impl/src/com/intellij/internal/StaticIconFieldsAction.java index c7deee36b44e..8812226e2967 100644 --- a/java/java-impl/src/com/intellij/internal/StaticIconFieldsAction.java +++ b/java/java-impl/src/com/intellij/internal/StaticIconFieldsAction.java @@ -74,9 +74,7 @@ public class StaticIconFieldsAction extends AnAction { } private static void searchFields(final PsiClass allIcons, final UsageView view, final ProgressIndicator indicator) { - ApplicationManager.getApplication().runReadAction(() -> { - indicator.setText("Searching for: " + allIcons.getQualifiedName()); - }); + ApplicationManager.getApplication().runReadAction(() -> indicator.setText("Searching for: " + allIcons.getQualifiedName())); ReferencesSearch.search(allIcons).forEach(reference -> { PsiElement elt = reference.getElement(); diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java index 6c826405fcc7..a1899cadc5db 100644 --- a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java +++ b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java @@ -266,13 +266,9 @@ public class JavaSdkImpl extends JavaSdk { } private static void scanFolder(File javasFolder, ArrayList result) { - File[] candidates = javasFolder.listFiles(pathname -> { - return JdkUtil.checkForJdk(pathname); - }); + File[] candidates = javasFolder.listFiles(pathname -> JdkUtil.checkForJdk(pathname)); if (candidates != null) { - result.addAll(ContainerUtil.map2List(candidates, file -> { - return file.getAbsolutePath(); - })); + result.addAll(ContainerUtil.map2List(candidates, file -> file.getAbsolutePath())); } } diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java b/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java index ca4bdc161aeb..3d4db7d5cbd5 100644 --- a/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java +++ b/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java @@ -55,8 +55,6 @@ public class LanguageLevelUsagesCollector extends AbstractApplicationUsagesColle } languageLevels.add(LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().toString()); - return ContainerUtil.map2Set(languageLevels, languageLevel -> { - return new UsageDescriptor(languageLevel, 1); - }); + return ContainerUtil.map2Set(languageLevels, languageLevel -> new UsageDescriptor(languageLevel, 1)); } } diff --git a/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java b/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java index 16c1fd6ff693..152b1071d251 100644 --- a/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java +++ b/java/java-impl/src/com/intellij/psi/refResolve/RefResolveServiceImpl.java @@ -169,9 +169,7 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable @NotNull private static String toVfString(@NotNull Collection list) { List sub = new ArrayList(list).subList(0, Math.min(list.size(), 100)); - return list.size() + " files: " + StringUtil.join(sub, file -> { - return file.getName(); - }, ", ") + (list.size() == sub.size() ? "" : "..."); + return list.size() + " files: " + StringUtil.join(sub, file -> file.getName(), ", ") + (list.size() == sub.size() ? "" : "..."); } private void initListeners(@NotNull MessageBus messageBus, @NotNull PsiManager psiManager) { @@ -538,9 +536,7 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable }, indicator); return result[0]; }; - List> futures = ContainerUtil.map(Collections.nCopies(parallelism, ""), s -> { - return myApplication.executeOnPooledThread(processFileFromSet); - }); + List> futures = ContainerUtil.map(Collections.nCopies(parallelism, ""), s -> myApplication.executeOnPooledThread(processFileFromSet)); List results = ContainerUtil.map(futures, future -> { try { diff --git a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiEnter.java b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiEnter.java index 2d72db1372d6..96b897f2fce5 100644 --- a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiEnter.java +++ b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiEnter.java @@ -42,9 +42,7 @@ public class PsiEnter { } void enter(final PsiClassOwner psiClassOwner) { - ApplicationManager.getApplication().runReadAction(() -> { - enterTopLevels(psiClassOwner); - }); + ApplicationManager.getApplication().runReadAction(() -> enterTopLevels(psiClassOwner)); } private void enterTopLevels(PsiClassOwner owner) { diff --git a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiHierachyConnector.java b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiHierachyConnector.java index 16397ee6a580..fe4c2def71a0 100644 --- a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiHierachyConnector.java +++ b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/PsiHierachyConnector.java @@ -32,9 +32,7 @@ public class PsiHierachyConnector implements HierarchyConnector { @Override public void connect(final Symbol sym) { - ApplicationManager.getApplication().runReadAction(() -> { - connectInternal((Symbol.ClassSymbol)sym); - }); + ApplicationManager.getApplication().runReadAction(() -> connectInternal((Symbol.ClassSymbol)sym)); } private void connectInternal(Symbol.ClassSymbol sym) { diff --git a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/test/TestStubHierarchyAction.java b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/test/TestStubHierarchyAction.java index a91b3a325957..7a29b2432ee2 100644 --- a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/test/TestStubHierarchyAction.java +++ b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/test/TestStubHierarchyAction.java @@ -58,9 +58,7 @@ public class TestStubHierarchyAction extends InheritanceAction { int size = symbols.myClassAnchors.length; for (int i = 0; i < size; i++) { final int finalI = i; - ApplicationManager.getApplication().runReadAction(() -> { - test(classes[finalI]); - }); + ApplicationManager.getApplication().runReadAction(() -> test(classes[finalI])); indicator.setFraction(i * 1.0 / (double)size); } LOG.info("TestStubHierarchyAction finished"); diff --git a/java/java-impl/src/com/intellij/refactoring/changeClassSignature/TypeParameterInfo.java b/java/java-impl/src/com/intellij/refactoring/changeClassSignature/TypeParameterInfo.java index 5ecda1c11d86..3ea6a681b86a 100644 --- a/java/java-impl/src/com/intellij/refactoring/changeClassSignature/TypeParameterInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/changeClassSignature/TypeParameterInfo.java @@ -90,9 +90,7 @@ public interface TypeParameterInfo { private static String getCanonicalText(PsiType boundType) { if (boundType instanceof PsiIntersectionType) { - return StringUtil.join(ContainerUtil.map(((PsiIntersectionType)boundType).getConjuncts(), type -> { - return type.getCanonicalText(); - }), " & "); + return StringUtil.join(ContainerUtil.map(((PsiIntersectionType)boundType).getConjuncts(), type -> type.getCanonicalText()), " & "); } return boundType.getCanonicalText(); } diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java index 93f319d43a81..592eb4114f68 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java @@ -618,9 +618,7 @@ public class ExtractMethodProcessor implements MatchProvider { return statement instanceof PsiReturnStatement && ((PsiReturnStatement)statement).getReturnValue() != null; } }); - final List map = ContainerUtil.map(filter, statement -> { - return ((PsiReturnStatement)statement).getReturnValue(); - }); + final List map = ContainerUtil.map(filter, statement -> ((PsiReturnStatement)statement).getReturnValue()); return map.toArray(new PsiExpression[map.size()]); } diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectHandler.java b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectHandler.java index 9c5292388fb1..cbf60b44b606 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectHandler.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectHandler.java @@ -103,13 +103,9 @@ public class ExtractMethodObjectHandler implements RefactoringActionHandler, Con CommandProcessor.getInstance().executeCommand(project, () -> PostprocessReformattingAspect.getInstance(project).postponeFormattingInside(() -> { try { - ApplicationManager.getApplication().runWriteAction(() -> { - extractProcessor.doRefactoring(); - }); + ApplicationManager.getApplication().runWriteAction(() -> extractProcessor.doRefactoring()); processor.run(); - ApplicationManager.getApplication().runWriteAction(() -> { - processor.runChangeSignature(); - }); + ApplicationManager.getApplication().runWriteAction(() -> processor.runChangeSignature()); } catch (IncorrectOperationException e) { LOG.error(e); @@ -117,9 +113,7 @@ public class ExtractMethodObjectHandler implements RefactoringActionHandler, Con PsiDocumentManager.getInstance(project).commitAllDocuments(); if (processor.isCreateInnerClass()) { - ApplicationManager.getApplication().runWriteAction(() -> { - processor.moveUsedMethodsToInner(); - }); + ApplicationManager.getApplication().runWriteAction(() -> processor.moveUsedMethodsToInner()); PsiDocumentManager.getInstance(project).commitAllDocuments(); if (editor != null) { DuplicatesImpl.processDuplicates(extractProcessor, project, editor); diff --git a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java index c2a652dc08c6..2ad003b011bc 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java @@ -163,9 +163,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor { myClass.getContainingFile().getContainingDirectory().getVirtualFile())) { conflicts.putValue(sourceClass, "Extracted class won't be accessible in " + RefactoringUIUtil.getDescription(sourceClass, true)); } - ApplicationManager.getApplication().runWriteAction(() -> { - myClass.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> myClass.delete()); final Project project = sourceClass.getProject(); final GlobalSearchScope scope = GlobalSearchScope.allScope(project); final PsiClass existingClass = diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java index 20ba4a534f08..81c3b3603e6b 100644 --- a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java @@ -321,9 +321,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor { final PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(expression, PsiMethodCallExpression.class); LOG.assertTrue(methodCallExpression != null); conflicts.putValue(expression, "Inlined method calls " + methodCallExpression.getText() + " which won't be accessed in " + - StringUtil.join(targetContainingClasses, psiClass -> { - return RefactoringUIUtil.getDescription(psiClass, false); - }, ",")); + StringUtil.join(targetContainingClasses, psiClass -> RefactoringUIUtil.getDescription(psiClass, false), ",")); } } } diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java index 5ca46f314be4..6089e36d7105 100644 --- a/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java +++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java @@ -114,9 +114,7 @@ public class InlineToAnonymousClassHandler extends JavaInlineActionHandler { } final Ref errorMessage = new Ref(); - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> { - errorMessage.set(getCannotInlineMessage(psiClass)); - }), "Check if inline is possible...", true, project)) return; + if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> errorMessage.set(getCannotInlineMessage(psiClass))), "Check if inline is possible...", true, project)) return; if (errorMessage.get() != null) { CommonRefactoringUtil.showErrorHint(project, editor, errorMessage.get(), RefactoringBundle.message("inline.to.anonymous.refactoring"), null); return; diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceConstructorUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceConstructorUsageInfo.java index 8da43acc27f9..b3583cb9b618 100644 --- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceConstructorUsageInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceConstructorUsageInfo.java @@ -81,9 +81,7 @@ public class ReplaceConstructorUsageInfo extends FixableUsageInfo{ if (targetClasses.length > 1) { final String conflict = "Constructor " + element.getText() + " can be replaced with any of " + StringUtil.join(targetClasses, - psiClass -> { - return psiClass.getQualifiedName(); - }, ", "); + psiClass -> psiClass.getQualifiedName(), ", "); appendConflict(conflict); } } @@ -116,9 +114,7 @@ public class ReplaceConstructorUsageInfo extends FixableUsageInfo{ final PsiExpression[] arrayDimensions = newExpression.getArrayDimensions(); if (arrayDimensions.length > 0) { buf.append("["); - buf.append(StringUtil.join(arrayDimensions, psiExpression -> { - return psiExpression.getText(); - }, "][")); + buf.append(StringUtil.join(arrayDimensions, psiExpression -> psiExpression.getText(), "][")); buf.append("]"); for (int i = 0; i < newExpressionType.getArrayDimensions() - arrayDimensions.length; i++) { buf.append("[]"); diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceReferenceUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceReferenceUsageInfo.java index 06708f8bd0dc..bb214fe9f41d 100644 --- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceReferenceUsageInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceReferenceUsageInfo.java @@ -36,9 +36,7 @@ public class ReplaceReferenceUsageInfo extends FixableUsageInfo { super(referenceExpression); myTargetClass = targetClasses[0]; myConflict = targetClasses.length > 1 ? referenceExpression.getText() + "can be replaced with any of " + StringUtil.join(targetClasses, - psiClass -> { - return psiClass.getQualifiedName(); - }, ", ") : null; + psiClass -> psiClass.getQualifiedName(), ", ") : null; } public void fixUsage() throws IncorrectOperationException { diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceStaticImportUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceStaticImportUsageInfo.java index cd31d188fa63..84bfdfa59e4a 100644 --- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceStaticImportUsageInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceStaticImportUsageInfo.java @@ -47,9 +47,7 @@ public class ReplaceStaticImportUsageInfo extends FixableUsageInfo { @Override public String getConflictMessage() { if (myTargetClasses.length != 1) { - return "Static import can be replaced with any of " + StringUtil.join(myTargetClasses, psiClass -> { - return psiClass.getQualifiedName(); - }, ", "); + return "Static import can be replaced with any of " + StringUtil.join(myTargetClasses, psiClass -> psiClass.getQualifiedName(), ", "); } return super.getConflictMessage(); } diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceWithSubtypeUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceWithSubtypeUsageInfo.java index b7ea731596eb..0a146b6739de 100644 --- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceWithSubtypeUsageInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceWithSubtypeUsageInfo.java @@ -42,9 +42,7 @@ public class ReplaceWithSubtypeUsageInfo extends FixableUsageInfo { myTargetClassType = classType; myOriginalType = myTypeElement.getType(); if (targetClasses.length > 1) { - myConflict = typeElement.getText() + " can be replaced with any of " + StringUtil.join(targetClasses, psiClass -> { - return psiClass.getQualifiedName(); - }, ", ") ; + myConflict = typeElement.getText() + " can be replaced with any of " + StringUtil.join(targetClasses, psiClass -> psiClass.getQualifiedName(), ", ") ; } } diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassToInnerProcessor.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassToInnerProcessor.java index 561726754735..2295d15e7de4 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassToInnerProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassToInnerProcessor.java @@ -233,9 +233,7 @@ public class MoveClassToInnerProcessor extends BaseRefactoringProcessor { protected String getCommandName() { return RefactoringBundle.message("move.class.to.inner.command.name", - (myClassesToMove.length > 1 ? "classes " : "class ") + StringUtil.join(myClassesToMove, psiClass -> { - return psiClass.getName(); - }, ", "), + (myClassesToMove.length > 1 ? "classes " : "class ") + StringUtil.join(myClassesToMove, psiClass -> psiClass.getName(), ", "), myTargetClass.getQualifiedName()); } diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java index 7566c589a853..066784b829de 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java @@ -116,9 +116,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase { myInnerClassChooser.setText(((PsiClass)initialTargetElement).getQualifiedName()); - ApplicationManager.getApplication().invokeLater(() -> { - myInnerClassChooser.requestFocus(); - }, ModalityState.stateForComponent(myMainPanel)); + ApplicationManager.getApplication().invokeLater(() -> myInnerClassChooser.requestFocus(), ModalityState.stateForComponent(myMainPanel)); } else if (initialTargetElement instanceof PsiPackage) { myClassPackageChooser.setText(((PsiPackage)initialTargetElement).getQualifiedName()); diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java index b6e02829a428..9a93c0e603da 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java @@ -319,10 +319,8 @@ public class MoveClassesOrPackagesImpl { final PsiDirectory selectedTarget = chooser.getSelectedDirectory(); if (selectedTarget == null) return; final MultiMap conflicts = new MultiMap(); - final Runnable analyzeConflicts = () -> ApplicationManager.getApplication().runReadAction(() -> { - RefactoringConflictsUtil - .analyzeModuleConflicts(project, Arrays.asList(directories), UsageInfo.EMPTY_ARRAY, selectedTarget, conflicts); - }); + final Runnable analyzeConflicts = () -> ApplicationManager.getApplication().runReadAction(() -> RefactoringConflictsUtil + .analyzeModuleConflicts(project, Arrays.asList(directories), UsageInfo.EMPTY_ARRAY, selectedTarget, conflicts)); if (!ProgressManager.getInstance() .runProcessWithProgressSynchronously(analyzeConflicts, "Analyze Module Conflicts...", true, project)) { return; diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java index 73fbf9a1edc2..bba84398b39b 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java @@ -245,9 +245,7 @@ public class MoveClassesOrPackagesUtil { LOG.assertTrue(newClass != null, "name: " + aClassName + ", file: " + file + ", classes: " + StringUtil.join(((PsiClassOwner)file).getClasses(), - psiClass -> { - return psiClass.getName(); - }, " ")); + psiClass -> psiClass.getName(), " ")); } } return newClass; diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java index 32bd80d2156f..34127ee3d27f 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java @@ -373,9 +373,7 @@ public class MoveInnerProcessor extends BaseRefactoringProcessor { if (containerSet.size() == 1) { placesDescription = RefactoringUIUtil.getDescription(resolved, true); } else { - placesDescription = "
  1. " + StringUtil.join(containerSet, element -> { - return RefactoringUIUtil.getDescription(element, true); - }, "
  2. ") + "
"; + placesDescription = "
  1. " + StringUtil.join(containerSet, element -> RefactoringUIUtil.getDescription(element, true), "
  2. ") + "
"; } String message = RefactoringBundle.message("0.will.become.inaccessible.from.1", placesDescription, diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteDelegateImpl.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteDelegateImpl.java index 526417a06f0f..e707208201ea 100644 --- a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteDelegateImpl.java +++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteDelegateImpl.java @@ -74,9 +74,7 @@ public class JavaSafeDeleteDelegateImpl implements JavaSafeDeleteDelegate { newText.append("/** @see #").append(method.getName()).append('('); final List parameters = new ArrayList(Arrays.asList(method.getParameterList().getParameters())); parameters.remove(parameter); - newText.append(StringUtil.join(parameters, psiParameter -> { - return psiParameter.getType().getCanonicalText(); - }, ",")); + newText.append(StringUtil.join(parameters, psiParameter -> psiParameter.getType().getCanonicalText(), ",")); newText.append(")*/"); usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) { public void deleteElement() throws IncorrectOperationException { diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java index 830ef80342c7..9b52ce7587cb 100644 --- a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java @@ -348,9 +348,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase { unselected.removeAll(selected); if (!unselected.isEmpty()) { - final List unselectedMethods = ContainerUtil.map(unselected, info -> { - return ((SafeDeleteOverridingMethodUsageInfo)info).getOverridingMethod(); - }); + final List unselectedMethods = ContainerUtil.map(unselected, info -> ((SafeDeleteOverridingMethodUsageInfo)info).getOverridingMethod()); for (Iterator iterator = result.iterator(); iterator.hasNext(); ) { final UsageInfo info = iterator.next(); diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java index 7a9db5119e70..0e92c59cf8ad 100644 --- a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java +++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java @@ -122,9 +122,7 @@ abstract class SafeDeleteJavaCalleeChooser extends JavaCallerChooser { @Override protected List computeCallers() { if (getTopMethod().equals(getMethod())) { - return ContainerUtil.map(getTopLevelItems(), info -> { - return info.getCalledMethod(); - }); + return ContainerUtil.map(getTopLevelItems(), info -> info.getCalledMethod()); } final List callees = computeCalleesSafeToDelete(getMethod()); diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java index 6fe82fe4cbd0..564820bf119f 100644 --- a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java +++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java @@ -196,9 +196,7 @@ abstract class SafeDeleteJavaCallerChooser extends JavaCallerChooser { protected List computeCallers() { if (getTopMethod().equals(getMethod())) { final ArrayList items = getTopLevelItems(); - return ContainerUtil.map(items, info -> { - return info.getCallerMethod(); - }); + return ContainerUtil.map(items, info -> info.getCallerMethod()); } final List methods = super.computeCallers(); methods.remove(getTopMethod()); diff --git a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java index a672b5ebeb9d..f09985c30211 100644 --- a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java +++ b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java @@ -96,9 +96,7 @@ public abstract class TurnRefsToSuperProcessorBase extends BaseRefactoringProces myVariablesRenames.put(pointer, variableRenamer.getNewName(variable)); } - Runnable runnable = () -> ApplicationManager.getApplication().runReadAction(() -> { - variableRenamer.findUsages(myVariablesUsages, false, false); - }); + Runnable runnable = () -> ApplicationManager.getApplication().runReadAction(() -> variableRenamer.findUsages(myVariablesUsages, false, false)); if (!ProgressManager.getInstance() .runProcessWithProgressSynchronously(runnable, RefactoringBundle.message("searching.for.variables"), true, myProject)) { diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeEvaluator.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeEvaluator.java index 85f71f8ede7a..968cd9cef331 100644 --- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeEvaluator.java +++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeEvaluator.java @@ -360,9 +360,7 @@ public class TypeEvaluator { if (types != null) { b.append(info.getElement()).append(" : "); - b.append(StringUtil.join(types, psiType -> { - return psiType.getCanonicalText(); - }, " ")); + b.append(StringUtil.join(types, psiType -> psiType.getCanonicalText(), " ")); b.append("\n"); } diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java index 4a8cead18e43..3016555b1e95 100644 --- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java +++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java @@ -208,9 +208,7 @@ public class TypeMigrationLabeler { final Set infos = new HashSet(); for (Map.Entry>> entry : myRootsTree.entrySet()) { infos.add(entry.getKey()); - infos.addAll(ContainerUtil.map(entry.getValue(), pair -> { - return pair.getFirst(); - })); + infos.addAll(ContainerUtil.map(entry.getValue(), pair -> pair.getFirst())); } return infos; } @@ -222,9 +220,7 @@ public class TypeMigrationLabeler { return Collections.emptyList().iterator(); } final List in = - ContainerUtil.map(rawNodes, pair -> { - return pair.getFirst(); - }); + ContainerUtil.map(rawNodes, pair -> pair.getFirst()); return in.iterator(); } })); diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java index bfe09bba59e6..3e4ae14f1a70 100644 --- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java @@ -84,9 +84,7 @@ public class TypeMigrationProcessor extends BaseRefactoringProcessor { final PsiElement[] roots, final Function migrationTypeFunction, final boolean optimizeImports) { - final Set containingFiles = ContainerUtil.map2Set(roots, element -> { - return element.getContainingFile(); - }); + final Set containingFiles = ContainerUtil.map2Set(roots, element -> element.getContainingFile()); final TypeMigrationProcessor processor = new TypeMigrationProcessor(project, roots, migrationTypeFunction, rules) { @Override public void performRefactoring(@NotNull final UsageInfo[] usages) { diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java index d1d3add84435..6868e376be14 100644 --- a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java +++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java @@ -175,9 +175,7 @@ public class MigrationPanel extends JPanel implements Disposable { if (!migrationNode.getInfo().isExcluded() || migrationNode.areChildrenInitialized()) { //do not walk into excluded collapsed nodes: nothing to migrate can be found final Collection nodes = migrationNode.getChildren(); for (final AbstractTreeNode node : nodes) { - ApplicationManager.getApplication().runReadAction(() -> { - expandTree((MigrationNode)node); - }); + ApplicationManager.getApplication().runReadAction(() -> expandTree((MigrationNode)node)); } } } diff --git a/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java b/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java index eeffefa075f0..32f5a1466703 100644 --- a/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java +++ b/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java @@ -360,9 +360,7 @@ public class InlineUtil { ref = parent.replace(copy); if (!result.equals(inferenceResult)) { final String inferredTypeText = StringUtil.join(inferenceResult.getTypes(), - psiType -> { - return psiType.getCanonicalText(); - }, ", "); + psiType -> psiType.getCanonicalText(), ", "); final PsiExpressionList argumentList = ((PsiNewExpression)initializer).getArgumentList(); if (argumentList != null) { final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)initializer).getClassOrAnonymousClassReference(); diff --git a/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java b/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java index 09ed96caa0c6..aedaef5b5e47 100644 --- a/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java +++ b/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java @@ -151,9 +151,7 @@ public class MethodDuplicatesHandler implements RefactoringActionHandler, Contex }); if (module != null) { final HashSet dependencies = new HashSet(); - ApplicationManager.getApplication().runReadAction(() -> { - ModuleUtilCore.collectModulesDependsOn(module, dependencies); - }); + ApplicationManager.getApplication().runReadAction(() -> ModuleUtilCore.collectModulesDependsOn(module, dependencies)); memberWithModulesMap.put(member, dependencies); } } diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java b/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java index 4b73db746123..34848382a06c 100644 --- a/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java +++ b/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java @@ -101,9 +101,7 @@ public class GenerateMissedTestsAction extends PsiElementBaseIntentionAction { if (!FileModificationService.getInstance().preparePsiElementsForWrite(testClass)) return; final MissedTestsDialog dialog = new MissedTestsDialog(project, srcClass, testClass, framework); if (dialog.showAndGet()) { - WriteCommandAction.runWriteCommandAction(project, () -> { - JavaTestGenerator.addTestMethods(editor, testClass, srcClass, framework, dialog.getSelectedMethods(), false, false); - }); + WriteCommandAction.runWriteCommandAction(project, () -> JavaTestGenerator.addTestMethods(editor, testClass, srcClass, framework, dialog.getSelectedMethods(), false, false)); } } else { diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java index 48fe391076a3..79ab634e28ea 100644 --- a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java +++ b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java @@ -202,9 +202,7 @@ public class JavaTestGenerator implements TestGenerator { final Template template = TestIntegrationUtils.createTestMethodTemplate(TestIntegrationUtils.MethodKind.TEST, descriptor, targetClass, sourceClass, null, true, existingNames); final String prefix = JavaPsiFacade.getElementFactory(targetClass.getProject()).createMethodFromText(template.getTemplateText(), targetClass).getName(); - existingNames.addAll(ContainerUtil.map(targetClass.getMethods(), method -> { - return StringUtil.decapitalize(StringUtil.trimStart(method.getName(), prefix)); - })); + existingNames.addAll(ContainerUtil.map(targetClass.getMethods(), method -> StringUtil.decapitalize(StringUtil.trimStart(method.getName(), prefix)))); for (MemberInfo m : methods) { anchor = generateMethod(TestIntegrationUtils.MethodKind.TEST, descriptor, targetClass, sourceClass, editor, m.getMember().getName(), existingNames, anchor); diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java b/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java index 3a70675195db..8af92588a52c 100644 --- a/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java +++ b/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java @@ -88,9 +88,7 @@ public class MissedTestsDialog extends DialogWrapper { final Set existingNames = new HashSet(); final String prefix = getTestPrefix(existingNames); - existingNames.addAll(ContainerUtil.map(myTestClass.getMethods(), method -> { - return StringUtil.decapitalize(StringUtil.trimStart(method.getName(), prefix)); - })); + existingNames.addAll(ContainerUtil.map(myTestClass.getMethods(), method -> StringUtil.decapitalize(StringUtil.trimStart(method.getName(), prefix)))); for (MemberInfo memberInfo : info) { diff --git a/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java b/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java index fa37621a256c..c4a119e17bc0 100644 --- a/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java +++ b/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java @@ -225,9 +225,7 @@ public class UnscrambleDialog extends DialogWrapper { @Override public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); - FileChooser.chooseFiles(descriptor, myProject, null, files -> { - myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath())); - }); + FileChooser.chooseFiles(descriptor, myProject, null, files -> myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath()))); } }); myLogFileChooserPanel.setLayout(new BorderLayout()); diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/AllClassesSearchExecutor.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/AllClassesSearchExecutor.java index 502637c81631..72821f8ba538 100644 --- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/AllClassesSearchExecutor.java +++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/AllClassesSearchExecutor.java @@ -152,9 +152,7 @@ public class AllClassesSearchExecutor implements QueryExecutor { - scopeRoot.accept(visitor); - }); + ApplicationManager.getApplication().runReadAction(() -> scopeRoot.accept(visitor)); return !stopped[0]; } diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java index 7021ca3830ab..66946ec476ac 100644 --- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java +++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java @@ -220,9 +220,7 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase files = new HashSet(); - addAllNotNull(files, map(((LocalSearchScope)useScope).getScope(), element -> { - return PsiUtilCore.getVirtualFile(element); - })); + addAllNotNull(files, map(((LocalSearchScope)useScope).getScope(), element -> PsiUtilCore.getVirtualFile(element))); scope = GlobalSearchScope.filesScope(project, files); } else { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java index ce38d59e9618..a87054821e91 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java @@ -68,6 +68,14 @@ public class InferenceVariable extends LightTypeParameter { return result.toArray(new PsiClassType[result.size()]); } + public static void addBound(PsiType inferenceVariableType, PsiType boundType, InferenceBound inferenceBound, InferenceSession session) { + final InferenceVariable variable = session.getInferenceVariable(inferenceVariableType); + if (variable != null) { + + variable.addBound(boundType, inferenceBound, session.myIncorporationPhase); + } + } + public boolean addBound(PsiType classType, InferenceBound inferenceBound, @Nullable InferenceIncorporationPhase incorporationPhase) { if (inferenceBound == InferenceBound.EQ && PsiUtil.resolveClassInClassTypeOnly(classType) == this) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java index 9177da7586f5..999ebc15807c 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java @@ -69,12 +69,12 @@ public class StrictSubtypingConstraint implements ConstraintFormula { InferenceVariable inferenceVariable = session.getInferenceVariable(myS); if (inferenceVariable != null) { - inferenceVariable.addBound(myT, InferenceBound.UPPER, session.myIncorporationPhase); + InferenceVariable.addBound(myS, myT, InferenceBound.UPPER, session); return true; } inferenceVariable = session.getInferenceVariable(myT); if (inferenceVariable != null) { - inferenceVariable.addBound(myS, InferenceBound.LOWER, session.myIncorporationPhase); + InferenceVariable.addBound(myT, myS, InferenceBound.LOWER, session); return true; } if (myT instanceof PsiArrayType) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java index 3f4d7dd75fe8..28aaa8670bd4 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java @@ -85,12 +85,12 @@ public class TypeEqualityConstraint implements ConstraintFormula { InferenceVariable inferenceVariable = session.getInferenceVariable(myS); if (inferenceVariable != null && !(myT instanceof PsiPrimitiveType)) { - inferenceVariable.addBound(myT, InferenceBound.EQ, session.myIncorporationPhase); + InferenceVariable.addBound(myS, myT, InferenceBound.EQ, session); return true; } inferenceVariable = session.getInferenceVariable(myT); if (inferenceVariable != null && !(myS instanceof PsiPrimitiveType)) { - inferenceVariable.addBound(myS, InferenceBound.EQ, session.myIncorporationPhase); + InferenceVariable.addBound(myT, myS, InferenceBound.EQ, session); return true; } if (myT instanceof PsiClassType && myS instanceof PsiClassType) { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/ExternalJavadocUrlsTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/ExternalJavadocUrlsTest.java index b868ae82e52f..b99e31d77055 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/ExternalJavadocUrlsTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/ExternalJavadocUrlsTest.java @@ -63,9 +63,7 @@ public class ExternalJavadocUrlsTest extends LightCodeInsightFixtureTestCase { assertNotNull(member); List urls = JavaDocumentationProvider.getExternalJavaDocUrl(member); assertNotNull(urls); - List actual = ContainerUtil.map(urls, url -> { - return url.substring(url.indexOf('#') + 1); - }); + List actual = ContainerUtil.map(urls, url -> url.substring(url.indexOf('#') + 1)); assertOrderedEquals(actual, expected); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEquals15Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEquals15Test.java index 384ff7148be4..8ea66c9fe7a2 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEquals15Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEquals15Test.java @@ -13,9 +13,7 @@ public class GenerateEquals15Test extends GenerateEqualsTestCase { } public void testDifferentTypes() throws Exception { - doTest(Function.ID, Function.ID, fields -> { - return new PsiField[0]; - }, true + doTest(Function.ID, Function.ID, fields -> new PsiField[0], true ); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEqualsTestCase.java b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEqualsTestCase.java index dab8c22abc89..5e8306a024d3 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEqualsTestCase.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateEqualsTestCase.java @@ -21,13 +21,7 @@ public abstract class GenerateEqualsTestCase extends LightCodeInsightTestCase { final int[] hashCode, final int[] nonNull, boolean insertOverride) throws Exception { - doTest(fields -> { - return getIndexed(fields, equals); - }, fields -> { - return getIndexed(fields, hashCode); - }, fields -> { - return getIndexed(fields, nonNull); - }, insertOverride); + doTest(fields -> getIndexed(fields, equals), fields -> getIndexed(fields, hashCode), fields -> getIndexed(fields, nonNull), insertOverride); } protected void doTest(Function eqFunction, diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateSuperMethodCallTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateSuperMethodCallTest.java index 6f2322d1ca92..d81072f6089f 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateSuperMethodCallTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateSuperMethodCallTest.java @@ -59,9 +59,7 @@ public class GenerateSuperMethodCallTest extends LightCodeInsightTestCase { return super.getHandler(); } }.getHandler(); - ApplicationManager.getApplication().runWriteAction(() -> { - handler.invoke(getProject(), getEditor(), getFile()); - }); + ApplicationManager.getApplication().runWriteAction(() -> handler.invoke(getProject(), getEditor(), getFile())); checkResultByFile(after); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/HighlightStressTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/HighlightStressTest.java index 9b1630f4afeb..07078dc5868c 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/HighlightStressTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/HighlightStressTest.java @@ -239,9 +239,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase { if (v>100) break; } final String text = imports + "\n class X {{\n" + usages + "}}"; - WriteCommandAction.runWriteCommandAction(null, () -> { - getEditor().getDocument().setText(text); - }); + WriteCommandAction.runWriteCommandAction(null, () -> getEditor().getDocument().setText(text)); List errors = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING); assertEmpty(errors); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java index 8257d8f0d561..207f24282768 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java @@ -48,9 +48,7 @@ public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase { assertEquals(0, collection.size()); final int offset = myEditor.getCaretModel().getOffset(); - WriteCommandAction.runWriteCommandAction(null, () -> { - document.insertString(offset, "//"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(offset, "//")); PsiDocumentManager.getInstance(getProject()).commitDocument(document); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java index a83e8b2e00d6..37b2edc59ff7 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java @@ -578,9 +578,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { tool.visited.clear(); Document otherDocument = PsiDocumentManager.getInstance(getProject()).getDocument(otherFile); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - otherDocument.setText("zzz"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> otherDocument.setText("zzz")); infos = doHighlighting(HighlightSeverity.WARNING); assertEmpty(infos); @@ -889,9 +887,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { assertEquals("Delete catch for 'java.io.IOException'", fix.getText()); final IntentionAction finalFix = fix; - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - finalFix.invoke(getProject(), getEditor(), getFile()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> finalFix.invoke(getProject(), getEditor(), getFile())); errors = highlightErrors(); assertEquals(2, errors.size()); @@ -902,9 +898,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { assertEquals("Delete catch for 'java.io.IOException'", fix.getText()); final IntentionAction finalFix1 = fix; - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - finalFix1.invoke(getProject(), getEditor(), getFile()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> finalFix1.invoke(getProject(), getEditor(), getFile())); errors = highlightErrors(); assertOneElement(errors); @@ -915,9 +909,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { assertEquals("Delete catch for 'java.io.IOException'", fix.getText()); final IntentionAction finalFix2 = fix; - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - finalFix2.invoke(getProject(), getEditor(), getFile()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> finalFix2.invoke(getProject(), getEditor(), getFile())); errors = highlightErrors(); assertEmpty(errors); @@ -1243,9 +1235,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { assertOneElement(warns); List actions = ShowIntentionsPass.getAvailableActions(getEditor(), getFile(), -1); final HighlightInfo.IntentionActionDescriptor descriptor = assertOneElement(actions); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - descriptor.getAction().invoke(getProject(), getEditor(), getFile()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> descriptor.getAction().invoke(getProject(), getEditor(), getFile())); highlightErrors(); actions = ShowIntentionsPass.getAvailableActions(getEditor(), getFile(), -1); @@ -1494,17 +1484,13 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { private void paste() { EditorActionManager actionManager = EditorActionManager.getInstance(); final EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_PASTE); - WriteCommandAction.runWriteCommandAction(null, () -> { - actionHandler.execute(getEditor(), null, DataManager.getInstance().getDataContext()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> actionHandler.execute(getEditor(), null, DataManager.getInstance().getDataContext())); } private void copy() { EditorActionManager actionManager = EditorActionManager.getInstance(); final EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_COPY); - WriteCommandAction.runWriteCommandAction(null, () -> { - actionHandler.execute(getEditor(), null, DataManager.getInstance().getDataContext()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> actionHandler.execute(getEditor(), null, DataManager.getInstance().getDataContext())); } public void testReactivityPerformance() throws Throwable { @@ -1713,9 +1699,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { Editor xEditor = createEditor(x.getVirtualFile()); List xInfos = filter(CodeInsightTestFixtureImpl.instantiateAndRun(x, xEditor, new int[0], false), HighlightSeverity.WARNING); - HighlightInfo info = ContainerUtil.find(xInfos, xInfo -> { - return xInfo.getDescription().equals("Method 'ffffffffffffff()' is never used"); - }); + HighlightInfo info = ContainerUtil.find(xInfos, xInfo -> xInfo.getDescription().equals("Method 'ffffffffffffff()' is never used")); assertNull(xInfos.toString(), info); Editor useEditor = myEditor; @@ -1727,9 +1711,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); xInfos = filter(CodeInsightTestFixtureImpl.instantiateAndRun(x, xEditor, new int[0], false), HighlightSeverity.WARNING); - info = ContainerUtil.find(xInfos, xInfo -> { - return xInfo.getDescription().equals("Method 'ffffffffffffff()' is never used"); - }); + info = ContainerUtil.find(xInfos, xInfo -> xInfo.getDescription().equals("Method 'ffffffffffffff()' is never used")); assertNotNull(xInfos.toString(), info); } @@ -2071,9 +2053,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { TextRange scope = me.getFileDirtyScope(getEditor().getDocument(), Pass.UPDATE_ALL); assertNull(scope); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - ((PsiJavaFile)excluded).getClasses()[0].getMethods()[0].delete(); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> ((PsiJavaFile)excluded).getClasses()[0].getMethods()[0].delete()); UIUtil.dispatchAllInvocationEvents(); scope = me.getFileDirtyScope(getEditor().getDocument(), Pass.UPDATE_ALL); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java index f39d316b5bd1..93cf74193d38 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java @@ -100,9 +100,7 @@ public class JavaGotoSuperTest extends LightDaemonAnalyzerTestCase { } private static LineMarkerInfo findMarkerWithElement(List markers, PsiElement psiMethod) { - LineMarkerInfo marker = ContainerUtil.find(markers, info -> { - return info.getElement().equals(psiMethod); - }); + LineMarkerInfo marker = ContainerUtil.find(markers, info -> info.getElement().equals(psiMethod)); assertNotNull(markers.toString(), marker); return marker; } @@ -127,9 +125,7 @@ public class JavaGotoSuperTest extends LightDaemonAnalyzerTestCase { doHighlighting(); Document document = getEditor().getDocument(); List markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, getProject()); - List inMyClass = ContainerUtil.filter(markers, info -> { - return OCBaseLanguageFileType.getTextRange().containsRange(info.startOffset, info.endOffset); - }); + List inMyClass = ContainerUtil.filter(markers, info -> OCBaseLanguageFileType.getTextRange().containsRange(info.startOffset, info.endOffset)); assertTrue(inMyClass.toString(), inMyClass.size() == 2); LineMarkerInfo iMarker = findMarkerWithElement(inMyClass, getName.getNameIdentifier()); assertSame(MarkerType.OVERRIDING_METHOD.getNavigationHandler(), iMarker.getNavigationHandler()); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/I18nizeTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/I18nizeTest.java index 1972624b2a71..594387f39873 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/I18nizeTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/I18nizeTest.java @@ -62,11 +62,9 @@ public class I18nizeTest extends LightCodeInsightTestCase { if (afterFileExists) { PsiLiteralExpression literalExpression = I18nizeAction.getEnclosingStringLiteral(getFile(), getEditor()); assertNotNull(handler); - ApplicationManager.getApplication().runWriteAction(() -> { - handler.performI18nization(getFile(), getEditor(), literalExpression, Collections.emptyList(), "key1", "value1", - "i18nizedExpr", - PsiExpression.EMPTY_ARRAY, JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER); - }); + ApplicationManager.getApplication().runWriteAction(() -> handler.performI18nization(getFile(), getEditor(), literalExpression, Collections.emptyList(), "key1", "value1", + "i18nizedExpr", + PsiExpression.EMPTY_ARRAY, JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER)); checkResultByFile(afterFile); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/OrderEntryTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/OrderEntryTest.java index 2deb7970004a..d2b1dbc31612 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/OrderEntryTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/OrderEntryTest.java @@ -91,9 +91,7 @@ public class OrderEntryTest extends DaemonAnalyzerTestCase { if (!actionShouldBeAvailable) { fail("Action '" + text + "' is available in test " + testFullPath); } - WriteCommandAction.runWriteCommandAction(null, () -> { - action.invoke(getProject(), getEditor(), getFile()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> action.invoke(getProject(), getEditor(), getFile())); Collection infosAfter = highlightErrors(); final IntentionAction afterAction = findActionWithText(text, infosAfter); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java index eed7a54f5991..56ab4c5182ba 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java @@ -217,9 +217,7 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase { PsiElement[] elements = item.getElementsToSurround(getFile(), selectionModel.getSelectionStart(), selectionModel.getSelectionEnd()); assertTrue(surrounder.isApplicable(elements)); - ApplicationManager.getApplication().runWriteAction(() -> { - SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder); - }); + ApplicationManager.getApplication().runWriteAction(() -> SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder)); checkResultByFile(BASE_PATH + fileName + "_after.java"); } @@ -227,9 +225,7 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase { private void doTestWithTemplateFinish(@NotNull String fileName, Surrounder surrounder, @Nullable String textToType) { TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable()); configureByFile(BASE_PATH + fileName + ".java"); - ApplicationManager.getApplication().runWriteAction(() -> { - SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder); - }); + ApplicationManager.getApplication().runWriteAction(() -> SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder)); if (textToType != null) { type(textToType); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/indentOptionsProvider/FileIndentProviderTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/indentOptionsProvider/FileIndentProviderTest.java index 04f97ee5b2b8..e038cadb1d30 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/indentOptionsProvider/FileIndentProviderTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/indentOptionsProvider/FileIndentProviderTest.java @@ -138,9 +138,7 @@ public class FileIndentProviderTest extends LightPlatformCodeInsightFixtureTestC myTestIndentOptions.TAB_SIZE = 2; myTestIndentOptions.USE_TAB_CHARACTER = true; PsiFile file = myFixture.configureByFile(getTestName(true) + "_before.java"); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - CodeStyleManager.getInstance(getProject()).reformatText(file, 0, file.getTextRange().getEndOffset()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeStyleManager.getInstance(getProject()).reformatText(file, 0, file.getTextRange().getEndOffset())); myFixture.checkResultByFile(getTestName(true) + "_after.java"); } @@ -153,9 +151,7 @@ public class FileIndentProviderTest extends LightPlatformCodeInsightFixtureTestC myTestIndentOptions.USE_TAB_CHARACTER = true; PsiFile file = myFixture.configureByFile(getTestName(true) + "_before.java"); // Just any range smaller than the file - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - CodeStyleManager.getInstance(getProject()).reformatText(file, 6, file.getTextRange().getEndOffset() - 1); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeStyleManager.getInstance(getProject()).reformatText(file, 6, file.getTextRange().getEndOffset() - 1)); myFixture.checkResultByFile(getTestName(true) + "_after.java"); } @@ -165,9 +161,7 @@ public class FileIndentProviderTest extends LightPlatformCodeInsightFixtureTestC myTestIndentOptions.TAB_SIZE = 2; myTestIndentOptions.USE_TAB_CHARACTER = true; PsiFile file = myFixture.configureByFile(getTestName(true) + "_before.java"); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - CodeStyleManager.getInstance(getProject()).reformatText(file, 0, file.getTextRange().getEndOffset()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeStyleManager.getInstance(getProject()).reformatText(file, 0, file.getTextRange().getEndOffset())); myFixture.checkResultByFile(getTestName(true) + "_after.java"); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitIfActionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitIfActionTest.java index 8e38e0a20538..b2bbf5595ae4 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitIfActionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitIfActionTest.java @@ -77,8 +77,6 @@ public class SplitIfActionTest extends LightCodeInsightTestCase { private void perform() throws Exception { SplitIfAction action = new SplitIfAction(); assertTrue(action.isAvailable(getProject(), getEditor(), getFile())); - ApplicationManager.getApplication().runWriteAction(() -> { - action.invoke(getProject(), getEditor(), getFile()); - }); + ApplicationManager.getApplication().runWriteAction(() -> action.invoke(getProject(), getEditor(), getFile())); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java index dca6d4ccd5dc..7dc98e6f2636 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java @@ -77,9 +77,7 @@ public class RunLineMarkerTest extends LightCodeInsightFixtureTestCase { GutterIconsConfigurable configurable = new GutterIconsConfigurable(); configurable.createComponent(); List descriptors = configurable.getDescriptors(); - Set strings = ContainerUtil.map2Set(descriptors, descriptor -> { - return descriptor.getId(); - }); + Set strings = ContainerUtil.map2Set(descriptors, descriptor -> descriptor.getId()); assertEquals(descriptors.size(), strings.size()); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/psi/ControlFlowTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/psi/ControlFlowTest.java index 4bc2ab2c16f1..3d0a32e93fef 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/psi/ControlFlowTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/psi/ControlFlowTest.java @@ -76,9 +76,7 @@ public class ControlFlowTest extends LightCodeInsightTestCase { private static void doAllTests() throws Exception { final String testDirPath = PathManagerEx.getTestDataPath().replace(File.separatorChar, '/') + BASE_PATH; File testDir = new File(testDirPath); - final File[] files = testDir.listFiles((dir, name) -> { - return name.endsWith(".java"); - }); + final File[] files = testDir.listFiles((dir, name) -> name.endsWith(".java")); for (int i = 0; i < files.length; i++) { File file = files[i]; doTestFor(file); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/TemplateBuilderTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/TemplateBuilderTest.java index 70f68e8baf95..9ef51d50fd4b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/template/TemplateBuilderTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/TemplateBuilderTest.java @@ -11,9 +11,7 @@ public class TemplateBuilderTest extends LightCodeInsightFixtureTestCase { " public String test() {\n" + " }\n" + "}"); - WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> { - TemplateBuilderFactory.getInstance().createTemplateBuilder(myFixture.getElementAtCaret()).run(myFixture.getEditor(), true); - }); + WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> TemplateBuilderFactory.getInstance().createTemplateBuilder(myFixture.getElementAtCaret()).run(myFixture.getEditor(), true)); myFixture.checkResult("class A {\n" + " public String test() {\n" + " }\n" + diff --git a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java index deba8240f325..facbd64f4136 100644 --- a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java +++ b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java @@ -910,17 +910,15 @@ public class FindManagerTest extends DaemonAnalyzerTestCase { final Ref result = new Ref<>(); final CountDownLatch progressStarted = new CountDownLatch(1); final ProgressIndicatorBase progressIndicatorBase = new ProgressIndicatorBase(); - final Thread thread = new Thread(() -> { - ProgressManager.getInstance().runProcess(() -> { - try { - progressStarted.countDown(); - result.set(myFindManager.findString(text, 0, findModel, new LightVirtualFile("foo.java"))); - } - catch (ProcessCanceledException ex) { - result.set(new FindResultImpl()); - } - }, progressIndicatorBase); - }, "runAsyncTest"); + final Thread thread = new Thread(() -> ProgressManager.getInstance().runProcess(() -> { + try { + progressStarted.countDown(); + result.set(myFindManager.findString(text, 0, findModel, new LightVirtualFile("foo.java"))); + } + catch (ProcessCanceledException ex) { + result.set(new FindResultImpl()); + } + }, progressIndicatorBase), "runAsyncTest"); thread.start(); progressStarted.await(); diff --git a/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingProcessingOnDocumentModificationTest.java b/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingProcessingOnDocumentModificationTest.java index 04126192f4bb..cfe3f4d81a9a 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingProcessingOnDocumentModificationTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingProcessingOnDocumentModificationTest.java @@ -92,9 +92,7 @@ public class FoldingProcessingOnDocumentModificationTest extends AbstractEditorT checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{...}']"); WriteCommandAction.runWriteCommandAction(getProject(), - () -> { - myEditor.getDocument().deleteString(0, 2); - }); + () -> myEditor.getDocument().deleteString(0, 2)); checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']"); } diff --git a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java index d69974a7c49b..cb5340a1d133 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java @@ -314,15 +314,11 @@ public class DirectoryIndexTest extends IdeaTestCase { final String list = fileTypeManager.getIgnoredFilesList(); final String list1 = list + ";" + "newDir"; try { - ApplicationManager.getApplication().runWriteAction(() -> { - fileTypeManager.setIgnoredFilesList(list1); - }); + ApplicationManager.getApplication().runWriteAction(() -> fileTypeManager.setIgnoredFilesList(list1)); assertNotInProject(newDir); } finally { - ApplicationManager.getApplication().runWriteAction(() -> { - fileTypeManager.setIgnoredFilesList(list); - }); + ApplicationManager.getApplication().runWriteAction(() -> fileTypeManager.setIgnoredFilesList(list)); assertInProject(newDir); } } @@ -429,9 +425,7 @@ public class DirectoryIndexTest extends IdeaTestCase { } private void fireRootsChanged() { - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true)); } private static OrderEntry[] toArray(Collection orderEntries) { diff --git a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/ProjectLibrariesTest.java b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/ProjectLibrariesTest.java index 4511ea0a995b..0be50d5e569a 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/ProjectLibrariesTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/ProjectLibrariesTest.java @@ -84,9 +84,7 @@ public class ProjectLibrariesTest extends IdeaTestCase { assertTrue(Arrays.asList(moduleModel.orderEntries().librariesOnly().classes().getRoots()).contains(myRoot)); } finally { - ApplicationManager.getApplication().runWriteAction(() -> { - moduleModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> moduleModel.commit()); } assertNotNull(getJavaFacade().findClass("pack.MyClass", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myModule))); diff --git a/java/java-tests/testSrc/com/intellij/projectView/ProjectViewUpdatingTest.java b/java/java-tests/testSrc/com/intellij/projectView/ProjectViewUpdatingTest.java index fc7c41bd45a1..4c9eace23b29 100644 --- a/java/java-tests/testSrc/com/intellij/projectView/ProjectViewUpdatingTest.java +++ b/java/java-tests/testSrc/com/intellij/projectView/ProjectViewUpdatingTest.java @@ -68,9 +68,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase { final PsiClass[] classes = JavaDirectoryService.getInstance() .getPackage(getContentDirectory().findSubdirectory("src").findSubdirectory("com").findSubdirectory("package1")).getClasses(); sortClassesByName(classes); - WriteCommandAction.runWriteCommandAction(null, () -> { - classes[0].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> classes[0].delete()); PlatformTestUtil.waitForAlarm(600); @@ -199,12 +197,10 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase { final Document document = FileDocumentManager.getInstance().getDocument(containingFile.getVirtualFile()); final int caretPosition = document.getText().indexOf("public class InnerClass") - 1; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(myProject, - () -> document.insertString(caretPosition, "\n"), - "typing", - null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myProject, + () -> document.insertString(caretPosition, "\n"), + "typing", + null)); PsiDocumentManager.getInstance(myProject).commitDocument(document); diff --git a/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java b/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java index 4fe7dad7b6b0..86b7974a29cb 100644 --- a/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java @@ -94,9 +94,7 @@ public class ArrayIndexOutOfBoundsTest extends PsiTestCase { Runnable runnable = () -> { final PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage("anotherBla"); assertNotNull("Package anotherBla not found", aPackage); - WriteCommandAction.runWriteCommandAction(null, () -> { - aPackage.getDirectories()[0].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> aPackage.getDirectories()[0].delete()); VirtualFileManager.getInstance().syncRefresh(); }; CommandProcessor.getInstance().executeCommand(myProject, runnable, "", null); diff --git a/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java b/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java index 3f8aeb9324d1..76b6531f89e1 100644 --- a/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java @@ -62,9 +62,7 @@ public class CodeFragmentsTest extends PsiTestCase{ VirtualFile file = fragment.getViewProvider().getVirtualFile(); assertInstanceOf(file, LightVirtualFile.class); - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true)); assertSame(fragment, PsiManager.getInstance(myProject).findFile(file)); diff --git a/java/java-tests/testSrc/com/intellij/psi/LibraryOrderTest.java b/java/java-tests/testSrc/com/intellij/psi/LibraryOrderTest.java index ade6a706f905..df1c97de165e 100644 --- a/java/java-tests/testSrc/com/intellij/psi/LibraryOrderTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/LibraryOrderTest.java @@ -50,9 +50,7 @@ public class LibraryOrderTest extends PsiTestCase { order[length - 2] = lib2; rootModel.rearrangeOrderEntries(order); - ApplicationManager.getApplication().runWriteAction(() -> { - rootModel.commit(); - } + ApplicationManager.getApplication().runWriteAction(() -> rootModel.commit() ); checkClassFromLib("test.A", "2"); diff --git a/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java b/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java index 0d432fb0d736..6b4cb4fb04a2 100644 --- a/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java @@ -128,9 +128,7 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase { final PsiClass aClass = getJavaFacade().getElementFactory().createClassFromText("public int i, j;", null); final PsiField aField = aClass.getFields()[0]; - WriteCommandAction.runWriteCommandAction(null, () -> { - aField.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> aField.delete()); assertEquals("public int j;", aClass.getFields()[0].getText()); } @@ -183,9 +181,7 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase { public void testDeleteAnnotationAttribute() throws Exception { final PsiAnnotation annotation = getJavaFacade().getElementFactory().createAnnotationFromText("@A(b,c)", null); final PsiNameValuePair secondAttribute = annotation.getParameterList().getAttributes()[1]; - ApplicationManager.getApplication().runWriteAction(() -> { - secondAttribute.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> secondAttribute.delete()); assertEquals("@A(b )", annotation.getText()); } @@ -195,9 +191,7 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase { final PsiNameValuePair firstAttribute = annotation.getParameterList().getAttributes()[0]; assertTrue(firstAttribute.getValue() instanceof PsiArrayInitializerMemberValue); final PsiAnnotationMemberValue firstInitializer = ((PsiArrayInitializerMemberValue)firstAttribute.getValue()).getInitializers()[0]; - ApplicationManager.getApplication().runWriteAction(() -> { - firstInitializer.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> firstInitializer.delete()); assertEquals("@A({ c})", annotation.getText()); } diff --git a/java/java-tests/testSrc/com/intellij/psi/NormalizeDeclarationTest.java b/java/java-tests/testSrc/com/intellij/psi/NormalizeDeclarationTest.java index 94208c070b28..e4408578d1b2 100644 --- a/java/java-tests/testSrc/com/intellij/psi/NormalizeDeclarationTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/NormalizeDeclarationTest.java @@ -43,15 +43,11 @@ public class NormalizeDeclarationTest extends PsiTestCase{ assertTrue(element instanceof PsiIdentifier); assertTrue(element.getParent() instanceof PsiVariable); - ApplicationManager.getApplication().runWriteAction(() -> { - ((PsiVariable)element.getParent()).normalizeDeclaration(); - }); + ApplicationManager.getApplication().runWriteAction(() -> ((PsiVariable)element.getParent()).normalizeDeclaration()); String textAfter = loadFile(getTestName(false) + "_after.java"); - ApplicationManager.getApplication().runWriteAction(() -> { - PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); - }); + ApplicationManager.getApplication().runWriteAction(() -> PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting()); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); diff --git a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java index 94d71a667e7a..308264e653ad 100644 --- a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java @@ -137,9 +137,7 @@ public class PsiConcurrencyStressTest extends DaemonAnalyzerTestCase { mark("-"); final PsiMethod[] psiMethods = getPsiClass().getMethods(); if (psiMethods.length > 0) { - WriteCommandAction.runWriteCommandAction(null, () -> { - psiMethods[random.nextInt(psiMethods.length)].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> psiMethods[random.nextInt(psiMethods.length)].delete()); } break; } diff --git a/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java b/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java index 0eb5e71d0f59..0249fd186577 100644 --- a/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/PsiModificationTrackerTest.java @@ -160,9 +160,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase { PsiModificationTracker modificationTracker = PsiManager.getInstance(getProject()).getModificationTracker(); long count = modificationTracker.getJavaStructureModificationCount(); - ApplicationManager.getApplication().runWriteAction(() -> { - file.getContainingDirectory().delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> file.getContainingDirectory().delete()); assertTrue(count+":"+modificationTracker.getJavaStructureModificationCount(), modificationTracker.getJavaStructureModificationCount() > count); } @@ -177,9 +175,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase { long count1 = tracker.getJavaStructureModificationCount(); PsiJavaFile psiFile = (PsiJavaFile)psiManager.findFile(file); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "class Foo {}"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "class Foo {}")); assertEquals(count1, tracker.getJavaStructureModificationCount()); // no PSI changes yet @@ -213,9 +209,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase { PlatformTestUtil.tryGcSoftlyReachableObjects(); assertNull(PsiDocumentManager.getInstance(getProject()).getCachedPsiFile(document)); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "class Foo {}"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "class Foo {}")); DocumentCommitThread.getInstance().waitForAllCommits(); assertFalse(count1 == tracker.getJavaStructureModificationCount()); @@ -240,9 +234,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase { long count1 = tracker.getJavaStructureModificationCount(); assertFalse(count1 == count0); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.deleteString(0, document.getTextLength()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.deleteString(0, document.getTextLength())); DocumentCommitThread.getInstance().waitForAllCommits(); // gc softly-referenced file and AST diff --git a/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java index 8c10148da186..3d0aab8f0542 100644 --- a/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java @@ -650,9 +650,7 @@ public class SrcRepositoryUseTest extends PsiTestCase{ public void testModification2() throws Exception { PsiClass aClass = myJavaFacade.findClass("pack.MyClass2", GlobalSearchScope.allScope(myProject)); - ApplicationManager.getApplication().runWriteAction(() -> { - PsiUtil.setModifierProperty(aClass, PsiModifier.FINAL, true); - }); + ApplicationManager.getApplication().runWriteAction(() -> PsiUtil.setModifierProperty(aClass, PsiModifier.FINAL, true)); PsiClass aClass2 = myJavaFacade.findClass("pack.MyClass2", GlobalSearchScope.allScope(myProject)); @@ -666,14 +664,10 @@ public class SrcRepositoryUseTest extends PsiTestCase{ BlockSupport blockSupport = ServiceManager.getService(myProject, BlockSupport.class); final PsiFile psiFile = aClass.getContainingFile(); - ApplicationManager.getApplication().runWriteAction(() -> { - blockSupport.reparseRange(psiFile, classRange.getStartOffset(), classRange.getEndOffset(), ""); - }); + ApplicationManager.getApplication().runWriteAction(() -> blockSupport.reparseRange(psiFile, classRange.getStartOffset(), classRange.getEndOffset(), "")); LOG.assertTrue(!aClass.isValid()); - ApplicationManager.getApplication().runWriteAction(() -> { - blockSupport.reparseRange(psiFile, classRange.getStartOffset(), classRange.getStartOffset(), text); - }); + ApplicationManager.getApplication().runWriteAction(() -> blockSupport.reparseRange(psiFile, classRange.getStartOffset(), classRange.getStartOffset(), text)); aClass = myJavaFacade.findClass("pack.MyInterface1", GlobalSearchScope.allScope(myProject)); diff --git a/java/java-tests/testSrc/com/intellij/psi/TreeIsCorrectAfterDiffReparseTest.java b/java/java-tests/testSrc/com/intellij/psi/TreeIsCorrectAfterDiffReparseTest.java index 0659375acabb..abda90afca2f 100644 --- a/java/java-tests/testSrc/com/intellij/psi/TreeIsCorrectAfterDiffReparseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/TreeIsCorrectAfterDiffReparseTest.java @@ -1101,9 +1101,7 @@ public class TreeIsCorrectAfterDiffReparseTest extends LightCodeInsightTestCase final PsiDocumentManager docManager = PsiDocumentManager.getInstance(ourProject); final Document doc = docManager.getDocument(myFile); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - doc.insertString(part1.length(), "/**"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.insertString(part1.length(), "/**")); boolean old = DebugUtil.CHECK; diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/DefaultProjectFormatterTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/DefaultProjectFormatterTest.java index 4c066146336b..2fd35c23ed72 100644 --- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/DefaultProjectFormatterTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/DefaultProjectFormatterTest.java @@ -53,9 +53,7 @@ public class DefaultProjectFormatterTest extends JavaFormatterTestCase { throws IncorrectOperationException { final String fileName = "before." + getFileExtension(); final PsiFile file = createFileFromText(text, fileName, PsiFileFactory.getInstance(LightPlatformTestCase.getProject())); - CommandProcessor.getInstance().executeCommand(LightPlatformTestCase.getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { - performFormatting(file); - }), "", ""); + CommandProcessor.getInstance().executeCommand(LightPlatformTestCase.getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", ""); String fileText = file.getText(); TestCase.assertEquals(textAfter, fileText); } diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterInEditorTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterInEditorTest.java index 0b51b5e0fd22..1f75255ca160 100644 --- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterInEditorTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterInEditorTest.java @@ -169,9 +169,7 @@ public class JavaFormatterInEditorTest extends LightPlatformCodeInsightTestCase public void doTest(@NotNull String before, @NotNull String after) throws IOException { configureFromFileText(getTestName(false) + ".java", before); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - CodeStyleManager.getInstance(getProject()).reformatText(getFile(), 0, getEditor().getDocument().getTextLength()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeStyleManager.getInstance(getProject()).reformatText(getFile(), 0, getEditor().getDocument().getTextLength())); checkResultByText(after); } 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 0812eb4cc76f..798049756f97 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 @@ -696,15 +696,11 @@ public class PsiEventsTest extends PsiTestCase { this.newText = newText; original = getFile().getText(); Document document = PsiDocumentManager.getInstance(getProject()).getDocument(getFile()); - ApplicationManager.getApplication().runWriteAction(() -> { - document.setText(newText); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.setText(newText)); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); - ApplicationManager.getApplication().runWriteAction(() -> { - document.setText(original); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.setText(original)); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); } @@ -787,9 +783,7 @@ public class PsiEventsTest extends PsiTestCase { Document document = documentManager.getDocument(getFile()); assertTrue(documentManager.isCommitted(document)); - ApplicationManager.getApplication().runWriteAction(() -> { - document.setText(""); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.setText("")); documentManager.commitAllDocuments(); assertTrue(documentManager.isCommitted(document)); diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java index 35fa956d2fad..dd8ec4408c19 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java @@ -45,9 +45,7 @@ public class TempFileSystemTest extends LightPlatformCodeInsightFixtureTestCase }); PlatformTestCase.move(psiFile.getVirtualFile(), subdirectory.getVirtualFile()); assertTrue(psiFile.isValid()); - ApplicationManager.getApplication().runWriteAction(() -> { - psiFile.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> psiFile.delete()); assertFalse(psiFile.isValid()); } diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java index feaca3d2afa9..789066f498b0 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java @@ -96,9 +96,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { } private static void insertString(Document document, int offset, String s) { - ApplicationManager.getApplication().runWriteAction(() -> { - document.insertString(offset, s); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.insertString(offset, s)); } // This test is unfair. If pointer would be asked for getElement() between commits it'll never restore again anyway. @@ -211,9 +209,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { assertEquals(myFile.getFirstChild(), pointer.getElement()); Document document = myFile.getViewProvider().getDocument(); - ApplicationManager.getApplication().runWriteAction(() -> { - document.deleteString(0, document.getTextLength()); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.deleteString(0, document.getTextLength())); PlatformTestUtil.tryGcSoftlyReachableObjects(); @@ -546,9 +542,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { } assertNull(FileDocumentManager.getInstance().getCachedDocument(vfile)); assertEquals(pointer1.getRange(), range1); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - insertString(FileDocumentManager.getInstance().getDocument(vfile), 0, " "); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> insertString(FileDocumentManager.getInstance().getDocument(vfile), 0, " ")); assertEquals(range1.shiftRight(1), pointer1.getRange()); assertEquals(range2.shiftRight(1), pointer2.getRange()); } @@ -575,9 +569,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { final SmartPsiElementPointer fieldSetPointer = createPointer(fieldSet); final SmartPsiElementPointer selectPointer = createPointer(select); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - insertString(getEditor().getDocument(), getEditor().getCaretModel().getOffset(), ""); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> insertString(getEditor().getDocument(), getEditor().getCaretModel().getOffset(), "")); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); @@ -628,9 +620,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { PsiClass aClass = ((PsiJavaFile)file).getClasses()[0]; - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - insertString(getEditor().getDocument(), 0, "import java.util.Map;\n"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> insertString(getEditor().getDocument(), 0, "import java.util.Map;\n")); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); @@ -682,16 +672,14 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { final Document document = file.getViewProvider().getDocument(); assertNotNull(document); - ApplicationManager.getApplication().runWriteAction(() -> { - PlatformTestUtil.startPerformanceTest("smart pointer range update", 10000, () -> { - document.setText(StringUtil.repeat("foo foo \n", 50000)); - for (int i = 0; i < 10000; i++) { - document.insertString(i * 20 + 100, "x\n"); - assertFalse(PsiDocumentManager.getInstance(myProject).isCommitted(document)); - assertEquals(range, pointer.getRange()); - } - }).cpuBound().useLegacyScaling().assertTiming(); - }); + ApplicationManager.getApplication().runWriteAction(() -> PlatformTestUtil.startPerformanceTest("smart pointer range update", 10000, () -> { + document.setText(StringUtil.repeat("foo foo \n", 50000)); + for (int i = 0; i < 10000; i++) { + document.insertString(i * 20 + 100, "x\n"); + assertFalse(PsiDocumentManager.getInstance(myProject).isCommitted(document)); + assertEquals(range, pointer.getRange()); + } + }).cpuBound().useLegacyScaling().assertTiming()); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); assertEquals(range, pointer.getRange()); @@ -742,9 +730,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { assertNull(((SmartPointerEx) pointer2).getCachedElement()); TextRange range = file.getClasses()[1].getTextRange(); - ApplicationManager.getApplication().runWriteAction(() -> { - document.moveText(range.getStartOffset(), range.getEndOffset(), 0); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.moveText(range.getStartOffset(), range.getEndOffset(), 0)); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); @@ -772,10 +758,8 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { TextRange originalRange = method.getTextRange(); SmartPsiElementPointer pointer = createPointer(method); - ApplicationManager.getApplication().runWriteAction(() -> { - EditorModificationUtil.insertStringAtCaret(myEditor, " void m() {\n" + - " }\n"); - }); + ApplicationManager.getApplication().runWriteAction(() -> EditorModificationUtil.insertStringAtCaret(myEditor, " void m() {\n" + + " }\n")); PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument()); PsiElement element = pointer.getElement(); @@ -792,9 +776,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { PlatformTestUtil.tryGcSoftlyReachableObjects(); assertNull(((SmartPointerEx) pointer).getCachedElement()); - ApplicationManager.getApplication().runWriteAction(() -> { - file.getClasses()[1].delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> file.getClasses()[1].delete()); assertNotNull(pointer.getElement()); @@ -875,21 +857,19 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { List tags = ContainerUtil.newArrayList(PsiTreeUtil.findChildrenOfType(file.getDocument(), XmlTag.class)); List pointers = tags.stream().map(this::createPointer).collect(Collectors.toList()); Random random = new Random(); - ApplicationManager.getApplication().runWriteAction(() -> { - PlatformTestUtil.startPerformanceTest("smart pointer range update after PSI change", 21000, () -> { - for (int i = 0; i < tags.size(); i++) { - XmlTag tag = tags.get(i); - SmartPsiElementPointer pointer = pointers.get(i); - assertEquals(tag.getName().length(), TextRange.create(pointer.getRange()).getLength()); - assertEquals(tag.getName().length(), TextRange.create(pointer.getPsiRange()).getLength()); + ApplicationManager.getApplication().runWriteAction(() -> PlatformTestUtil.startPerformanceTest("smart pointer range update after PSI change", 21000, () -> { + for (int i = 0; i < tags.size(); i++) { + XmlTag tag = tags.get(i); + SmartPsiElementPointer pointer = pointers.get(i); + assertEquals(tag.getName().length(), TextRange.create(pointer.getRange()).getLength()); + assertEquals(tag.getName().length(), TextRange.create(pointer.getPsiRange()).getLength()); - tag.setName("bar" + random.nextInt(20)); - assertEquals(tag.getName().length(), TextRange.create(pointer.getRange()).getLength()); - assertEquals(tag.getName().length(), TextRange.create(pointer.getPsiRange()).getLength()); - } - PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting(); - }).cpuBound().useLegacyScaling().assertTiming(); - }); + tag.setName("bar" + random.nextInt(20)); + assertEquals(tag.getName().length(), TextRange.create(pointer.getRange()).getLength()); + assertEquals(tag.getName().length(), TextRange.create(pointer.getPsiRange()).getLength()); + } + PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting(); + }).cpuBound().useLegacyScaling().assertTiming()); } @NotNull diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/ExtendsBoundListTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/ExtendsBoundListTest.java index 01e599e40fb1..085cb36da537 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/ExtendsBoundListTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/ExtendsBoundListTest.java @@ -26,27 +26,21 @@ import com.intellij.testFramework.LightCodeInsightTestCase; public class ExtendsBoundListTest extends LightCodeInsightTestCase { public void testRemoveBoundFromFront() throws Exception { final PsiTypeParameter typeParameter = getTypeParameter(); - WriteCommandAction.runWriteCommandAction(null, () -> { - typeParameter.getExtendsList().getReferenceElements()[0].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> typeParameter.getExtendsList().getReferenceElements()[0].delete()); check(); } public void testRemoveBoundFromEnd() throws Exception { final PsiTypeParameter typeParameter = getTypeParameter(); - ApplicationManager.getApplication().runWriteAction(() -> { - typeParameter.getExtendsList().getReferenceElements()[1].delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> typeParameter.getExtendsList().getReferenceElements()[1].delete()); check(); } public void testRemoveBoundFromMiddle() throws Exception { final PsiTypeParameter typeParameter = getTypeParameter(); - ApplicationManager.getApplication().runWriteAction(() -> { - typeParameter.getExtendsList().getReferenceElements()[1].delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> typeParameter.getExtendsList().getReferenceElements()[1].delete()); check(); } diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/JavadocParamTagsTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/JavadocParamTagsTest.java index 0d33e7529c3f..a929496b24e5 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/JavadocParamTagsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/source/tree/java/JavadocParamTagsTest.java @@ -41,9 +41,7 @@ public class JavadocParamTagsTest extends LightIdeaTestCase { final PsiDocComment docComment = method.getDocComment(); assertNotNull(docComment); final PsiDocTag[] tags = docComment.getTags(); - WriteCommandAction.runWriteCommandAction(null, () -> { - tags[0].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> tags[0].delete()); assertEquals("/**\n" + " * Javadoc\n" + @@ -64,9 +62,7 @@ public class JavadocParamTagsTest extends LightIdeaTestCase { final PsiDocComment docComment = method.getDocComment(); assertNotNull(docComment); final PsiDocTag[] tags = docComment.getTags(); - ApplicationManager.getApplication().runWriteAction(() -> { - tags[1].delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> tags[1].delete()); assertEquals("/**\n" + " * Javadoc\n" + @@ -88,9 +84,7 @@ public class JavadocParamTagsTest extends LightIdeaTestCase { final PsiDocComment docComment = method.getDocComment(); assertNotNull(docComment); final PsiDocTag[] tags = docComment.getTags(); - ApplicationManager.getApplication().runWriteAction(() -> { - tags[1].delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> tags[1].delete()); assertEquals("/**\n" + " * Javadoc\n" + diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolvePerformanceTest.java b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolvePerformanceTest.java index ef7b9e756670..b924ccc142e9 100644 --- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolvePerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolvePerformanceTest.java @@ -63,9 +63,7 @@ public class ResolvePerformanceTest extends ResolveTestCase { resolveAllReferences(references); System.out.println("Not cached resolve: " + (System.currentTimeMillis() - time)/(double)1000 + "s"); - ApplicationManager.getApplication().runWriteAction(() -> { - ResolveCache.getInstance(myProject).clearCache(true); - }); + ApplicationManager.getApplication().runWriteAction(() -> ResolveCache.getInstance(myProject).clearCache(true)); time = System.currentTimeMillis(); // Cached pass diff --git a/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java b/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java index a84ab4a188e2..a7b35003e2f0 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java @@ -264,10 +264,8 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest { public void testAlreadyHandled() { doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]), - method -> { - return new ThrownExceptionInfo[]{ - new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.lang.Exception", method.getResolveScope())) - }; + method -> new ThrownExceptionInfo[]{ + new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.lang.Exception", method.getResolveScope())) }, false ); @@ -275,10 +273,8 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest { public void testConstructorException() { doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]), - method -> { - return new ThrownExceptionInfo[]{ - new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.io.IOException", method.getResolveScope())) - }; + method -> new ThrownExceptionInfo[]{ + new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.io.IOException", method.getResolveScope())) }, false ); @@ -286,10 +282,8 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest { public void testAddRuntimeException() { doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]), - method -> { - return new ThrownExceptionInfo[]{ - new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.lang.RuntimeException", method.getResolveScope())) - }; + method -> new ThrownExceptionInfo[]{ + new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.lang.RuntimeException", method.getResolveScope())) }, false ); @@ -297,10 +291,8 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest { public void testAddException() { doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]), - method -> { - return new ThrownExceptionInfo[]{ - new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.lang.Exception", method.getResolveScope())) - }; + method -> new ThrownExceptionInfo[]{ + new JavaThrownExceptionInfo(-1, myFactory.createTypeByFQClassName("java.lang.Exception", method.getResolveScope())) }, false ); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java b/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java index 77a63b76191d..69c7cf6aa0ff 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java @@ -126,9 +126,7 @@ public class CopyClassTest extends CodeInsightTestCase { String rootAfter = root + "/after"; VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/')); - ApplicationManager.getApplication().runWriteAction(() -> { - myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting(); - }); + ApplicationManager.getApplication().runWriteAction(() -> myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting()); PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir); } diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java index 7a8c549adf4b..d75ee1bd2c6c 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java @@ -244,9 +244,7 @@ public class MoveMembersTest extends MultiFileTestCase { final String defaultVisibility, final int... memberIndices) throws Exception { - doTest((rootDir, rootAfter) -> { - MoveMembersTest.this.performAction(sourceClassName, targetClassName, memberIndices, defaultVisibility); - }, lowercaseFirstLetter); + doTest((rootDir, rootAfter) -> MoveMembersTest.this.performAction(sourceClassName, targetClassName, memberIndices, defaultVisibility), lowercaseFirstLetter); } private void performAction(String sourceClassName, String targetClassName, int[] memberIndices, final String visibility) throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java b/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java index 72e38d92cddd..f7e2c26abf74 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java @@ -316,9 +316,7 @@ public class SafeDeleteTest extends MultiFileTestCase { } private void doTest(@NonNls final String qClassName) throws Exception { - doTest((rootDir, rootAfter) -> { - SafeDeleteTest.this.performAction(qClassName); - }); + doTest((rootDir, rootAfter) -> SafeDeleteTest.this.performAction(qClassName)); } @Override diff --git a/java/java-tests/testSrc/com/intellij/refactoring/TurnRefsToSuperTest.java b/java/java-tests/testSrc/com/intellij/refactoring/TurnRefsToSuperTest.java index 017f5a7e1a72..989b8ecae29e 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/TurnRefsToSuperTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/TurnRefsToSuperTest.java @@ -67,9 +67,7 @@ public class TurnRefsToSuperTest extends MultiFileTestCase { //public void testForEach2() throws Exception { doTest("Test.MyIterableImpl", "Test.MyIterable", false); } private void doTest(@NonNls final String className, @NonNls final String superClassName, final boolean replaceInstanceOf) throws Exception { - doTest((rootDir, rootAfter) -> { - TurnRefsToSuperTest.this.performAction(className, superClassName, replaceInstanceOf); - }, true); + doTest((rootDir, rootAfter) -> TurnRefsToSuperTest.this.performAction(className, superClassName, replaceInstanceOf), true); } @NotNull diff --git a/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java b/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java index 0fda6821a4b5..ba50a937f485 100644 --- a/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java @@ -37,9 +37,7 @@ public class InheritedJdkTest extends ModuleTestCase { public void test1() throws Exception { final Sdk jdk = IdeaTestUtil.getMockJdk17("java 1.4"); - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(jdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(jdk)); final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule); ApplicationManager.getApplication().runWriteAction(() -> { @@ -57,9 +55,7 @@ public class InheritedJdkTest extends ModuleTestCase { assertNull("No JDK assigned", rootManager.getSdk()); final Sdk jdk1 = IdeaTestUtil.getMockJdk17("jjj"); - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(jdk1); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(jdk1)); ModuleRootModificationUtil.setModuleSdk(myModule, jdk1); assertFalse("JDK is not inherited after setJdk(jdk1)", rootManager.isSdkInherited()); @@ -74,21 +70,15 @@ public class InheritedJdkTest extends ModuleTestCase { assertNull("No JDK assigned", rootManager.getSdk()); final Sdk mockJdk = IdeaTestUtil.getMockJdk17("mock 1.4"); - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(mockJdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(mockJdk)); final ProjectRootManagerEx projectRootManager = ProjectRootManagerEx.getInstanceEx(myProject); - ApplicationManager.getApplication().runWriteAction(() -> { - projectRootManager.setProjectSdk(mockJdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> projectRootManager.setProjectSdk(mockJdk)); assertTrue(rootManager.isSdkInherited()); assertEquals("mockJdk inherited", mockJdk, rootManager.getSdk()); - ApplicationManager.getApplication().runWriteAction(() -> { - projectRootManager.setProjectSdkName("jdk1"); - }); + ApplicationManager.getApplication().runWriteAction(() -> projectRootManager.setProjectSdkName("jdk1")); assertTrue(rootManager.isSdkInherited()); Assert.assertEquals("Correct non-existing JDK inherited", "jdk1", @@ -101,9 +91,7 @@ public class InheritedJdkTest extends ModuleTestCase { assertNull("Non-existing JDK", rootManager.getSdk()); final Sdk jdk1 = IdeaTestUtil.getMockJdk17("jdk1"); - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(jdk1); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(jdk1)); assertTrue(rootManager.isSdkInherited()); assertNotNull("JDK appeared", rootManager.getSdk()); diff --git a/java/java-tests/testSrc/com/intellij/roots/ManagingContentRootsTest.java b/java/java-tests/testSrc/com/intellij/roots/ManagingContentRootsTest.java index 55eb753c07b2..26eb0fd6a271 100644 --- a/java/java-tests/testSrc/com/intellij/roots/ManagingContentRootsTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/ManagingContentRootsTest.java @@ -102,9 +102,7 @@ public class ManagingContentRootsTest extends IdeaTestCase { } private void addContentRoot(final String path) { - ApplicationManager.getApplication().runWriteAction(() -> { - ModuleRootModificationUtil.addContentRoot(getModule(), path); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModuleRootModificationUtil.addContentRoot(getModule(), path)); } private ModuleRootManager getRootManager() { diff --git a/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java b/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java index 5540a82eb475..4cb6f86dfd03 100644 --- a/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java @@ -118,9 +118,7 @@ public class MultiModuleEditingTest extends ModuleTestCase { final ContentEntry contentEntryB = rootModelB.addContentEntry(getVirtualFileInTestData("b")); contentEntryB.addSourceFolder(getVirtualFileInTestData("b/src"), false); - ApplicationManager.getApplication().runWriteAction(() -> { - ModifiableModelCommitter.multiCommit(new ModifiableRootModel[]{rootModelB, rootModelA}, moduleModel); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModifiableModelCommitter.multiCommit(new ModifiableRootModel[]{rootModelB, rootModelA}, moduleModel)); } final JavaPsiFacade psiManager = getJavaFacade(); @@ -152,9 +150,7 @@ public class MultiModuleEditingTest extends ModuleTestCase { final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel(); rootModelB.addModuleOrderEntry(moduleC); moduleModel.disposeModule(moduleC); - ApplicationManager.getApplication().runWriteAction(() -> { - ModifiableModelCommitter.multiCommit(new ModifiableRootModel[]{rootModelB}, moduleModel); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModifiableModelCommitter.multiCommit(new ModifiableRootModel[]{rootModelB}, moduleModel)); } final ModuleRootManager rootManagerB = ModuleRootManager.getInstance(moduleB); @@ -170,9 +166,7 @@ public class MultiModuleEditingTest extends ModuleTestCase { assertSame(moduleA, moduleManager.findModuleByName("a")); assertEquals("c", moduleModel.getNewName(moduleA)); assertSame(moduleA, moduleModel.getModuleToBeRenamed("c")); - ApplicationManager.getApplication().runWriteAction(() -> { - moduleModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> moduleModel.commit()); } assertEquals(1, rootManagerB.getDependencies().length); diff --git a/java/java-tests/testSrc/com/intellij/roots/libraries/LibraryTest.java b/java/java-tests/testSrc/com/intellij/roots/libraries/LibraryTest.java index bfd33325bedc..2a88f81c9350 100644 --- a/java/java-tests/testSrc/com/intellij/roots/libraries/LibraryTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/libraries/LibraryTest.java @@ -67,9 +67,7 @@ public class LibraryTest extends ModuleRootManagerTestCase { commit(model2); assertFalse(listenerNotifiedOnChange[0]); - ApplicationManager.getApplication().runWriteAction(() -> { - libraryTable.removeLibrary(library); - }); + ApplicationManager.getApplication().runWriteAction(() -> libraryTable.removeLibrary(library)); } public void testLibrarySerialization() { @@ -112,9 +110,7 @@ public class LibraryTest extends ModuleRootManagerTestCase { } private static void commit(LibraryTable.ModifiableModel model) { - ApplicationManager.getApplication().runWriteAction(() -> { - model.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> model.commit()); } public void testFindLibraryByNameAfterChainedRename() { diff --git a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java index de32aa4da4d3..854e65f002dd 100644 --- a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java @@ -232,9 +232,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase { FileUtil.copyDir(projectRoot, toDirIO); VirtualFile fromDir = getVirtualFile(projectRoot); editorInfos = - copyFilesFillingEditorInfos(fromDir, toDir, ContainerUtil.map2Array(reversed, String.class, s -> { - return s.getPath().substring(projectRoot.getPath().length()); - })); + copyFilesFillingEditorInfos(fromDir, toDir, ContainerUtil.map2Array(reversed, String.class, s -> s.getPath().substring(projectRoot.getPath().length()))); toDir.refresh(false, true); } diff --git a/java/testFramework/src/com/intellij/codeInsight/completion/CompletionTestCase.java b/java/testFramework/src/com/intellij/codeInsight/completion/CompletionTestCase.java index 32a922606dd4..afd621280d97 100644 --- a/java/testFramework/src/com/intellij/codeInsight/completion/CompletionTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/completion/CompletionTestCase.java @@ -114,9 +114,7 @@ public abstract class CompletionTestCase extends DaemonAnalyzerTestCase { protected void assertStringItems(String... strings) { assertNotNull(myItems); - List actual = ContainerUtil.map(myItems, element -> { - return element.getLookupString(); - }); + List actual = ContainerUtil.map(myItems, element -> element.getLookupString()); assertOrderedEquals(actual, strings); } } diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java index 9d685e9f0e50..698d0d6452d5 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java @@ -220,9 +220,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase final String testDirPath = testCase.getTestDataPath().replace(File.separatorChar, '/') + testCase.getBasePath(); File testDir = new File(testDirPath); - final File[] files = testDir.listFiles((dir, name) -> { - return name.startsWith(BEFORE_PREFIX); - }); + final File[] files = testDir.listFiles((dir, name) -> name.startsWith(BEFORE_PREFIX)); if (files == null || files.length == 0) { fail("Test files not found in " + testDirPath); diff --git a/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java b/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java index 6f064c3daaf3..75f317bb937d 100644 --- a/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java +++ b/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java @@ -153,9 +153,7 @@ public abstract class ProjectWizardTestCase ext Sdk projectSdk = ProjectRootManager.getInstance(getProject()).getProjectSdk(); for (final Sdk jdk : ProjectJdkTable.getInstance().getAllJdks()) { if (projectSdk != jdk) { - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().removeJdk(jdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().removeJdk(jdk)); } } } @@ -171,9 +169,7 @@ public abstract class ProjectWizardTestCase ext } protected void addSdk(final Sdk sdk) { - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(sdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(sdk)); mySdks.add(sdk); } @@ -186,9 +182,7 @@ public abstract class ProjectWizardTestCase ext } if (myCreatedProject != null) { myProjectManager.closeProject(myCreatedProject); - ApplicationManager.getApplication().runWriteAction(() -> { - Disposer.dispose(myCreatedProject); - }); + ApplicationManager.getApplication().runWriteAction(() -> Disposer.dispose(myCreatedProject)); myCreatedProject = null; } ApplicationManager.getApplication().runWriteAction(() -> { @@ -238,9 +232,7 @@ public abstract class ProjectWizardTestCase ext protected Sdk createSdk(String name, SdkTypeId sdkType) { final Sdk sdk = ProjectJdkTable.getInstance().createSdk(name, sdkType); - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(sdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(sdk)); mySdks.add(sdk); return sdk; } diff --git a/java/testFramework/src/com/intellij/refactoring/MultiFileTestCase.java b/java/testFramework/src/com/intellij/refactoring/MultiFileTestCase.java index 0fd9eed809b4..3660eb2d4942 100644 --- a/java/testFramework/src/com/intellij/refactoring/MultiFileTestCase.java +++ b/java/testFramework/src/com/intellij/refactoring/MultiFileTestCase.java @@ -56,9 +56,7 @@ public abstract class MultiFileTestCase extends CodeInsightTestCase { final VirtualFile rootAfter = LocalFileSystem.getInstance().findFileByPath(pathAfter.replace(File.separatorChar, '/')); performAction.performAction(rootDir, rootAfter); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting(); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting()); FileDocumentManager.getInstance().saveAllDocuments(); diff --git a/java/testFramework/src/com/intellij/testFramework/ResolveTestCase.java b/java/testFramework/src/com/intellij/testFramework/ResolveTestCase.java index 5615728f5d77..b3d3e10ebe9b 100644 --- a/java/testFramework/src/com/intellij/testFramework/ResolveTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/ResolveTestCase.java @@ -71,9 +71,7 @@ public abstract class ResolveTestCase extends PsiTestCase { myDocument = FileDocumentManager.getInstance().getDocument(existing); assertNotNull(myDocument); final String finalFileText = fileText; - ApplicationManager.getApplication().runWriteAction(() -> { - myDocument.setText(finalFileText); - }); + ApplicationManager.getApplication().runWriteAction(() -> myDocument.setText(finalFileText)); myFile = PsiManager.getInstance(getProject()).findFile(existing); assertNotNull(myFile); diff --git a/java/testFramework/src/com/intellij/testFramework/TestSourceBasedTestCase.java b/java/testFramework/src/com/intellij/testFramework/TestSourceBasedTestCase.java index ad863e54448f..c8bbbd1f2251 100644 --- a/java/testFramework/src/com/intellij/testFramework/TestSourceBasedTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/TestSourceBasedTestCase.java @@ -44,9 +44,7 @@ import java.io.File; FileUtil.copyDir(currentTestRoot, new File(myTempDirectory, getTestDirectoryName())); - ApplicationManager.getApplication().runWriteAction(() -> { - setupContentRoot(); - }); + ApplicationManager.getApplication().runWriteAction(() -> setupContentRoot()); ProjectViewTestUtil.setupImpl(getProject(), true); } diff --git a/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java index d11c907271f1..229e78c1e34c 100644 --- a/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java +++ b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java @@ -168,9 +168,7 @@ public abstract class TypeMigrationTestBase extends MultiFileTestCase { final UsageInfo[] usages = pr.findUsages(); final String report = pr.getLabeler().getMigrationReport(); - WriteCommandAction.runWriteCommandAction(null, () -> { - pr.performRefactoring(usages); - }); + WriteCommandAction.runWriteCommandAction(null, () -> pr.performRefactoring(usages)); String itemName = className + ".items"; diff --git a/json/src/com/intellij/json/structureView/JsonStructureViewElement.java b/json/src/com/intellij/json/structureView/JsonStructureViewElement.java index 8d42758840c5..df705efb5c4e 100644 --- a/json/src/com/intellij/json/structureView/JsonStructureViewElement.java +++ b/json/src/com/intellij/json/structureView/JsonStructureViewElement.java @@ -66,9 +66,7 @@ public class JsonStructureViewElement implements StructureViewTreeElement { } if (value instanceof JsonObject) { final JsonObject object = ((JsonObject)value); - return ContainerUtil.map2Array(object.getPropertyList(), TreeElement.class, (Function)property -> { - return new JsonStructureViewElement(property); - }); + return ContainerUtil.map2Array(object.getPropertyList(), TreeElement.class, (Function)property -> new JsonStructureViewElement(property)); } else if (value instanceof JsonArray) { final JsonArray array = (JsonArray)value; diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonBySchemaObjectAnnotator.java b/json/src/com/jetbrains/jsonSchema/impl/JsonBySchemaObjectAnnotator.java index 9564ab69c04a..2258f1130f2c 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonBySchemaObjectAnnotator.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonBySchemaObjectAnnotator.java @@ -251,9 +251,7 @@ class JsonBySchemaObjectAnnotator implements Annotator { for (Object object : objects) { if (object.toString().equalsIgnoreCase(text)) return true; } - error("Value should be one of: [" + StringUtil.join(objects, o -> { - return o.toString(); - }, ", ") + "]", value); + error("Value should be one of: [" + StringUtil.join(objects, o -> o.toString(), ", ") + "]", value); return false; } diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java index 23731a4816aa..789b30e2e89b 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java @@ -154,9 +154,7 @@ public class JsonSchemaServiceImpl implements JsonSchemaServiceEx { public List> getMatchingSchemaDescriptors(@Nullable VirtualFile file) { final List wrappers = getWrappers(file); if (wrappers == null || wrappers.isEmpty()) return null; - return ContainerUtil.map(wrappers, (NotNullFunction>)wrapper -> { - return Pair.create(wrapper.isUserSchema(), wrapper.getName()); - }); + return ContainerUtil.map(wrappers, (NotNullFunction>)wrapper -> Pair.create(wrapper.isUserSchema(), wrapper.getName())); } @Nullable diff --git a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaCrossReferencesTest.java b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaCrossReferencesTest.java index 3d0299d77121..6e0b0b9d8428 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaCrossReferencesTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaCrossReferencesTest.java @@ -217,9 +217,7 @@ public class JsonSchemaCrossReferencesTest extends CompletionTestCase { instance.addSchema(inherited); try { - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json")); int offset = myEditor.getCaretModel().getPrimaryCaret().getOffset(); final PsiReference referenceAt = myFile.findReferenceAt(offset); Assert.assertNotNull(referenceAt); @@ -227,9 +225,7 @@ public class JsonSchemaCrossReferencesTest extends CompletionTestCase { Assert.assertNotNull(resolve); Assert.assertEquals("\"baseEnum\"", resolve.getText()); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json")); } finally { container.unregisterComponent(key); container.registerComponentImplementation(key, JsonSchemaMappingsProjectConfiguration.class); @@ -266,9 +262,7 @@ public class JsonSchemaCrossReferencesTest extends CompletionTestCase { instance.addSchema(inherited); try { - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json")); int offset = myEditor.getCaretModel().getPrimaryCaret().getOffset(); final PsiReference referenceAt = myFile.findReferenceAt(offset); Assert.assertNotNull(referenceAt); @@ -276,9 +270,7 @@ public class JsonSchemaCrossReferencesTest extends CompletionTestCase { Assert.assertNotNull(resolve); Assert.assertEquals("\"enum\"", resolve.getText()); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json")); } finally { container.unregisterComponent(key); container.registerComponentImplementation(key, JsonSchemaMappingsProjectConfiguration.class); diff --git a/json/tests/test/com/jetbrains/jsonSchema/schemaFile/JsonSchemaFileResolveTest.java b/json/tests/test/com/jetbrains/jsonSchema/schemaFile/JsonSchemaFileResolveTest.java index 415c2588e635..8bfb6ae6f54a 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/schemaFile/JsonSchemaFileResolveTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/schemaFile/JsonSchemaFileResolveTest.java @@ -58,18 +58,14 @@ public class JsonSchemaFileResolveTest extends LightPlatformCodeInsightFixtureTe container.registerComponentImplementation(key, TestJsonSchemaMappingsProjectConfiguration.class); try { - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json")); PsiReference position = myFixture.getReferenceAtCaretPosition("localRefSchema.json"); Assert.assertNotNull(position); PsiElement resolve = position.resolve(); Assert.assertNotNull(resolve); Assert.assertEquals("\"baseEnum\"", resolve.getText()); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json")); } finally { container.unregisterComponent(key); container.registerComponentImplementation(key, JsonSchemaMappingsProjectConfiguration.class); @@ -83,18 +79,14 @@ public class JsonSchemaFileResolveTest extends LightPlatformCodeInsightFixtureTe container.registerComponentImplementation(key, TestJsonSchemaMappingsProjectConfiguration.class); try { - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json")); PsiReference position = myFixture.getReferenceAtCaretPosition("localRefSchema.json"); Assert.assertNotNull(position); PsiElement resolve = position.resolve(); Assert.assertNotNull(resolve); Assert.assertEquals("\"baseEnum\"", resolve.getText()); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json")); } finally { container.unregisterComponent(key); container.registerComponentImplementation(key, JsonSchemaMappingsProjectConfiguration.class); diff --git a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java index 3d1892d4d058..12c37ad1d1d6 100644 --- a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java +++ b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java @@ -486,9 +486,7 @@ public class AnalysisScope { return AnalysisScopeBundle.message("scope.option.module", pathToName(myModule.getModuleFilePath())); case MODULES: - String modules = StringUtil.join(myModules, module -> { - return pathToName(module.getModuleFilePath()); - }, ", "); + String modules = StringUtil.join(myModules, module -> pathToName(module.getModuleFilePath()), ", "); return AnalysisScopeBundle.message("scope.module.list", modules, Integer.valueOf(myModules.size())); @@ -517,9 +515,7 @@ public class AnalysisScope { return AnalysisScopeBundle.message("scope.option.module", myModule.getName()); case MODULES: - String modules = StringUtil.join(myModules, module -> { - return module.getName(); - }, ", "); + String modules = StringUtil.join(myModules, module -> module.getName(), ", "); return AnalysisScopeBundle.message("scope.module.list", modules, Integer.valueOf(myModules.size())); case PROJECT: diff --git a/platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionActionBean.java b/platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionActionBean.java index 1a32fbf13797..5f08b7cd1c62 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionActionBean.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionActionBean.java @@ -54,9 +54,7 @@ public class IntentionActionBean extends CustomLoadingExtensionPointBean { final String[] keys = categoryKey.split("/"); if (keys.length > 1) { - return ContainerUtil.map2Array(keys, String.class, s -> { - return CommonBundle.message(bundle, s); - }); + return ContainerUtil.map2Array(keys, String.class, s -> CommonBundle.message(bundle, s)); } category = CommonBundle.message(bundle, categoryKey); diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java index d604e648f5e8..eff520643483 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java @@ -135,9 +135,7 @@ public class InspectionProfileConvertor { return; } - File[] files = profileDirectory.listFiles(pathname -> { - return pathname.getPath().endsWith(File.separator + DEFAULT_XML); - }); + File[] files = profileDirectory.listFiles(pathname -> pathname.getPath().endsWith(File.separator + DEFAULT_XML)); if (files == null || files.length != 1 || !files[0].isFile()) { return; } diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java index d6dea6ccb833..de7f3d10c66d 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java @@ -824,9 +824,7 @@ public class HighlightInfo implements Segment { else { SuppressQuickFix[] suppressFixes = wrappedTool.getBatchSuppressActions(element); if (suppressFixes.length > 0) { - ContainerUtil.addAll(newOptions, ContainerUtil.map(suppressFixes, (Function)fix -> { - return SuppressIntentionActionFromFix.convertBatchToSuppressIntentionAction(fix); - })); + ContainerUtil.addAll(newOptions, ContainerUtil.map(suppressFixes, (Function)fix -> SuppressIntentionActionFromFix.convertBatchToSuppressIntentionAction(fix))); } } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/SuppressIntentionActionFromFix.java b/platform/analysis-impl/src/com/intellij/codeInspection/SuppressIntentionActionFromFix.java index cc842a98258c..5b8466e639bf 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/SuppressIntentionActionFromFix.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/SuppressIntentionActionFromFix.java @@ -38,9 +38,7 @@ public class SuppressIntentionActionFromFix extends SuppressIntentionAction { @NotNull public static SuppressIntentionAction[] convertBatchToSuppressIntentionActions(@NotNull SuppressQuickFix[] actions) { - return ContainerUtil.map2Array(actions, SuppressIntentionAction.class, fix -> { - return convertBatchToSuppressIntentionAction(fix); - }); + return ContainerUtil.map2Array(actions, SuppressIntentionAction.class, fix -> convertBatchToSuppressIntentionAction(fix)); } @Override diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java index 60abacf5f21c..68c6d02153cd 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java @@ -339,9 +339,7 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G return tools; } Set set = new THashSet(tools, TOOLS_HASHING_STRATEGY); - set.addAll(ContainerUtil.map(dependentTools, toolWrapper -> { - return new ToolsImpl(toolWrapper, toolWrapper.getDefaultLevel(), true, true); - })); + set.addAll(ContainerUtil.map(dependentTools, toolWrapper -> new ToolsImpl(toolWrapper, toolWrapper.getDefaultLevel(), true, true))); return new ArrayList(set); } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java index d03fcb4b2ebf..88c8cdbc843d 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java @@ -656,9 +656,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, @NotNull private List createTools(Project project) { if (mySource != null) { - return ContainerUtil.map(mySource.getDefaultStates(project), state -> { - return state.getTool(); - }); + return ContainerUtil.map(mySource.getDefaultStates(project), state -> state.getTool()); } return myRegistrar.createTools(); } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefDirectoryImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefDirectoryImpl.java index 31153603397a..d1de089a67c2 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefDirectoryImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefDirectoryImpl.java @@ -51,9 +51,7 @@ public class RefDirectoryImpl extends RefElementImpl implements RefDirectory{ @Override public void accept(@NotNull final RefVisitor visitor) { - ApplicationManager.getApplication().runReadAction(() -> { - visitor.visitDirectory(RefDirectoryImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> visitor.visitDirectory(RefDirectoryImpl.this)); } @Override diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java index 8add49ea872a..7b19f47ff6bc 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java @@ -106,9 +106,7 @@ abstract class RefEntityImpl implements RefEntity { @Override public void accept(@NotNull final RefVisitor refVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - refVisitor.visitElement(RefEntityImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> refVisitor.visitElement(RefEntityImpl.this)); } @Override diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefFileImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefFileImpl.java index 769d59e58fe4..f4d389b2ebff 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefFileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefFileImpl.java @@ -49,9 +49,7 @@ public class RefFileImpl extends RefElementImpl implements RefFile { @Override public void accept(@NotNull final RefVisitor visitor) { - ApplicationManager.getApplication().runReadAction(() -> { - visitor.visitFile(RefFileImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> visitor.visitFile(RefFileImpl.this)); } @Override diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefModuleImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefModuleImpl.java index 0b168f2458b6..9754a419e9b5 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefModuleImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefModuleImpl.java @@ -59,9 +59,7 @@ class RefModuleImpl extends RefEntityImpl implements RefModule { @Override public void accept(@NotNull final RefVisitor refVisitor) { - ApplicationManager.getApplication().runReadAction(() -> { - refVisitor.visitModule(RefModuleImpl.this); - }); + ApplicationManager.getApplication().runReadAction(() -> refVisitor.visitModule(RefModuleImpl.this)); } @Override diff --git a/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/NullFileReferenceHelper.java b/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/NullFileReferenceHelper.java index 76ed9e09ad3e..c0654e3bb444 100644 --- a/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/NullFileReferenceHelper.java +++ b/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/NullFileReferenceHelper.java @@ -45,9 +45,7 @@ public class NullFileReferenceHelper extends FileReferenceHelper { @Override @NotNull public Collection getRoots(@NotNull final Module module) { - return ContainerUtil.mapNotNull(ModuleRootManager.getInstance(module).getContentRoots(), virtualFile -> { - return PsiManager.getInstance(module.getProject()).findDirectory(virtualFile); - }); + return ContainerUtil.mapNotNull(ModuleRootManager.getInstance(module).getContentRoots(), virtualFile -> PsiManager.getInstance(module.getProject()).findDirectory(virtualFile)); } @Override diff --git a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java index b33b4b0e54f9..7fd222a88e6a 100644 --- a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java +++ b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java @@ -129,9 +129,7 @@ public class DiffContentFactoryImpl extends DiffContentFactory { public DocumentContent createDocument(@Nullable Project project, @NotNull final VirtualFile file) { // TODO: add notification, that file is decompiled ? if (file.isDirectory()) return null; - Document document = ReadAction.compute(() -> { - return FileDocumentManager.getInstance().getDocument(file); - }); + Document document = ReadAction.compute(() -> FileDocumentManager.getInstance().getDocument(file)); if (document == null) return null; return new FileDocumentContentImpl(project, document, file); } diff --git a/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java b/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java index a78772419afd..1460bbc023ae 100644 --- a/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java +++ b/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java @@ -81,11 +81,7 @@ abstract class DocumentsSynchronizer { @NotNull final CharSequence newText) { try { myDuringModification = true; - CommandProcessor.getInstance().executeCommand(myProject, () -> { - ApplicationManager.getApplication().runWriteAction(() -> { - document.replaceString(startOffset, endOffset, newText); - }); - }, "Synchronize document and its fragment", document); + CommandProcessor.getInstance().executeCommand(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> document.replaceString(startOffset, endOffset, newText)), "Synchronize document and its fragment", document); } finally { myDuringModification = false; diff --git a/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java index 91813ca63150..a6c7694dc767 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java @@ -114,9 +114,7 @@ public abstract class CacheDiffRequestProcessor extends DiffRequestProcessor applyRequest(request, force, scrollToChangePolicy); }; }, - () -> { - applyRequest(new LoadingDiffRequest(getRequestName(requestProvider)), force, scrollToChangePolicy); - }, + () -> applyRequest(new LoadingDiffRequest(getRequestName(requestProvider)), force, scrollToChangePolicy), ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS ); } diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java index cb0139fc9fdc..ccb47f58e27f 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java @@ -53,12 +53,8 @@ public abstract class DiffWindowBase { .setProject(myProject) .setParent(myHints.getParent()) .setDimensionServiceKey(dialogGroupKey) - .setPreferredFocusedComponent(() -> { - return myProcessor.getPreferredFocusedComponent(); - }) - .setOnShowCallback(() -> { - myProcessor.updateRequest(); - }) + .setPreferredFocusedComponent(() -> myProcessor.getPreferredFocusedComponent()) + .setOnShowCallback(() -> myProcessor.updateRequest()) .build(); myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png")); Disposer.register(myWrapper, myProcessor); diff --git a/platform/diff-impl/src/com/intellij/diff/merge/TextMergeChange.java b/platform/diff-impl/src/com/intellij/diff/merge/TextMergeChange.java index 9b6ee9807ea7..2c841e74a452 100644 --- a/platform/diff-impl/src/com/intellij/diff/merge/TextMergeChange.java +++ b/platform/diff-impl/src/com/intellij/diff/merge/TextMergeChange.java @@ -289,21 +289,13 @@ public class TextMergeChange extends ThreesideDiffChangeBase { private GutterIconRenderer createApplyRenderer(@NotNull final Side side, final boolean modifier) { if (isResolved(side)) return null; Icon icon = isOnesideAppliedConflict() ? DiffUtil.getArrowDownIcon(side) : DiffUtil.getArrowIcon(side); - return createIconRenderer(DiffBundle.message("merge.dialog.apply.change.action.name"), icon, isConflict(), () -> { - myViewer.executeMergeCommand("Accept change", Collections.singletonList(this), () -> { - myViewer.replaceChange(this, side, modifier); - }); - }); + return createIconRenderer(DiffBundle.message("merge.dialog.apply.change.action.name"), icon, isConflict(), () -> myViewer.executeMergeCommand("Accept change", Collections.singletonList(this), () -> myViewer.replaceChange(this, side, modifier))); } @Nullable private GutterIconRenderer createIgnoreRenderer(@NotNull final Side side, final boolean modifier) { if (isResolved(side)) return null; - return createIconRenderer(DiffBundle.message("merge.dialog.ignore.change.action.name"), AllIcons.Diff.Remove, isConflict(), () -> { - myViewer.executeMergeCommand("Ignore change", Collections.singletonList(this), () -> { - myViewer.ignoreChange(this, side, modifier); - }); - }); + return createIconRenderer(DiffBundle.message("merge.dialog.ignore.change.action.name"), AllIcons.Diff.Remove, isConflict(), () -> myViewer.executeMergeCommand("Ignore change", Collections.singletonList(this), () -> myViewer.ignoreChange(this, side, modifier))); } @Nullable diff --git a/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java b/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java index ec1f31f3b28f..2f35243682b4 100644 --- a/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java @@ -320,27 +320,25 @@ public class TextMergeViewer implements MergeTool.MergeViewer { // we need invokeLater() here because viewer is partially-initialized (ex: there are no toolbar or status panel) // user can see this state while we're showing progress indicator, so we want let init() to finish. - ApplicationManager.getApplication().invokeLater(() -> { - ProgressManager.getInstance().run(new Task.Modal(getProject(), "Computing Differences...", true) { - private Runnable myCallback; + ApplicationManager.getApplication().invokeLater(() -> ProgressManager.getInstance().run(new Task.Modal(getProject(), "Computing Differences...", true) { + private Runnable myCallback; - @Override - public void run(@NotNull ProgressIndicator indicator) { - myCallback = doPerformRediff(indicator); - } + @Override + public void run(@NotNull ProgressIndicator indicator) { + myCallback = doPerformRediff(indicator); + } - @Override - public void onCancel() { - myMergeContext.finishMerge(MergeResult.CANCEL); - } + @Override + public void onCancel() { + myMergeContext.finishMerge(MergeResult.CANCEL); + } - @Override - public void onSuccess() { - if (isDisposed()) return; - myCallback.run(); - } - }); - }); + @Override + public void onSuccess() { + if (isDisposed()) return; + myCallback.run(); + } + })); } @NotNull @@ -349,9 +347,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer { indicator.checkCanceled(); List contents = myMergeRequest.getContents(); - List sequences = ReadAction.compute(() -> { - return ContainerUtil.map(contents, (content) -> content.getDocument().getImmutableCharSequence()); - }); + List sequences = ReadAction.compute(() -> ContainerUtil.map(contents, (content) -> content.getDocument().getImmutableCharSequence())); List lineFragments = ByLine.compareTwoStep(sequences.get(0), sequences.get(1), sequences.get(2), ComparisonPolicy.DEFAULT, indicator); @@ -511,9 +507,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer { final List data = ContainerUtil.map(scheduled, change -> new InnerChunkData(change, documents)); final ProgressIndicator indicator = myProgress; - ApplicationManager.getApplication().executeOnPooledThread(() -> { - performRediff(scheduled, data, indicator); - }); + ApplicationManager.getApplication().executeOnPooledThread(() -> performRediff(scheduled, data, indicator)); } @CalledInBackground @@ -872,9 +866,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer { String title = e.getPresentation().getText() + " in merge"; - executeMergeCommand(title, selectedChanges.size() > 1, selectedChanges, () -> { - apply(side, selectedChanges); - }); + executeMergeCommand(title, selectedChanges.size() > 1, selectedChanges, () -> apply(side, selectedChanges)); } private boolean isSomeChangeSelected(@NotNull ThreeSide side) { diff --git a/platform/diff-impl/src/com/intellij/diff/requests/TextMergeRequestImpl.java b/platform/diff-impl/src/com/intellij/diff/requests/TextMergeRequestImpl.java index f01b41e31879..0e36b4071ec2 100644 --- a/platform/diff-impl/src/com/intellij/diff/requests/TextMergeRequestImpl.java +++ b/platform/diff-impl/src/com/intellij/diff/requests/TextMergeRequestImpl.java @@ -108,9 +108,7 @@ public class TextMergeRequestImpl extends TextMergeRequest { } if (applyContent != null) { - DiffUtil.executeWriteCommand(myOutput.getDocument(), myProject, null, () -> { - myOutput.getDocument().setText(applyContent); - }); + DiffUtil.executeWriteCommand(myOutput.getDocument(), myProject, null, () -> myOutput.getDocument().setText(applyContent)); } if (myApplyCallback != null) myApplyCallback.consume(result); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/ErrorDiffTool.java b/platform/diff-impl/src/com/intellij/diff/tools/ErrorDiffTool.java index 398c475e6513..640340164dcb 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/ErrorDiffTool.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/ErrorDiffTool.java @@ -113,9 +113,7 @@ public class ErrorDiffTool implements FrameDiffTool { if (fileName != null && FileTypeManager.getInstance().getFileTypeByFileName(fileName) != UnknownFileType.INSTANCE) { // FileType was assigned elsewhere (ex: by other UnknownFileTypeDiffRequest). We should reload request. if (myContext instanceof DiffContextEx) { - ApplicationManager.getApplication().invokeLater(() -> { - ((DiffContextEx)myContext).reloadDiffRequest(); - }, ModalityState.current()); + ApplicationManager.getApplication().invokeLater(() -> ((DiffContextEx)myContext).reloadDiffRequest(), ModalityState.current()); } } } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/binary/TwosideBinaryDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/binary/TwosideBinaryDiffViewer.java index 20c99255ba6f..1448f4858643 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/binary/TwosideBinaryDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/binary/TwosideBinaryDiffViewer.java @@ -217,9 +217,7 @@ public class TwosideBinaryDiffViewer extends TwosideDiffViewer { - targetFile.setBinaryContent(baseFile.contentsToByteArray()); - }); + WriteAction.run(() -> targetFile.setBinaryContent(baseFile.contentsToByteArray())); } catch (IOException err) { LOG.warn(err); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffToolUtil.java b/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffToolUtil.java index b3434dfd28f3..8e950c6decc0 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffToolUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffToolUtil.java @@ -109,9 +109,7 @@ public class ExternalDiffToolUtil { Charset charset = content.getCharset(); if (charset == null) charset = Charset.defaultCharset(); - String contentData = ReadAction.compute(() -> { - return content.getDocument().getText(); - }); + String contentData = ReadAction.compute(() -> content.getDocument().getText()); if (separator != LineSeparator.LF) { contentData = StringUtil.convertLineSeparators(contentData, separator.getSeparatorString()); } @@ -377,9 +375,7 @@ public class ExternalDiffToolUtil { @Override public void apply() throws IOException { final String content = StringUtil.convertLineSeparators(FileUtil.loadFile(myLocalFile, myCharset)); - ApplicationManager.getApplication().runWriteAction(() -> { - myDocument.setText(content); - }); + ApplicationManager.getApplication().runWriteAction(() -> myDocument.setText(content)); } } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java index 97130c5d85f5..7ebc583d4918 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java @@ -258,9 +258,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase { final Document document1 = getContent1().getDocument(); final Document document2 = getContent2().getDocument(); - final CharSequence[] texts = ReadAction.compute(() -> { - return new CharSequence[]{document1.getImmutableCharSequence(), document2.getImmutableCharSequence()}; - }); + final CharSequence[] texts = ReadAction.compute(() -> new CharSequence[]{document1.getImmutableCharSequence(), document2.getImmutableCharSequence()}); final List fragments = DiffUtil.compare(myRequest, texts[0], texts[1], getDiffConfig(), indicator); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java index 549255ce3f44..cb60f5740738 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java @@ -257,9 +257,7 @@ public class SimpleDiffChange { @Nullable private GutterIconRenderer createApplyRenderer(@NotNull final Side side) { - return createIconRenderer(side, "Accept", DiffUtil.getArrowIcon(side), () -> { - myViewer.replaceChange(this, side); - }); + return createIconRenderer(side, "Accept", DiffUtil.getArrowIcon(side), () -> myViewer.replaceChange(this, side)); } @Nullable diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java index f45d82dc53ed..43c22e8f1b2a 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java @@ -195,9 +195,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { final Document document1 = getContent1().getDocument(); final Document document2 = getContent2().getDocument(); - CharSequence[] texts = ReadAction.compute(() -> { - return new CharSequence[]{document1.getImmutableCharSequence(), document2.getImmutableCharSequence()}; - }); + CharSequence[] texts = ReadAction.compute(() -> new CharSequence[]{document1.getImmutableCharSequence(), document2.getImmutableCharSequence()}); List lineFragments = null; if (getHighlightPolicy().isShouldCompare()) { @@ -536,9 +534,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { if (!isEditable(myModifiedSide)) return; String title = e.getPresentation().getText() + " selected changes"; - DiffUtil.executeWriteCommand(getEditor(myModifiedSide).getDocument(), e.getProject(), title, () -> { - apply(selectedChanges); - }); + DiffUtil.executeWriteCommand(getEditor(myModifiedSide).getDocument(), e.getProject(), title, () -> apply(selectedChanges)); } protected boolean isSomeChangeSelected(@NotNull Side side) { diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/SyncScrollSupport.java b/platform/diff-impl/src/com/intellij/diff/tools/util/SyncScrollSupport.java index 86a54a7cedb8..477f1beac2db 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/SyncScrollSupport.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/SyncScrollSupport.java @@ -286,9 +286,7 @@ public class SyncScrollSupport { doScrollVertically(editor, offsets[i], animateSlaves); - editor.getScrollingModel().runActionOnScrollingFinished(() -> { - exitDisableScrollSection(); - }); + editor.getScrollingModel().runActionOnScrollingFinished(() -> exitDisableScrollSection()); } } }); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/TransferableFileEditorStateSupport.java b/platform/diff-impl/src/com/intellij/diff/tools/util/TransferableFileEditorStateSupport.java index 5eee947a1df1..c9486bb3c0e6 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/TransferableFileEditorStateSupport.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/TransferableFileEditorStateSupport.java @@ -46,9 +46,7 @@ public class TransferableFileEditorStateSupport { @NotNull private static final Key>> TRANSFERABLE_FILE_EDITOR_STATE = Key.create("Diff.TransferableFileEditorState"); - private static final Condition IS_SUPPORTED = holder -> { - return getEditorState(holder.getEditor()) != null; - }; + private static final Condition IS_SUPPORTED = holder -> getEditorState(holder.getEditor()) != null; @NotNull private final DiffSettingsHolder.DiffSettings mySettings; @NotNull private final List myHolders; diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/base/HighlightingLevel.java b/platform/diff-impl/src/com/intellij/diff/tools/util/base/HighlightingLevel.java index a0345b5a704f..d558aad54c2b 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/base/HighlightingLevel.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/base/HighlightingLevel.java @@ -25,17 +25,11 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; public enum HighlightingLevel { - INSPECTIONS("Inspections", AllIcons.Ide.HectorOn, rangeHighlighter -> { - return true; - }), + INSPECTIONS("Inspections", AllIcons.Ide.HectorOn, rangeHighlighter -> true), - ADVANCED("Syntax", AllIcons.Ide.HectorSyntax, rangeHighlighter -> { - return rangeHighlighter.getLayer() <= HighlighterLayer.ADDITIONAL_SYNTAX; - }), + ADVANCED("Syntax", AllIcons.Ide.HectorSyntax, rangeHighlighter -> rangeHighlighter.getLayer() <= HighlighterLayer.ADDITIONAL_SYNTAX), - SIMPLE("None", AllIcons.Ide.HectorOff, rangeHighlighter -> { - return rangeHighlighter.getLayer() <= HighlighterLayer.SYNTAX; - }); + SIMPLE("None", AllIcons.Ide.HectorOff, rangeHighlighter -> rangeHighlighter.getLayer() <= HighlighterLayer.SYNTAX); @NotNull private final String myText; @Nullable private final Icon myIcon; diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java index 49a4c5ee35af..d6544d99edd8 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java @@ -980,16 +980,14 @@ public class DiffUtil { return; } - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(myProject, () -> { - if (myUnderBulkUpdate) { - DocumentUtil.executeInBulk(myDocument, true, this::execute); - } - else { - execute(); - } - }, myCommandName, myCommandGroupId, myConfirmationPolicy, myDocument); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myProject, () -> { + if (myUnderBulkUpdate) { + DocumentUtil.executeInBulk(myDocument, true, this::execute); + } + else { + execute(); + } + }, myCommandName, myCommandGroupId, myConfirmationPolicy, myDocument)); } @CalledWithWriteLock diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java b/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java index 4a7bdb165ae7..bfbb4f88ac47 100644 --- a/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java +++ b/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java @@ -981,9 +981,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper { } } if (words.isEmpty()) return Collections.emptyList(); - return ContainerUtil.map2List(words, word -> { - return new IdIndexEntry(word, caseSensitively); - }); + return ContainerUtil.map2List(words, word -> new IdIndexEntry(word, caseSensitively)); } public static boolean processTextOccurrences(@NotNull final PsiElement element, diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java index 7da9378d2ef8..f5d10f6b2e6c 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java +++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java @@ -87,9 +87,7 @@ public class RelatedItemLineMarkerInfo extends MergeableLi @Override public Function getCommonTooltip(@NotNull final List infos) { return (Function)element -> { - Set tooltips = new HashSet(ContainerUtil.mapNotNull(infos, info -> { - return info.getLineMarkerTooltip(); - })); + Set tooltips = new HashSet(ContainerUtil.mapNotNull(infos, info -> info.getLineMarkerTooltip())); StringBuilder tooltip = new StringBuilder(); for (String info : tooltips) { if (tooltip.length() > 0) { diff --git a/platform/lang-api/src/com/intellij/execution/RunManager.java b/platform/lang-api/src/com/intellij/execution/RunManager.java index 4239472bf26d..e7d708163abf 100644 --- a/platform/lang-api/src/com/intellij/execution/RunManager.java +++ b/platform/lang-api/src/com/intellij/execution/RunManager.java @@ -239,9 +239,7 @@ public abstract class RunManager { public String suggestUniqueName(@Nullable String name, @Nullable ConfigurationType type) { List settingsList = type != null ? getConfigurationSettingsList(type) : getAllSettings(); - List names = ContainerUtil.map(settingsList, settings -> { - return settings.getName(); - }); + List names = ContainerUtil.map(settingsList, settings -> settings.getName()); return suggestUniqueName(StringUtil.notNullize(name, UNNAMED), names); } diff --git a/platform/lang-api/src/com/intellij/facet/frameworks/beans/ArtifactItem.java b/platform/lang-api/src/com/intellij/facet/frameworks/beans/ArtifactItem.java index 409b367d1180..9bd38e022940 100644 --- a/platform/lang-api/src/com/intellij/facet/frameworks/beans/ArtifactItem.java +++ b/platform/lang-api/src/com/intellij/facet/frameworks/beans/ArtifactItem.java @@ -88,9 +88,7 @@ public class ArtifactItem { public String[] getRequiredClasses() { if (myRequiredClasses == null) return ArrayUtil.EMPTY_STRING_ARRAY; - final List classes = ContainerUtil.mapNotNull(myRequiredClasses, requiredClass -> { - return requiredClass.getFqn(); - }); + final List classes = ContainerUtil.mapNotNull(myRequiredClasses, requiredClass -> requiredClass.getFqn()); return ArrayUtil.toStringArray(classes); } diff --git a/platform/lang-api/src/com/intellij/facet/ui/FacetDependentToolWindow.java b/platform/lang-api/src/com/intellij/facet/ui/FacetDependentToolWindow.java index a1b29bb604b3..e14192277504 100644 --- a/platform/lang-api/src/com/intellij/facet/ui/FacetDependentToolWindow.java +++ b/platform/lang-api/src/com/intellij/facet/ui/FacetDependentToolWindow.java @@ -26,8 +26,6 @@ public class FacetDependentToolWindow extends ToolWindowEP { } public List getFacetTypes() { - return ContainerUtil.mapNotNull(getFacetIds(), (NullableFunction)facetId -> { - return FacetTypeRegistry.getInstance().findFacetType(facetId); - }); + return ContainerUtil.mapNotNull(getFacetIds(), (NullableFunction)facetId -> FacetTypeRegistry.getInstance().findFacetType(facetId)); } } diff --git a/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java b/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java index df2323204376..3efa59e7c23c 100644 --- a/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java +++ b/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java @@ -305,9 +305,7 @@ public abstract class ModuleBuilder extends AbstractModuleBuilder { StartupManager.getInstance(module.getProject()).runWhenProjectIsInitialized(new DumbAwareRunnable() { @Override public void run() { - ApplicationManager.getApplication().runWriteAction(() -> { - onModuleInitialized(module); - }); + ApplicationManager.getApplication().runWriteAction(() -> onModuleInitialized(module)); } }); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java index a2ce367df05a..80fb036c5237 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java @@ -191,16 +191,14 @@ public class AutoPopupController implements Disposable { TransactionGuard guard = TransactionGuard.getInstance(); TransactionId id = guard.getContextTransaction(); final PsiDocumentManager pdm = PsiDocumentManager.getInstance(project); - pdm.performLaterWhenAllCommitted(() -> { - guard.submitTransaction(project, id, () -> { - if (pdm.hasUncommitedDocuments()) { - // no luck, will try later - runTransactionWithEverythingCommitted(project, runnable); - } - else { - runnable.run(); - } - }); - }); + pdm.performLaterWhenAllCommitted(() -> guard.submitTransaction(project, id, () -> { + if (pdm.hasUncommitedDocuments()) { + // no luck, will try later + runTransactionWithEverythingCommitted(project, runnable); + } + else { + runnable.run(); + } + })); } } 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 5149924c39ff..b20429c2ce9d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java @@ -231,9 +231,7 @@ public abstract class AbstractLayoutCodeProcessor { if (!previousTask.get() || previousTask.isCancelled()) return false; } - ApplicationManager.getApplication().runWriteAction(() -> { - currentTask.run(); - }); + ApplicationManager.getApplication().runWriteAction(() -> currentTask.run()); return currentTask.get() && !currentTask.isCancelled(); }); @@ -531,16 +529,12 @@ public abstract class AbstractLayoutCodeProcessor { myProcessors.stream().forEach((processor) -> { Ref> writeTaskRef = Ref.create(); - ApplicationManager.getApplication().runReadAction(() -> { - writeTaskRef.set(processor.prepareTask(file, myProcessChangedTextOnly)); - }); + ApplicationManager.getApplication().runReadAction(() -> writeTaskRef.set(processor.prepareTask(file, myProcessChangedTextOnly))); ProgressIndicatorProvider.checkCanceled(); FutureTask writeTask = writeTaskRef.get(); - ApplicationManager.getApplication().invokeAndWait(() -> { - WriteCommandAction.runWriteCommandAction(myProject, myCommandName, null, writeTask); - }, ModalityState.defaultModalityState()); + ApplicationManager.getApplication().invokeAndWait(() -> WriteCommandAction.runWriteCommandAction(myProject, myCommandName, null, writeTask), ModalityState.defaultModalityState()); checkStop(writeTask, file); }); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java index d648ab17c143..07d17e90ad53 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java @@ -159,9 +159,7 @@ public class StatisticsWeigher extends CompletionWeigher { @Override public List> getSortingWeights(@NotNull Iterable items, @NotNull final ProcessingContext context) { checkPrefixChanged(context); - return ContainerUtil.map(items, lookupElement -> { - return new Pair(lookupElement, getWeight(lookupElement, context.get(CompletionLookupArranger.WEIGHING_CONTEXT))); - }); + return ContainerUtil.map(items, lookupElement -> new Pair(lookupElement, getWeight(lookupElement, context.get(CompletionLookupArranger.WEIGHING_CONTEXT)))); } @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/HippieWordCompletionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/HippieWordCompletionHandler.java index 26a0879dcf65..65cd1e17b852 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/HippieWordCompletionHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/HippieWordCompletionHandler.java @@ -436,9 +436,7 @@ public class HippieWordCompletionHandler implements CodeInsightActionHandler { @NotNull private static List getCaretOffsets(Editor editor) { - return ContainerUtil.map(editor.getCaretModel().getAllCarets(), caret -> { - return caret.getOffset(); - }); + return ContainerUtil.map(editor.getCaretModel().getAllCarets(), caret -> caret.getOffset()); } private static class CompletionState { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/LiftShorterItemsClassifier.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/LiftShorterItemsClassifier.java index dd1517efcadf..654ed33f70d1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/LiftShorterItemsClassifier.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/LiftShorterItemsClassifier.java @@ -119,9 +119,7 @@ public class LiftShorterItemsClassifier extends Classifier { public List> getSortingWeights(@NotNull Iterable items, @NotNull ProcessingContext context) { final THashSet lifted = newIdentityTroveSet(); Iterable iterable = liftShorterElements(ContainerUtil.newArrayList(items), lifted, context); - return ContainerUtil.map(iterable, element -> { - return new Pair(element, lifted.contains(element)); - }); + return ContainerUtil.map(iterable, element -> new Pair(element, lifted.contains(element))); } @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GutterIntentionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GutterIntentionAction.java index d3dc1e897ff1..0d64cc19f806 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GutterIntentionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GutterIntentionAction.java @@ -103,9 +103,7 @@ class GutterIntentionAction extends AbstractIntentionAction implements Comparabl else { HighlightInfo.IntentionActionDescriptor first = list.get(0); List options = ContainerUtil.map(list.subList(1, list.size()), - descriptor -> { - return descriptor.getAction(); - }); + descriptor -> descriptor.getAction()); descriptors.add(new HighlightInfo.IntentionActionDescriptor(first.getAction(), options, null, first.getIcon())); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java index 5ca0220dc85c..ade4857c8564 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java @@ -642,9 +642,7 @@ public class IntentionHintComponent implements Disposable, ScrollAwareHint { @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { final IntentionSettingsConfigurable configurable = new IntentionSettingsConfigurable(); - ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> { - SwingUtilities.invokeLater(() -> configurable.selectIntention(myFamilyName)); - }); + ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> SwingUtilities.invokeLater(() -> configurable.selectIntention(myFamilyName))); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/QuickEditHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/QuickEditHandler.java index e5d970ac3878..094374c22495 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/QuickEditHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/QuickEditHandler.java @@ -264,16 +264,12 @@ public class QuickEditHandler extends DocumentAdapter implements Disposable { else if (e.getDocument() == myNewDocument) { commitToOriginal(e); if (!isValid()) { - ApplicationManager.getApplication().invokeLater(() -> { - closeEditor(); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> closeEditor(), myProject.getDisposed()); } } else if (e.getDocument() == myOrigDocument) { if (myCommittingToOriginal || myAltFullRange != null && myAltFullRange.isValid()) return; - ApplicationManager.getApplication().invokeLater(() -> { - closeEditor(); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> closeEditor(), myProject.getDisposed()); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java index bd248a201556..3f8434412e1e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java @@ -133,9 +133,7 @@ public class IntentionDescriptionPanel { final ShowSettingsUtil util = ShowSettingsUtil.getInstance(); final PluginManagerConfigurable pluginConfigurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance()); final Project project = ProjectManager.getInstance().getDefaultProject(); - util.editConfigurable(project, pluginConfigurable, () -> { - pluginConfigurable.select(pluginDescriptor); - }); + util.editConfigurable(project, pluginConfigurable, () -> pluginConfigurable.select(pluginDescriptor)); } }); owner = label; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/ComparingClassifier.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/ComparingClassifier.java index 70586d31ccf9..2d60d39290bc 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/ComparingClassifier.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/ComparingClassifier.java @@ -79,8 +79,6 @@ public abstract class ComparingClassifier extends Classifier { @NotNull @Override public List> getSortingWeights(@NotNull Iterable items, @NotNull final ProcessingContext context) { - return ContainerUtil.map(items, t -> { - return new Pair(t, getWeight(t, context)); - }); + return ContainerUtil.map(items, t -> new Pair(t, getWeight(t, context))); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/BackgroundUpdaterTask.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/BackgroundUpdaterTask.java index 6e9e14874319..58481a2c591c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/BackgroundUpdaterTask.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/BackgroundUpdaterTask.java @@ -92,9 +92,7 @@ public abstract class BackgroundUpdaterTask extends Task.Backgroundable { public boolean updateComponent(final PsiElement element, @Nullable final Comparator comparator) { final UsageView view = myUsageView.get(); if (view != null && !((UsageViewImpl)view).isDisposed()) { - ApplicationManager.getApplication().runReadAction(() -> { - view.appendUsage(new UsageInfo2UsageAdapter(new UsageInfo(element))); - }); + ApplicationManager.getApplication().runReadAction(() -> view.appendUsage(new UsageInfo2UsageAdapter(new UsageInfo(element)))); return true; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/actions/SaveAsTemplateAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/actions/SaveAsTemplateAction.java index 542609dc4fcf..b5127288d401 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/actions/SaveAsTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/actions/SaveAsTemplateAction.java @@ -145,9 +145,7 @@ public class SaveAsTemplateAction extends AnAction { } final LiveTemplatesConfigurable configurable = new LiveTemplatesConfigurable(); - ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> { - configurable.getTemplateListPanel().addTemplate(template); - }); + ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> configurable.getTemplateListPanel().addTemplate(template)); } @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/EditVariableDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/EditVariableDialog.java index c386813135d4..1a7617d20ab9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/EditVariableDialog.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/EditVariableDialog.java @@ -175,14 +175,12 @@ class EditVariableDialog extends DialogWrapper { }*/ private void updateTemplateTextByVarNameChange(final Variable oldVar, final Variable newVar) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(null, () -> { - Document document = myEditor.getDocument(); - String templateText = document.getText(); - templateText = templateText.replaceAll("\\$" + oldVar.getName() + "\\$", "\\$" + newVar.getName() + "\\$"); - document.replaceString(0, document.getTextLength(), templateText); - }, null, null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(null, () -> { + Document document = myEditor.getDocument(); + String templateText = document.getText(); + templateText = templateText.replaceAll("\\$" + oldVar.getName() + "\\$", "\\$" + newVar.getName() + "\\$"); + document.replaceString(0, document.getTextLength(), templateText); + }, null, null)); } private class VariablesModel extends AbstractTableModel implements EditableModel { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupActionProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupActionProvider.java index 1dae2d09525d..6c0b76845b94 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupActionProvider.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupActionProvider.java @@ -45,9 +45,7 @@ public class LiveTemplateLookupActionProvider implements LookupActionProvider { if (project.isDisposed()) return; final LiveTemplatesConfigurable configurable = new LiveTemplatesConfigurable(); - ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> { - configurable.getTemplateListPanel().editTemplate(template); - }); + ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> configurable.getTemplateListPanel().editTemplate(template)); }); return Result.HIDE_LOOKUP; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java index 54f9e2a57179..f25675e54711 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java @@ -534,9 +534,7 @@ public class LiveTemplateSettingsEditor extends JPanel { private ArrayList updateVariablesByTemplateText() { List oldVariables = getCurrentVariables(); - Set oldVariableNames = ContainerUtil.map2Set(oldVariables, variable -> { - return variable.getName(); - }); + Set oldVariableNames = ContainerUtil.map2Set(oldVariables, variable -> variable.getName()); Map newVariableNames = parseVariables(); @@ -582,13 +580,7 @@ public class LiveTemplateSettingsEditor extends JPanel { //todo[peter,kirillk] without these invokeLaters this requestFocus conflicts with com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.MyDialog.MyWindowListener.windowOpened() IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true); final ModalityState modalityState = ModalityState.stateForComponent(myKeyField); - ApplicationManager.getApplication().invokeLater(() -> { - ApplicationManager.getApplication().invokeLater(() -> { - ApplicationManager.getApplication().invokeLater(() -> { - IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true); - }, modalityState); - }, modalityState); - }, modalityState); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true), modalityState), modalityState), modalityState); } private Map parseVariables() { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java index 74cb53a869f5..86d82a44d651 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java @@ -176,9 +176,7 @@ public class TemplateManagerImpl extends TemplateManager implements Disposable { } Runnable r = () -> { if (selectionString != null) { - ApplicationManager.getApplication().runWriteAction(() -> { - EditorModificationUtil.deleteSelectedText(editor); - }); + ApplicationManager.getApplication().runWriteAction(() -> EditorModificationUtil.deleteSelectedText(editor)); } else { editor.getSelectionModel().removeSelection(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java index cedae6ae90d0..708eb139e39c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java @@ -905,9 +905,7 @@ public class TemplateState implements Disposable { int nextVariableNumber = getNextVariableNumber(oldVar); if (nextVariableNumber == -1) { calcResults(false); - ApplicationManager.getApplication().runWriteAction(() -> { - reformat(null); - }); + ApplicationManager.getApplication().runWriteAction(() -> reformat(null)); finishTemplateEditing(); return; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java index d0d9c3b4a2cb..a83303bcdb6b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java @@ -220,9 +220,7 @@ public class PostfixLiveTemplate extends CustomLiveTemplateBase { private static void expandTemplate(@NotNull final PostfixTemplate template, @NotNull final Editor editor, @NotNull final PsiElement context) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(context.getProject(), () -> template.expand(context, editor), "Expand postfix template", POSTFIX_TEMPLATE_ID); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(context.getProject(), () -> template.expand(context, editor), "Expand postfix template", POSTFIX_TEMPLATE_ID)); } @@ -231,14 +229,12 @@ public class PostfixLiveTemplate extends CustomLiveTemplateBase { final int currentOffset = editor.getCaretModel().getOffset(); final int newOffset = currentOffset - key.length(); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().runUndoTransparentAction(() -> { - Document document = editor.getDocument(); - document.deleteString(newOffset, currentOffset); - editor.getCaretModel().moveToOffset(newOffset); - PsiDocumentManager.getInstance(file.getProject()).commitDocument(document); - }); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().runUndoTransparentAction(() -> { + Document document = editor.getDocument(); + document.deleteString(newOffset, currentOffset); + editor.getCaretModel().moveToOffset(newOffset); + PsiDocumentManager.getInstance(file.getProject()).commitDocument(document); + })); return newOffset; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixTemplateWithExpressionSelector.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixTemplateWithExpressionSelector.java index 6c2c02b8678c..04e9fc3f99b8 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixTemplateWithExpressionSelector.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixTemplateWithExpressionSelector.java @@ -81,9 +81,7 @@ public abstract class PostfixTemplateWithExpressionSelector extends PostfixTempl editor, expressions, new Pass() { public void pass(@NotNull final PsiElement e) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(e.getProject(), () -> expandForChooseExpression(e, editor), "Expand postfix template", PostfixLiveTemplate.POSTFIX_TEMPLATE_ID); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(e.getProject(), () -> expandForChooseExpression(e, editor), "Expand postfix template", PostfixLiveTemplate.POSTFIX_TEMPLATE_ID)); } }, mySelector.getRenderer(), diff --git a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java index 7b425b52d666..50b7d0a414e4 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java @@ -143,9 +143,7 @@ public class InspectionApplication { return; } - ApplicationManager.getApplication().runWriteAction(() -> { - VirtualFileManager.getInstance().refreshWithoutFileWatcher(false); - }); + ApplicationManager.getApplication().runWriteAction(() -> VirtualFileManager.getInstance().refreshWithoutFileWatcher(false)); PatchProjectUtil.patchProject(myProject); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java index b843dc61918c..7a178368e5d0 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java @@ -124,9 +124,7 @@ public class InspectionManagerEx extends InspectionManagerBase { } } } - return ContainerUtil.map2Array(actions, SuppressIntentionAction.class, fix -> { - return SuppressIntentionActionFromFix.convertBatchToSuppressIntentionAction((SuppressQuickFix)fix); - }); + return ContainerUtil.map2Array(actions, SuppressIntentionAction.class, fix -> SuppressIntentionActionFromFix.convertBatchToSuppressIntentionAction((SuppressQuickFix)fix)); } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java index 92d13840f331..eec573f50989 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java @@ -95,10 +95,8 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple profile.readExternal(element); } catch (Exception ignored) { - ApplicationManager.getApplication().invokeLater(() -> { - Messages.showErrorDialog(InspectionsBundle.message("inspection.error.loading.message", 0, profile.getName()), - InspectionsBundle.message("inspection.errors.occurred.dialog.title")); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(InspectionsBundle.message("inspection.error.loading.message", 0, profile.getName()), + InspectionsBundle.message("inspection.errors.occurred.dialog.title")), ModalityState.NON_MODAL); } return profile; } @@ -206,10 +204,8 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple throw e; } catch (Exception ignored) { - ApplicationManager.getApplication().invokeLater(() -> { - Messages.showErrorDialog(InspectionsBundle.message("inspection.error.loading.message", 0, file), - InspectionsBundle.message("inspection.errors.occurred.dialog.title")); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(InspectionsBundle.message("inspection.error.loading.message", 0, file), + InspectionsBundle.message("inspection.errors.occurred.dialog.title")), ModalityState.NON_MODAL); } } return getProfile(path, false); diff --git a/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java index e12b09309cc8..406e554df0f6 100644 --- a/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java +++ b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java @@ -138,13 +138,11 @@ public class EnvironmentVariablesTextFieldWithBrowseButton extends TextFieldWith } private static List convertToVariables(Map map, final boolean readOnly) { - return ContainerUtil.map(map.entrySet(), entry -> { - return new EnvironmentVariable(entry.getKey(), entry.getValue(), readOnly) { - @Override - public boolean getNameIsWriteable() { - return !readOnly; - } - }; + return ContainerUtil.map(map.entrySet(), entry -> new EnvironmentVariable(entry.getKey(), entry.getValue(), readOnly) { + @Override + public boolean getNameIsWriteable() { + return !readOnly; + } }); } diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java index f0eccd23db66..270a114d6de4 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java @@ -136,9 +136,7 @@ public class LanguageConsoleImpl extends ConsoleViewImpl implements LanguageCons myBusConnection = getProject().getMessageBus().connect(); // action shortcuts are not yet registered - ApplicationManager.getApplication().invokeLater(() -> { - installEditorFactoryListener(); - }, getProject().getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> installEditorFactoryListener(), getProject().getDisposed()); } @Override diff --git a/platform/lang-impl/src/com/intellij/execution/console/RunIdeConsoleAction.java b/platform/lang-impl/src/com/intellij/execution/console/RunIdeConsoleAction.java index 3dfd37fe5261..22f63cfcaa7f 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/RunIdeConsoleAction.java +++ b/platform/lang-impl/src/com/intellij/execution/console/RunIdeConsoleAction.java @@ -86,13 +86,11 @@ public class RunIdeConsoleAction extends DumbAwareAction { } DefaultActionGroup actions = new DefaultActionGroup( - ContainerUtil.map(languages, (NotNullFunction)language -> { - return new DumbAwareAction(language) { - @Override - public void actionPerformed(@NotNull AnActionEvent e1) { - runConsole(e1, language); - } - }; + ContainerUtil.map(languages, (NotNullFunction)language -> new DumbAwareAction(language) { + @Override + public void actionPerformed(@NotNull AnActionEvent e1) { + runConsole(e1, language); + } }) ); JBPopupFactory.getInstance().createActionGroupPopup("Script Engine", actions, e.getDataContext(), JBPopupFactory.ActionSelectionAid.NUMBERING, false). diff --git a/platform/lang-impl/src/com/intellij/execution/impl/statistics/AbstractRunConfigurationTypeUsagesCollector.java b/platform/lang-impl/src/com/intellij/execution/impl/statistics/AbstractRunConfigurationTypeUsagesCollector.java index 21e272f7a532..0541aa289668 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/statistics/AbstractRunConfigurationTypeUsagesCollector.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/statistics/AbstractRunConfigurationTypeUsagesCollector.java @@ -62,8 +62,6 @@ public abstract class AbstractRunConfigurationTypeUsagesCollector extends Abstra } } }); - return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> { - return new UsageDescriptor(runConfigurationType, 1); - }); + return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1)); } } diff --git a/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java b/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java index eb79126656aa..c18a3c7b9e77 100644 --- a/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java +++ b/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java @@ -40,9 +40,7 @@ public class ExecutorAction extends AnAction { @NotNull public static AnAction[] getActions(final int order) { return ContainerUtil.map2Array(ExecutorRegistry.getInstance().getRegisteredExecutors(), AnAction.class, - (Function)executor -> { - return new ExecutorAction(ActionManager.getInstance().getAction(executor.getContextActionId()), executor, order); - }); + (Function)executor -> new ExecutorAction(ActionManager.getInstance().getAction(executor.getContextActionId()), executor, order)); } private final AnAction myOrigin; @@ -75,9 +73,7 @@ public class ExecutorAction extends AnAction { if (context.getLocation() == null) return null; List> producers = RunConfigurationProducer.getProducers(context.getProject()); List list = ContainerUtil.mapNotNull(producers, - producer -> { - return createConfiguration(producer, context); - } + producer -> createConfiguration(producer, context) ); if (list.isEmpty()) return null; ConfigurationFromContext configuration = list.get(myOrder < list.size() ? myOrder : 0); diff --git a/platform/lang-impl/src/com/intellij/execution/startup/ProjectStartupConfigurationBase.java b/platform/lang-impl/src/com/intellij/execution/startup/ProjectStartupConfigurationBase.java index 8736e42d6a8e..f86683cc622e 100644 --- a/platform/lang-impl/src/com/intellij/execution/startup/ProjectStartupConfigurationBase.java +++ b/platform/lang-impl/src/com/intellij/execution/startup/ProjectStartupConfigurationBase.java @@ -72,9 +72,7 @@ public class ProjectStartupConfigurationBase implements PersistentStateComponent public void setConfigurations(@NotNull Collection collection) { final List names = - ContainerUtil.map(collection, settings -> { - return new ConfigurationDescriptor(settings.getUniqueID(), settings.getName()); - }); + ContainerUtil.map(collection, settings -> new ConfigurationDescriptor(settings.getUniqueID(), settings.getName())); setList(names); } diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java index ca7e58ab230d..8f6e004942cf 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java @@ -934,9 +934,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac if (name != null && contents.size() > 1 && !usedNames.contains(name)) { title = name; } else { - title = StringUtil.join(contents, (NotNullFunction)dom -> { - return dom.getTabName(); - }, " | "); + title = StringUtil.join(contents, (NotNullFunction)dom -> dom.getTabName(), " | "); } } usedNames.add(title); diff --git a/platform/lang-impl/src/com/intellij/facet/impl/invalid/MultipleInvalidFacetEditor.java b/platform/lang-impl/src/com/intellij/facet/impl/invalid/MultipleInvalidFacetEditor.java index 28866ead53fa..6cdb340076a6 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/invalid/MultipleInvalidFacetEditor.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/invalid/MultipleInvalidFacetEditor.java @@ -34,9 +34,7 @@ public class MultipleInvalidFacetEditor extends MultipleFacetSettingsEditor { public MultipleInvalidFacetEditor(FacetEditor[] editors) { myHelper = new MultipleFacetEditorHelperImpl(); - myHelper.bind(myIgnoreFacetsCheckBox, editors, editor -> { - return editor.getEditorTab(InvalidFacetEditor.class).getIgnoreCheckBox(); - }); + myHelper.bind(myIgnoreFacetsCheckBox, editors, editor -> editor.getEditorTab(InvalidFacetEditor.class).getIgnoreCheckBox()); } @Override diff --git a/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java b/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java index 6e52e637ac7f..76eaa957ee63 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java @@ -50,8 +50,6 @@ public class FrameworkUsagesCollector extends AbstractApplicationUsagesCollector } } - return ContainerUtil.map2Set(facets, facet -> { - return new UsageDescriptor(facet, 1); - }); + return ContainerUtil.map2Set(facets, facet -> new UsageDescriptor(facet, 1)); } } diff --git a/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java b/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java index 47acab1b82ca..057ee1416147 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java @@ -46,8 +46,6 @@ public class ModuleTypeUsagesCollector extends AbstractApplicationUsagesCollecto for (Module module : ModuleManager.getInstance(project).getModules()) { modulesTypes.add(ModuleType.get(module).getId()); } - return ContainerUtil.map2Set(modulesTypes, moduleType -> { - return new UsageDescriptor(moduleType, 1); - }); + return ContainerUtil.map2Set(modulesTypes, moduleType -> new UsageDescriptor(moduleType, 1)); } } diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java b/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java index 39bc690367cd..08d30f63c5d6 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java @@ -359,9 +359,7 @@ public class FindUsagesManager { } try { for (final PsiElement element : elements) { - ApplicationManager.getApplication().runReadAction(() -> { - PsiUtilCore.ensureValid(element); - }); + ApplicationManager.getApplication().runReadAction(() -> PsiUtilCore.ensureValid(element)); handler.processElementUsages(element, usageInfoProcessor, optionsClone); for (CustomUsageSearcher searcher : Extensions.getExtensions(CustomUsageSearcher.EP_NAME)) { try { @@ -401,9 +399,7 @@ public class FindUsagesManager { private static PsiElement2UsageTargetAdapter[] convertToUsageTargets(@NotNull Iterable elementsToSearch, @NotNull final FindUsagesOptions findUsagesOptions) { final List targets = ContainerUtil.map(elementsToSearch, - element -> { - return convertToUsageTarget(element, findUsagesOptions); - }); + element -> convertToUsageTarget(element, findUsagesOptions)); return targets.toArray(new PsiElement2UsageTargetAdapter[targets.size()]); } diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetComposite.java b/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetComposite.java index ea6d850e7c4a..601d6dcda266 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetComposite.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetComposite.java @@ -50,9 +50,7 @@ public class PsiElement2UsageTargetComposite extends PsiElement2UsageTargetAdapt @Override public VirtualFile[] getFiles() { - Set files = ContainerUtil.map2Set(myDescriptor.getAllElements(), element -> { - return PsiUtilCore.getVirtualFile(element); - }); + Set files = ContainerUtil.map2Set(myDescriptor.getAllElements(), element -> PsiUtilCore.getVirtualFile(element)); return VfsUtilCore.toVirtualFileArray(files); } diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java index 2742423ab56c..f29bcca311d1 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java @@ -161,9 +161,7 @@ public class FindDialog extends DialogWrapper { validateFindButton(); if (haveResultsPreview()) { - ApplicationManager.getApplication().invokeLater(() -> { - scheduleResultsUpdate(); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> scheduleResultsUpdate(), ModalityState.any()); } } @@ -1309,9 +1307,7 @@ public class FindDialog extends DialogWrapper { @Override public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); - FileChooser.chooseFiles(descriptor, myProject, null, files -> { - myDirectoryComboBox.setSelectedItem(files.get(0).getPresentableUrl()); - }); + FileChooser.chooseFiles(descriptor, myProject, null, files -> myDirectoryComboBox.setSelectedItem(files.get(0).getPresentableUrl())); } }); diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index c7205093a522..1cd4fe90ffcc 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -226,9 +226,7 @@ public class FindPopupPanel extends JBPanel { initByModel(); updateReplaceVisibility(); - ApplicationManager.getApplication().invokeLater(() -> { - FindPopupPanel.this.scheduleResultsUpdate(); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> FindPopupPanel.this.scheduleResultsUpdate(), ModalityState.any()); } private void initComponents() { diff --git a/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/SelectedTextFormatter.java b/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/SelectedTextFormatter.java index 96d344717e39..3ce8f1fa9060 100644 --- a/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/SelectedTextFormatter.java +++ b/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/SelectedTextFormatter.java @@ -53,9 +53,7 @@ public class SelectedTextFormatter { final int start = myEditor.getSelectionModel().getSelectionStart(); final int end = myEditor.getSelectionModel().getSelectionEnd(); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(myProject, () -> document.replaceString(start, end, myTextBefore), "Configure code style on selected fragment: restore text before", null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myProject, () -> document.replaceString(start, end, myTextBefore), "Configure code style on selected fragment: restore text before", null)); myEditor.getSelectionModel().setSelection(mySelectionStart, mySelectionEnd); } @@ -79,9 +77,7 @@ public class SelectedTextFormatter { private static void reformatRange(final @NotNull PsiFile file, final @NotNull TextRange range) { final Project project = file.getProject(); - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - CodeStyleManager.getInstance(project).reformatText(file, range.getStartOffset(), range.getEndOffset()); - }), "Reformat", null); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> CodeStyleManager.getInstance(project).reformatText(file, range.getStartOffset(), range.getEndOffset())), "Reformat", null); } @NotNull diff --git a/platform/lang-impl/src/com/intellij/ide/actions/ApplyIntentionAction.java b/platform/lang-impl/src/com/intellij/ide/actions/ApplyIntentionAction.java index 9c6297eea4f6..29c06a307115 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/ApplyIntentionAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/ApplyIntentionAction.java @@ -66,9 +66,7 @@ public class ApplyIntentionAction extends AnAction { @Nullable public static ApplyIntentionAction[] getAvailableIntentions(final Editor editor, final PsiFile file) { final ShowIntentionsPass.IntentionsInfo info = new ShowIntentionsPass.IntentionsInfo(); - ApplicationManager.getApplication().runReadAction(() -> { - ShowIntentionsPass.getActionsToShow(editor, file, info, -1); - }); + ApplicationManager.getApplication().runReadAction(() -> ShowIntentionsPass.getActionsToShow(editor, file, info, -1)); if (info.isEmpty()) return null; final List actions = new ArrayList(); diff --git a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesManager.java b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesManager.java index 09e521960f4f..e7165eef07aa 100644 --- a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesManager.java +++ b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesManager.java @@ -207,9 +207,7 @@ public class FavoritesManager implements ProjectComponent, JDOMExternalizable { final Collection>> list = getFavoritesListRootUrls(name); final HashSet set = - new HashSet(ContainerUtil.map(list, item -> { - return item.getData().getFirst(); - })); + new HashSet(ContainerUtil.map(list, item -> item.getData().getFirst())); for (AbstractTreeNode node : nodes) { final Pair pair = createPairForNode(node); if (pair != null) { @@ -228,9 +226,7 @@ public class FavoritesManager implements ProjectComponent, JDOMExternalizable { final Collection>> list = getFavoritesListRootUrls(name); final HashSet set = - new HashSet(ContainerUtil.map(list, item -> { - return item.getData().getFirst(); - })); + new HashSet(ContainerUtil.map(list, item -> item.getData().getFirst())); for (AbstractTreeNode node : nodes) { final Pair pair = createPairForNode(node); if (pair != null && !set.contains(pair.getFirst())) return true; diff --git a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java index 3ecbaad34f0e..5d203368064b 100644 --- a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java +++ b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java @@ -63,9 +63,7 @@ public class UsageProjectTreeNode extends ProjectViewNodeWithChildrenList { - return chunk.getText(); - }, "")); + presentation.setPresentableText(StringUtil.join(text, chunk -> chunk.getText(), "")); } public static void updatePresentationWithTextChunks(PresentationData presentation, TextChunk[] text) { diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateActionBase.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateActionBase.java index c909c189f055..874909028321 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateActionBase.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateActionBase.java @@ -99,9 +99,7 @@ public abstract class CreateFromTemplateActionBase extends AnAction { for (String variable : variables) { template.addVariable(variable, null, "\"" + variable + "\"", true); } - WriteCommandAction.runWriteCommandAction(project, () -> { - editor.getDocument().setText(template.getTemplateText()); - }); + WriteCommandAction.runWriteCommandAction(project, () -> editor.getDocument().setText(template.getTemplateText())); TemplateManager.getInstance(project).startTemplate(editor, template); } diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java index 4f940277f0a1..01d6a7a37ad8 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java @@ -101,9 +101,7 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable, Con myProject = project; myManager = getInstance(project); myScheme = myManager.getCurrentScheme(); - myInternalTemplateNames = ContainerUtil.map2Set(myManager.getInternalTemplates(), template -> { - return template.getName(); - }); + myInternalTemplateNames = ContainerUtil.map2Set(myManager.getInternalTemplates(), template -> template.getName()); } private void onRemove() { @@ -224,9 +222,7 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable, Con @Override protected FileTemplateNode initModel() { SortedSet categories = - new TreeSet((o1, o2) -> { - return o1.getTitle().compareTo(o2.getTitle()); - }); + new TreeSet((o1, o2) -> o1.getTitle().compareTo(o2.getTitle())); for (FileTemplateGroupDescriptorFactory templateGroupFactory : factories) { @@ -235,9 +231,7 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable, Con //noinspection HardCodedStringLiteral return new FileTemplateNode("ROOT", null, - ContainerUtil.map2List(categories, s -> { - return new FileTemplateNode(s); - })); + ContainerUtil.map2List(categories, s -> new FileTemplateNode(s))); } }; allTabs.add(myOtherTemplatesList); diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateTabAsTree.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateTabAsTree.java index 7ce65a1d9681..abc98d7ee51c 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateTabAsTree.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateTabAsTree.java @@ -75,9 +75,7 @@ abstract class FileTemplateTabAsTree extends FileTemplateTab { this(descriptor.getDisplayName(), descriptor.getIcon(), descriptor instanceof FileTemplateGroupDescriptor ? ContainerUtil.map2List(((FileTemplateGroupDescriptor)descriptor).getTemplates(), - s -> { - return new FileTemplateNode(s); - }) : Collections.emptyList(), + s -> new FileTemplateNode(s)) : Collections.emptyList(), descriptor instanceof FileTemplateGroupDescriptor ? null : descriptor.getFileName()); } diff --git a/platform/lang-impl/src/com/intellij/ide/impl/PatchProjectUtil.java b/platform/lang-impl/src/com/intellij/ide/impl/PatchProjectUtil.java index 01d8decfb529..04af7c3890d0 100644 --- a/platform/lang-impl/src/com/intellij/ide/impl/PatchProjectUtil.java +++ b/platform/lang-impl/src/com/intellij/ide/impl/PatchProjectUtil.java @@ -136,9 +136,7 @@ public class PatchProjectUtil { } } - ApplicationManager.getApplication().runWriteAction(() -> { - ModifiableModelCommitter.multiCommit(models, modulesModel); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModifiableModelCommitter.multiCommit(models, modulesModel)); } public static void processIncluded(final ContentEntry contentEntry, final Set included) { diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java index 6dadc82439b0..0ddd042fe60e 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java @@ -167,9 +167,7 @@ public class NavBarModel { final List updatedModel = new ArrayList(); - ApplicationManager.getApplication().runReadAction(() -> { - traverseToRoot(psiElement, roots, updatedModel); - }); + ApplicationManager.getApplication().runReadAction(() -> traverseToRoot(psiElement, roots, updatedModel)); setModel(ContainerUtil.reverse(updatedModel)); } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java b/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java index 4b6ab4577807..00a6e083be97 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java @@ -78,9 +78,7 @@ public abstract class BaseProjectTreeBuilder extends AbstractTreeBuilder { public void run(@NotNull ProgressIndicator indicator) { final Ref target = new Ref(); _select(value, virtualFile, false, Conditions.alwaysTrue(), callback, indicator, target, focusRequestor, false); - callback.doWhenDone(() -> result.setDone(target.get())).doWhenRejected(() -> { - result.setRejected(); - }); + callback.doWhenDone(() -> result.setDone(target.get())).doWhenRejected(() -> result.setRejected()); } }); } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/RenameModuleHandler.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/RenameModuleHandler.java index 4839c846a9e0..63a2ed17ea68 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/RenameModuleHandler.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/RenameModuleHandler.java @@ -99,9 +99,7 @@ public class RenameModuleHandler implements RenameHandler, TitledHandler { final ModifiableModuleModel modifiableModel = renameModule(inputString); if (modifiableModel == null) return false; CommandProcessor.getInstance().executeCommand(myProject, () -> DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, - () -> ApplicationManager.getApplication().runWriteAction(() -> { - modifiableModel.commit(); - })), IdeBundle.message("command.renaming.module", oldName), null); + () -> ApplicationManager.getApplication().runWriteAction(() -> modifiableModel.commit())), IdeBundle.message("command.renaming.module", oldName), null); return true; } diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/EditScopesAction.java b/platform/lang-impl/src/com/intellij/ide/scopeView/EditScopesAction.java index 46a5a72d41ac..48419dd161e9 100644 --- a/platform/lang-impl/src/com/intellij/ide/scopeView/EditScopesAction.java +++ b/platform/lang-impl/src/com/intellij/ide/scopeView/EditScopesAction.java @@ -45,9 +45,7 @@ public class EditScopesAction extends AnAction implements DumbAware { final String scopeName = ProjectView.getInstance(project).getCurrentProjectViewPane().getSubId(); LOG.assertTrue(scopeName != null); final ScopeChooserConfigurable scopeChooserConfigurable = new ScopeChooserConfigurable(project); - ShowSettingsUtil.getInstance().editConfigurable(project, scopeChooserConfigurable, () -> { - scopeChooserConfigurable.selectNodeInTree(scopeName); - }); + ShowSettingsUtil.getInstance().editConfigurable(project, scopeChooserConfigurable, () -> scopeChooserConfigurable.selectNodeInTree(scopeName)); } @Override diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeTreeViewPanel.java b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeTreeViewPanel.java index 8e1879187181..91d4282be814 100644 --- a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeTreeViewPanel.java +++ b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeTreeViewPanel.java @@ -963,9 +963,7 @@ public class ScopeTreeViewPanel extends JPanel implements Disposable { if (!list.getName().equals(subId) && (oldName == null || !oldName.equals(subId))) { return; } - ApplicationManager.getApplication().invokeLater(() -> { - myDependencyValidationManager.fireScopeListeners(); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> myDependencyValidationManager.fireScopeListeners(), myProject.getDisposed()); } @Override diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java index cf0cbda79196..e0124d273cbd 100644 --- a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java @@ -139,9 +139,7 @@ public class ScopeViewPane extends AbstractProjectViewPane { @Override @NotNull public String[] getSubIds() { - return ContainerUtil.map2Array(getShownScopes(), String.class, scope -> { - return scope.getName(); - }); + return ContainerUtil.map2Array(getShownScopes(), String.class, scope -> scope.getName()); } @NotNull diff --git a/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java b/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java index 8f38e5bce218..2ad67cb97cbd 100644 --- a/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java @@ -70,14 +70,12 @@ public abstract class LRUPopupBuilder { public static ListPopup forFileLanguages(@NotNull Project project, @NotNull Iterable files, @NotNull final PerFileMappings mappings) { final VirtualFile[] filesCopy = VfsUtilCore.toVirtualFileArray(JBIterable.from(files).toList()); Arrays.sort(filesCopy, (o1, o2) -> StringUtil.compare(o1.getName(), o2.getName(), !o1.getFileSystem().isCaseSensitive())); - return forFileLanguages(project, null, t -> { - new WriteCommandAction(project, "Change Language") { - @Override - protected void run(@NotNull Result result) throws Throwable { - changeLanguageWithUndo(project, t, filesCopy, mappings); - } - }.execute(); - }); + return forFileLanguages(project, null, t -> new WriteCommandAction(project, "Change Language") { + @Override + protected void run(@NotNull Result result) throws Throwable { + changeLanguageWithUndo(project, t, filesCopy, mappings); + } + }.execute()); } @NotNull diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 9044e5683a64..44f2013d0ade 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -368,9 +368,7 @@ public class FileStructurePopup implements Disposable, TreeActionsOwner { } }); ApplicationManager.getApplication().executeOnPooledThread(() -> { - ApplicationManager.getApplication().runReadAction(() -> { - myFilteringStructure.rebuild(); - }); + ApplicationManager.getApplication().runReadAction(() -> myFilteringStructure.rebuild()); //noinspection SSBasedInspection SwingUtilities.invokeLater(() -> { diff --git a/platform/lang-impl/src/com/intellij/ide/util/PlatformPackageUtil.java b/platform/lang-impl/src/com/intellij/ide/util/PlatformPackageUtil.java index 09563ac689f4..35c00ffce40a 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/PlatformPackageUtil.java +++ b/platform/lang-impl/src/com/intellij/ide/util/PlatformPackageUtil.java @@ -207,9 +207,7 @@ public class PlatformPackageUtil { } }); - List directories = ContainerUtil.mapNotNull(query.findAll(), virtualFile -> { - return manager.findDirectory(virtualFile); - }); + List directories = ContainerUtil.mapNotNull(query.findAll(), virtualFile -> manager.findDirectory(virtualFile)); return directories.toArray(new PsiDirectory[directories.size()]); } diff --git a/platform/lang-impl/src/com/intellij/ide/util/TreeFileChooserDialog.java b/platform/lang-impl/src/com/intellij/ide/util/TreeFileChooserDialog.java index 85b156103e85..137bc764778b 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/TreeFileChooserDialog.java +++ b/platform/lang-impl/src/com/intellij/ide/util/TreeFileChooserDialog.java @@ -406,9 +406,7 @@ public final class TreeFileChooserDialog extends DialogWrapper implements TreeFi if (myFileType != null && myProject != null) { GlobalSearchScope scope = myShowLibraryContents ? GlobalSearchScope.allScope(myProject) : GlobalSearchScope.projectScope(myProject); Collection virtualFiles = FileTypeIndex.getFiles(myFileType, scope); - fileNames = ContainerUtil.map2Array(virtualFiles, String.class, file -> { - return file.getName(); - }); + fileNames = ContainerUtil.map2Array(virtualFiles, String.class, file -> file.getName()); } else { fileNames = FilenameIndex.getAllFilenames(myProject); diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java index b1d6b491f82e..70bc7d22248b 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java @@ -88,14 +88,12 @@ public class GotoActionItemProvider implements ChooseByNameItemProvider { AnAction action = myActionManager.getAction(actionId); wrappers.add(new ActionWrapper(action, myModel.myActionGroups.get(action), MatchMode.NAME, context)); } - return ContainerUtil.process(ContainerUtil.map(wrappers, (Function)w -> { - return new MatchedValue(w, pattern) { - @Nullable - @Override - public String getValueText() { - return pattern; - } - }; + return ContainerUtil.process(ContainerUtil.map(wrappers, (Function)w -> new MatchedValue(w, pattern) { + @Nullable + @Override + public String getValueText() { + return pattern; + } }), consumer); } diff --git a/platform/lang-impl/src/com/intellij/internal/psiView/formattingblocks/BlockTreeNode.java b/platform/lang-impl/src/com/intellij/internal/psiView/formattingblocks/BlockTreeNode.java index bf7aa2471ee7..da85969154af 100644 --- a/platform/lang-impl/src/com/intellij/internal/psiView/formattingblocks/BlockTreeNode.java +++ b/platform/lang-impl/src/com/intellij/internal/psiView/formattingblocks/BlockTreeNode.java @@ -42,9 +42,7 @@ public class BlockTreeNode extends SimpleNode { @Override public BlockTreeNode[] getChildren() { - return ContainerUtil.map2Array(myBlock.getSubBlocks(), BlockTreeNode.class, block -> { - return new BlockTreeNode(block, BlockTreeNode.this); - }); + return ContainerUtil.map2Array(myBlock.getSubBlocks(), BlockTreeNode.class, block -> new BlockTreeNode(block, BlockTreeNode.this)); } @Override diff --git a/platform/lang-impl/src/com/intellij/openapi/fileChooser/actions/GotoModuleDirectory.java b/platform/lang-impl/src/com/intellij/openapi/fileChooser/actions/GotoModuleDirectory.java index 104eab43757f..5bb7f78d6689 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileChooser/actions/GotoModuleDirectory.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileChooser/actions/GotoModuleDirectory.java @@ -29,9 +29,7 @@ public final class GotoModuleDirectory extends FileChooserAction { protected void actionPerformed(final FileSystemTree fileSystemTree, final AnActionEvent e) { final VirtualFile moduleDir = getModuleDir(e); if (moduleDir != null) { - fileSystemTree.select(moduleDir, () -> { - fileSystemTree.expand(moduleDir, null); - }); + fileSystemTree.select(moduleDir, () -> fileSystemTree.expand(moduleDir, null)); } } diff --git a/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java b/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java index 5f5f38e407c3..bccc71ef939d 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java @@ -81,9 +81,7 @@ public class FileTypeUsagesCollector extends AbstractApplicationUsagesCollector }, GlobalSearchScope.projectScope(project)); }); } - return ContainerUtil.map2Set(usedFileTypes, (NotNullFunction)fileType -> { - return new UsageDescriptor(fileType.getName(), 1); - }); + return ContainerUtil.map2Set(usedFileTypes, (NotNullFunction)fileType -> new UsageDescriptor(fileType.getName(), 1)); } @Nullable diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java index fc0d1e9112bc..ad34257b9d8d 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java @@ -117,15 +117,11 @@ public class SdkConfigurationUtil { } public static void addSdk(@NotNull final Sdk sdk) { - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().addJdk(sdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(sdk)); } public static void removeSdk(final Sdk sdk) { - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable.getInstance().removeJdk(sdk); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().removeJdk(sdk)); } @Nullable diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/RenameLibraryHandler.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/RenameLibraryHandler.java index 0e5f7a30ccbd..bbd5970e2253 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/RenameLibraryHandler.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/RenameLibraryHandler.java @@ -115,9 +115,7 @@ public class RenameLibraryHandler implements RenameHandler, TitledHandler { } }; UndoManager.getInstance(myProject).undoableActionPerformed(action); - ApplicationManager.getApplication().runWriteAction(() -> { - modifiableModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> modifiableModel.commit()); }, IdeBundle.message("command.renaming.module", oldName), null); return success.get().booleanValue(); } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/PlatformContentEntriesConfigurable.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/PlatformContentEntriesConfigurable.java index 6bf5d35dc8d0..586a1b5888b8 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/PlatformContentEntriesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/PlatformContentEntriesConfigurable.java @@ -94,9 +94,7 @@ public class PlatformContentEntriesConfigurable implements Configurable { public void apply() throws ConfigurationException { myEditor.apply(); if (myModifiableModel.isChanged()) { - ApplicationManager.getApplication().runWriteAction(() -> { - myModifiableModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> myModifiableModel.commit()); myEditor.disposeUIResources(); myTopPanel.remove(myEditor.getComponent()); createEditor(); diff --git a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java index 5cf5db6b13ab..b9c82496ec71 100644 --- a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java +++ b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java @@ -381,9 +381,7 @@ public class RegistryUi implements Disposable { if (r == Messages.OK) { - ApplicationManager.getApplication().invokeLater(() -> { - app.restart(true); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> app.restart(true), ModalityState.NON_MODAL); } } } diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java index 383fc65c80d9..7116f71b6ede 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java @@ -800,9 +800,7 @@ public class DependenciesPanel extends JPanel implements Disposable, DataProvide final StringBuffer buf = new StringBuffer(); processDependencies(getSelectedScope(myLeftTree), getSelectedScope(myRightTree), path -> { if (buf.length() > 0) buf.append("
"); - buf.append(StringUtil.join(path, psiFile -> { - return psiFile.getName(); - }, delim)); + buf.append(StringUtil.join(path, psiFile -> psiFile.getName(), delim)); return true; }); final JEditorPane pane = new JEditorPane(UIUtil.HTML_MIME, XmlStringUtil.wrapInHtml(buf)); diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesUsagesPanel.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesUsagesPanel.java index 91e0ab22b327..c2ee176db7a3 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesUsagesPanel.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesUsagesPanel.java @@ -92,9 +92,7 @@ public class DependenciesUsagesPanel extends UsagesPanel { final UsageInfo[] finalUsages = usages; final PsiElement[] _elementsToSearch = elementsToSearch != null ? PsiUtilCore.toPsiElementArray(elementsToSearch) : PsiElement.EMPTY_ARRAY; - ApplicationManager.getApplication().invokeLater(() -> { - showUsages(_elementsToSearch, finalUsages); - }, ModalityState.stateForComponent(DependenciesUsagesPanel.this)); + ApplicationManager.getApplication().invokeLater(() -> showUsages(_elementsToSearch, finalUsages), ModalityState.stateForComponent(DependenciesUsagesPanel.this)); } }); myCurrentProgress = null; diff --git a/platform/lang-impl/src/com/intellij/platform/ModuleAttachProcessor.java b/platform/lang-impl/src/com/intellij/platform/ModuleAttachProcessor.java index 4be800e3c001..e7919e4fdbd8 100644 --- a/platform/lang-impl/src/com/intellij/platform/ModuleAttachProcessor.java +++ b/platform/lang-impl/src/com/intellij/platform/ModuleAttachProcessor.java @@ -63,9 +63,7 @@ public class ModuleAttachProcessor extends ProjectAttachProcessor { final VirtualFile baseDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(projectDir.getParent()); PlatformProjectOpenProcessor.runDirectoryProjectConfigurators(baseDir, newProject); newProject.save(); - ApplicationManager.getApplication().runWriteAction(() -> { - Disposer.dispose(newProject); - }); + ApplicationManager.getApplication().runWriteAction(() -> Disposer.dispose(newProject)); } final String[] files = projectDir.list(); if (files != null) { diff --git a/platform/lang-impl/src/com/intellij/platform/renameProject/RenameProjectHandler.java b/platform/lang-impl/src/com/intellij/platform/renameProject/RenameProjectHandler.java index f7183a8c7a28..c3be64d2c5f2 100644 --- a/platform/lang-impl/src/com/intellij/platform/renameProject/RenameProjectHandler.java +++ b/platform/lang-impl/src/com/intellij/platform/renameProject/RenameProjectHandler.java @@ -120,9 +120,7 @@ public class RenameProjectHandler implements RenameHandler, TitledHandler { return false; } final Ref success = Ref.create(Boolean.TRUE); - CommandProcessor.getInstance().executeCommand(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> { - DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, () -> modifiableModel.commit()); - }), IdeBundle.message("command.renaming.module", myModule.getName()), null); + CommandProcessor.getInstance().executeCommand(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, () -> modifiableModel.commit())), IdeBundle.message("command.renaming.module", myModule.getName()), null); return success.get().booleanValue(); } return true; diff --git a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java index b5b72995bdf7..df6054d2ec3f 100644 --- a/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java +++ b/platform/lang-impl/src/com/intellij/platform/templates/SaveProjectAsTemplateDialog.java @@ -71,9 +71,7 @@ public class SaveProjectAsTemplateDialog extends DialogWrapper { myModuleCombo.setVisible(false); } else { - List items = new ArrayList(ContainerUtil.map(modules, module -> { - return module.getName(); - })); + List items = new ArrayList(ContainerUtil.map(modules, module -> module.getName())); items.add(WHOLE_PROJECT); myModuleCombo.setModel(new CollectionComboBoxModel(items, WHOLE_PROJECT)); } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java index 797e606d8365..d2f1904374bc 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java @@ -32,9 +32,7 @@ import java.util.Set; */ public class InspectionsAggregationUtil { public static List getInspectionsKeys(final InspectionConfigTreeNode node) { - return ContainerUtil.map(getInspectionsNodes(node), node1 -> { - return node1.getKey(); - }); + return ContainerUtil.map(getInspectionsNodes(node), node1 -> node1.getKey()); } public static List getInspectionsNodes(final InspectionConfigTreeNode node) { diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java index fffefd398ed8..f77bc91a07ab 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java @@ -871,14 +871,10 @@ public class SingleInspectionProfilePanel extends JPanel { } }; final HighlightSeverity severity = - ScopesAndSeveritiesTable.getSeverity(ContainerUtil.map(nodes, node -> { - return node.getDefaultDescriptor().getState(); - })); + ScopesAndSeveritiesTable.getSeverity(ContainerUtil.map(nodes, node -> node.getDefaultDescriptor().getState())); severityLevelChooser.setChosen(severity); - final ScopesChooser scopesChooser = new ScopesChooser(ContainerUtil.map(nodes, node -> { - return node.getDefaultDescriptor(); - }), mySelectedProfile, project, null) { + final ScopesChooser scopesChooser = new ScopesChooser(ContainerUtil.map(nodes, node -> node.getDefaultDescriptor()), mySelectedProfile, project, null) { @Override protected void onScopesOrderChanged() { myTreeTable.updateUI(); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java index 206486238c06..a8a99fd9a1fb 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java @@ -407,9 +407,7 @@ public class ScopesAndSeveritiesTable extends JBTable { @Override public void addRow() { - final List descriptors = ContainerUtil.map(myTableSettings.getNodes(), inspectionConfigTreeNode -> { - return inspectionConfigTreeNode.getDefaultDescriptor(); - }); + final List descriptors = ContainerUtil.map(myTableSettings.getNodes(), inspectionConfigTreeNode -> inspectionConfigTreeNode.getDefaultDescriptor()); final ScopesChooser scopesChooser = new ScopesChooser(descriptors, myInspectionProfile, myProject, myScopeNames) { @Override protected void onScopeAdded() { diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java index 104b6543eb27..5db2970d8d9f 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java @@ -51,9 +51,7 @@ public class SeverityRenderer extends ComboBoxTableRenderer { public static SeverityRenderer create(final InspectionProfileImpl inspectionProfile, @Nullable final Runnable onClose) { final SortedSet severities = LevelChooserAction.getSeverities(((SeverityProvider)inspectionProfile.getProfileManager()).getOwnSeverityRegistrar()); - return new SeverityRenderer(ContainerUtil.map2Array(severities, new SeverityState[severities.size()], severity -> { - return new SeverityState(severity, true, false); - }), onClose); + return new SeverityRenderer(ContainerUtil.map2Array(severities, new SeverityState[severities.size()], severity -> new SeverityState(severity, true, false)), onClose); } public static Icon getIcon(@NotNull HighlightDisplayLevel level) { 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 36810a49c0cd..15af5e38e3e3 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java @@ -105,9 +105,7 @@ public class CodeStyleSettingsCodeFragmentFilter { final int rangeEnd = myTextRangeMarker.getEndOffset(); CharSequence textBefore = myDocument.getCharsSequence(); - ApplicationManager.getApplication().runWriteAction(() -> { - CodeStyleManager.getInstance(myProject).reformatText(myFile, rangeStart, rangeEnd); - }); + ApplicationManager.getApplication().runWriteAction(() -> CodeStyleManager.getInstance(myProject).reformatText(myFile, rangeStart, rangeEnd)); if (rangeStart != myTextRangeMarker.getStartOffset() || rangeEnd != myTextRangeMarker.getEndOffset()) { return true; diff --git a/platform/lang-impl/src/com/intellij/psi/formatter/common/InjectedLanguageBlockWrapper.java b/platform/lang-impl/src/com/intellij/psi/formatter/common/InjectedLanguageBlockWrapper.java index ae123607adc5..75b11d62ecc5 100644 --- a/platform/lang-impl/src/com/intellij/psi/formatter/common/InjectedLanguageBlockWrapper.java +++ b/platform/lang-impl/src/com/intellij/psi/formatter/common/InjectedLanguageBlockWrapper.java @@ -154,9 +154,7 @@ public final class InjectedLanguageBlockWrapper implements BlockEx { if (spacing instanceof DependantSpacingImpl && shift != 0) { DependantSpacingImpl hostSpacing = (DependantSpacingImpl)spacing; final int finalShift = shift; - List shiftedRanges = ContainerUtil.map(hostSpacing.getDependentRegionRanges(), range -> { - return range.shiftRight(finalShift); - }); + List shiftedRanges = ContainerUtil.map(hostSpacing.getDependentRegionRanges(), range -> range.shiftRight(finalShift)); return new DependantSpacingImpl( hostSpacing.getMinSpaces(), hostSpacing.getMaxSpaces(), shiftedRanges, hostSpacing.shouldKeepLineFeeds(), hostSpacing.getKeepBlankLines(), DependentSpacingRule.DEFAULT diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java index 1f95e40847c4..57181538459f 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java @@ -163,9 +163,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { doPostponedFormatting(); } else { - application.runWriteAction(() -> { - doPostponedFormatting(); - }); + application.runWriteAction(() -> doPostponedFormatting()); } } } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java index 588d396b7444..44d63924b0f1 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java @@ -575,9 +575,7 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar, ModificationT Place shreds = window.getShreds(); Project project = shreds.getHostPointer().getProject(); DocumentEx delegate = ((PsiDocumentManagerBase)PsiDocumentManager.getInstance(project)).getLastCommittedDocument(window.getDelegate()); - Place place = new Place(ContainerUtil.map(shreds, shred -> { - return ((ShredImpl) shred).withPsiRange(); - })); + Place place = new Place(ContainerUtil.map(shreds, shred -> ((ShredImpl) shred).withPsiRange())); return new DocumentWindowImpl(delegate, window.isOneLine(), place); } } diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java index 93260d12431f..6941cc352c0c 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java @@ -712,9 +712,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe if (updated.length() > 0) { final Throwable e = new Throwable(updated.toString()); // avoid direct forceRebuild as it produces dependency cycle (IDEA-105485) - ApplicationManager.getApplication().invokeLater(() -> { - forceRebuild(e); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> forceRebuild(e), ModalityState.NON_MODAL); } dropUnregisteredIndices(state); myInitialized = true; diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java index 1c42e63533f9..e17fb30de991 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java @@ -25,9 +25,7 @@ public class StubProcessingHelper extends StubProcessingHelperBase { protected void onInternalError(final VirtualFile file) { // requestReindex() may want to acquire write lock (for indices not requiring content loading) // thus, because here we are under read lock, need to use invoke later - ApplicationManager.getApplication().invokeLater(() -> { - myFileBasedIndex.requestReindex(file); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> myFileBasedIndex.requestReindex(file), ModalityState.NON_MODAL); } diff --git a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataLanguagePatterns.java b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataLanguagePatterns.java index dda33562fc5e..47ce13d8074c 100644 --- a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataLanguagePatterns.java +++ b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataLanguagePatterns.java @@ -90,9 +90,7 @@ public class TemplateDataLanguagePatterns implements PersistentStateComponent { - return fileNameMatcher.getPresentableString(); - }, SEPARATOR)); + child.setAttribute("value", StringUtil.join(matchers, fileNameMatcher -> fileNameMatcher.getPresentableString(), SEPARATOR)); child.setAttribute("lang", language.getID()); } } diff --git a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/CallerChooserBase.java b/platform/lang-impl/src/com/intellij/refactoring/changeSignature/CallerChooserBase.java index 0f9a370aadc5..0032c5d73a97 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/CallerChooserBase.java +++ b/platform/lang-impl/src/com/intellij/refactoring/changeSignature/CallerChooserBase.java @@ -174,9 +174,7 @@ public abstract class CallerChooserBase extends DialogWrap protected Collection findElementsToHighlight(M caller, PsiElement callee) { Query references = ReferencesSearch.search(callee, new LocalSearchScope(caller), false); - return ContainerUtil.mapNotNull(references, psiReference -> { - return psiReference.getElement(); - }); + return ContainerUtil.mapNotNull(references, psiReference -> psiReference.getElement()); } @Override diff --git a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodNodeBase.java b/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodNodeBase.java index f11fbf794e93..3550c4706e25 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodNodeBase.java +++ b/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodNodeBase.java @@ -94,9 +94,7 @@ public abstract class MethodNodeBase extends CheckedTreeNo private List findCallers() { if (myMethod == null) return Collections.emptyList(); final Ref> callers = new Ref>(); - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> { - callers.set(ContainerUtil.filter(computeCallers(), getFilter())); - }), RefactoringBundle.message("caller.chooser.looking.for.callers"), true, myProject)) { + if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> callers.set(ContainerUtil.filter(computeCallers(), getFilter()))), RefactoringBundle.message("caller.chooser.looking.for.callers"), true, myProject)) { myCancelCallback.run(); return Collections.emptyList(); } diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodHelper.java b/platform/lang-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodHelper.java index 4c0588d7cdd7..044ad2ad7ae3 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodHelper.java +++ b/platform/lang-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodHelper.java @@ -133,9 +133,7 @@ public class ExtractMethodHelper { private static void replaceDuplicate(final Project project, final Consumer> replacer, final Pair replacement) { - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - replacer.consume(replacement); - }), "Replace duplicate", null); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> replacer.consume(replacement)), "Replace duplicate", null); } diff --git a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java index 44ed9babfca7..7fa87d7e4e2e 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java +++ b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java @@ -142,9 +142,7 @@ public abstract class AbstractInplaceIntroducer { - myPreview.getDocument().replaceString(0, myPreview.getDocument().getTextLength(), text); - }); + ApplicationManager.getApplication().runWriteAction(() -> myPreview.getDocument().replaceString(0, myPreview.getDocument().getTextLength(), text)); } protected final JComponent getPreviewComponent() { @@ -320,9 +318,7 @@ public abstract class AbstractInplaceIntroducer { - myEditor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), names[0]); - }); + ApplicationManager.getApplication().runWriteAction(() -> myEditor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), names[0])); } } templateState.gotoEnd(true); diff --git a/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java b/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java index 5bc15900563f..ebe4495b9268 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java +++ b/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java @@ -222,9 +222,7 @@ public abstract class ExtractIncludeFileBase implements Re final List> duplicates = new ArrayList>(); final T first = children.getFirst(); final T second = children.getSecond(); - PsiEquivalenceUtil.findChildRangeDuplicates(first, second, file, (start1, end1) -> { - duplicates.add(new IncludeDuplicate((T)start1, (T)end1)); - }); + PsiEquivalenceUtil.findChildRangeDuplicates(first, second, file, (start1, end1) -> duplicates.add(new IncludeDuplicate((T)start1, (T)end1))); final String includePath = processPrimaryFragment(first, second, targetDirectory, targetfileName, file); editor.getCaretModel().moveToOffset(first.getTextRange().getStartOffset()); diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameProcessor.java b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameProcessor.java index 8b768b742f1f..9fca4e5f4714 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameProcessor.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameProcessor.java @@ -433,9 +433,7 @@ public class RenameProcessor extends BaseRefactoringProcessor { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return; Messages.showMessageDialog("Following usages were safely skipped:
" + - StringUtil.join(mySkippedUsages, unresolvableCollisionUsageInfo -> { - return unresolvableCollisionUsageInfo.getDescription(); - }, "
") + + StringUtil.join(mySkippedUsages, unresolvableCollisionUsageInfo -> unresolvableCollisionUsageInfo.getDescription(), "
") + "", "Not All Usages Were Renamed", null); } }; diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java index 91e3f6ce9abd..f48c52468f87 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java @@ -239,9 +239,7 @@ public class VariableInplaceRenamer extends InplaceRefactoring { } } - final Runnable runnable = () -> ApplicationManager.getApplication().runReadAction(() -> { - renamer.findUsages(usages, false, false); - }); + final Runnable runnable = () -> ApplicationManager.getApplication().runReadAction(() -> renamer.findUsages(usages, false, false)); if (!ProgressManager.getInstance() .runProcessWithProgressSynchronously(runnable, RefactoringBundle.message("searching.for.variables"), true, myProject)) { @@ -317,9 +315,7 @@ public class VariableInplaceRenamer extends InplaceRefactoring { else { if (mySnapshot != null) { if (isIdentifier(myInsertedName, myLanguage)) { - ApplicationManager.getApplication().runWriteAction(() -> { - mySnapshot.apply(myInsertedName); - }); + ApplicationManager.getApplication().runWriteAction(() -> mySnapshot.apply(myInsertedName)); } } } diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java index 0c53a6eb29b7..55a7d703fcd4 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java @@ -171,9 +171,7 @@ public class NameSuggester { * @return */ private TreeMap, String> calculateReplacements(String[] propertyWords, TIntIntHashMap matches) { - TreeMap, String> replacements = new TreeMap, String>((pair, pair1) -> { - return pair.getFirst().compareTo(pair1.getFirst()); - }); + TreeMap, String> replacements = new TreeMap, String>((pair, pair1) -> pair.getFirst().compareTo(pair1.getFirst())); for (final OriginalToNewChange change : myChanges) { final int first = change.oldFirst; final int last = change.oldLast; diff --git a/platform/lang-impl/src/com/intellij/refactoring/ui/RefactoringDialog.java b/platform/lang-impl/src/com/intellij/refactoring/ui/RefactoringDialog.java index c33fcae49917..4c32825f7c71 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/ui/RefactoringDialog.java +++ b/platform/lang-impl/src/com/intellij/refactoring/ui/RefactoringDialog.java @@ -186,9 +186,7 @@ public abstract class RefactoringDialog extends DialogWrapper { @Override public void show() { - DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, () -> { - RefactoringDialog.super.show(); - }); + DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, () -> RefactoringDialog.super.show()); } } diff --git a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java index 072f672c94da..ff8260e5f0e0 100644 --- a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java +++ b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java @@ -190,9 +190,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta return; } } - ApplicationManager.getApplication().runWriteAction(() -> { - save(); - }); + ApplicationManager.getApplication().runWriteAction(() -> save()); } } @@ -242,9 +240,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta } private void fillDocument(final String text) { - ApplicationManager.getApplication().runWriteAction(() -> { - myCodeEditor.setText(text == null ? "" : text); - }); + ApplicationManager.getApplication().runWriteAction(() -> myCodeEditor.setText(text == null ? "" : text)); } @Nullable diff --git a/platform/lang-impl/src/com/intellij/usageView/UsageViewUtil.java b/platform/lang-impl/src/com/intellij/usageView/UsageViewUtil.java index 28af3a52a235..547a8faa9c25 100644 --- a/platform/lang-impl/src/com/intellij/usageView/UsageViewUtil.java +++ b/platform/lang-impl/src/com/intellij/usageView/UsageViewUtil.java @@ -149,9 +149,7 @@ public class UsageViewUtil { @NotNull public static PsiElement[] toElements(@NotNull UsageInfo[] usageInfos) { - return ContainerUtil.map2Array(usageInfos, PsiElement.class, info -> { - return info.getElement(); - }); + return ContainerUtil.map2Array(usageInfos, PsiElement.class, info -> info.getElement()); } public static void navigateTo(@NotNull UsageInfo info, boolean requestFocus) { diff --git a/platform/lang-impl/src/com/intellij/util/LogicalRootsManagerImpl.java b/platform/lang-impl/src/com/intellij/util/LogicalRootsManagerImpl.java index 46d982660c0e..e8dd7cabcef7 100644 --- a/platform/lang-impl/src/com/intellij/util/LogicalRootsManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/util/LogicalRootsManagerImpl.java @@ -66,9 +66,7 @@ public class LogicalRootsManagerImpl extends LogicalRootsManager { } }); registerLogicalRootProvider(LogicalRootType.SOURCE_ROOT, - module -> ContainerUtil.map2List(ModuleRootManager.getInstance(module).getSourceRoots(), s -> { - return new VirtualFileLogicalRoot(s); - })); + module -> ContainerUtil.map2List(ModuleRootManager.getInstance(module).getSourceRoots(), s -> new VirtualFileLogicalRoot(s))); } private synchronized void clear() { @@ -116,9 +114,7 @@ public class LogicalRootsManagerImpl extends LogicalRootsManager { @Override public List getLogicalRoots() { - return ContainerUtil.concat(myModuleManager.getModules(), module -> { - return getLogicalRoots(module); - }); + return ContainerUtil.concat(myModuleManager.getModules(), module -> getLogicalRoots(module)); } @Override diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java b/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java index f53c23d91a8b..469f196365a4 100644 --- a/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java +++ b/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java @@ -252,10 +252,8 @@ public class InstalledPackagesPanel extends JPanel { @Override public void consume(Exception e) { - ApplicationManager.getApplication().invokeLater(() -> { - Messages.showErrorDialog("Error occurred. Please, check your internet connection.", - "Upgrade Package Failed."); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog("Error occurred. Please, check your internet connection.", + "Upgrade Package Failed."), ModalityState.any()); } }); } diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/ManagePackagesDialog.java b/platform/lang-impl/src/com/intellij/webcore/packaging/ManagePackagesDialog.java index 526521a306ba..6c925400a563 100644 --- a/platform/lang-impl/src/com/intellij/webcore/packaging/ManagePackagesDialog.java +++ b/platform/lang-impl/src/com/intellij/webcore/packaging/ManagePackagesDialog.java @@ -222,9 +222,7 @@ public class ManagePackagesDialog extends DialogWrapper { @Override public void operationStarted(final String packageName) { if (!ApplicationManager.getApplication().isDispatchThread()) { - ApplicationManager.getApplication().invokeLater(() -> { - handleInstallationStarted(packageName); - }, ModalityState.stateForComponent(myMainPanel)); + ApplicationManager.getApplication().invokeLater(() -> handleInstallationStarted(packageName), ModalityState.stateForComponent(myMainPanel)); } else { handleInstallationStarted(packageName); @@ -235,9 +233,7 @@ public class ManagePackagesDialog extends DialogWrapper { public void operationFinished(final String packageName, @Nullable final PackageManagementService.ErrorDescription errorDescription) { if (!ApplicationManager.getApplication().isDispatchThread()) { - ApplicationManager.getApplication().invokeLater(() -> { - handleInstallationFinished(packageName, errorDescription); - }, ModalityState.stateForComponent(myMainPanel)); + ApplicationManager.getApplication().invokeLater(() -> handleInstallationFinished(packageName, errorDescription), ModalityState.stateForComponent(myMainPanel)); } else { handleInstallationFinished(packageName, errorDescription); diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java index ebe834d9764a..59eb8a0a0298 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java @@ -272,9 +272,7 @@ public class IdeaGateway { } private void doCreateChildren(@NotNull DirectoryEntry parent, Iterable children, final boolean forDeletion) { - List entries = ContainerUtil.mapNotNull(children, (NullableFunction)each -> { - return doCreateEntry(each, forDeletion); - }); + List entries = ContainerUtil.mapNotNull(children, (NullableFunction)each -> doCreateEntry(each, forDeletion)); parent.addChildren(entries); } diff --git a/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java b/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java index 09de7995eb94..079497fe784a 100644 --- a/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java +++ b/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java @@ -193,9 +193,7 @@ public class ExecUtil { GeneralCommandLine sudoCommandLine; if (SystemInfo.isMac) { - String escapedCommandLine = StringUtil.join(command, s -> { - return escapeAppleScriptArgument(s); - }, " & \" \" & "); + String escapedCommandLine = StringUtil.join(command, s -> escapeAppleScriptArgument(s), " & \" \" & "); String escapedScript = "tell current application\n" + " activate\n" + " do shell script " + escapedCommandLine + " with administrator privileges without altering line endings\n" + @@ -219,9 +217,7 @@ public class ExecUtil { sudoCommandLine = new GeneralCommandLine(command); } else if (SystemInfo.isUnix && hasTerminalApp()) { - String escapedCommandLine = StringUtil.join(command, s -> { - return escapeUnixShellArgument(s); - }, " "); + String escapedCommandLine = StringUtil.join(command, s -> escapeUnixShellArgument(s), " "); File script = createTempExecutableScript( "sudo", ".sh", "#!/bin/sh\n" + diff --git a/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java b/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java index 7d0d27f43732..341c3986b0fb 100644 --- a/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java +++ b/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java @@ -78,8 +78,6 @@ public class BrowseFilesListener implements ActionListener { final VirtualFile fileToSelect = getFileToSelect(); myChooserDescriptor.setTitle(myTitle); // important to set title and description here because a shared descriptor instance can be used myChooserDescriptor.setDescription(myDescription); - FileChooser.chooseFiles(myChooserDescriptor, null, fileToSelect, files -> { - doSetText(FileUtil.toSystemDependentName(files.get(0).getPath())); - }); + FileChooser.chooseFiles(myChooserDescriptor, null, fileToSelect, files -> doSetText(FileUtil.toSystemDependentName(files.get(0).getPath()))); } } diff --git a/platform/platform-api/src/com/intellij/openapi/diff/DocumentsSynchronizer.java b/platform/platform-api/src/com/intellij/openapi/diff/DocumentsSynchronizer.java index 77e7c834afd5..36cfc8634a19 100644 --- a/platform/platform-api/src/com/intellij/openapi/diff/DocumentsSynchronizer.java +++ b/platform/platform-api/src/com/intellij/openapi/diff/DocumentsSynchronizer.java @@ -79,9 +79,7 @@ abstract class DocumentsSynchronizer { myDuringModification = true; CommandProcessor.getInstance().executeCommand(myProject, () -> { LOG.assertTrue(endOffset <= document.getTextLength()); - ApplicationManager.getApplication().runWriteAction(() -> { - document.replaceString(startOffset, endOffset, newText); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.replaceString(startOffset, endOffset, newText)); }, DiffBundle.message("save.merge.result.command.name"), document); } finally { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java index d4cf86f4df4c..bc245120e883 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java @@ -257,9 +257,7 @@ public class ComponentWithBrowseButton extends JPanel i } } - FileChooser.chooseFile(fileChooserDescriptor, getProject(), getInitialFile(), file -> { - onFileChosen(file); - }); + FileChooser.chooseFile(fileChooserDescriptor, getProject(), getInitialFile(), file -> onFileChosen(file)); } @Nullable diff --git a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java index a9c1942f2436..159e8d31d05b 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java @@ -826,9 +826,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom presentation.setEnabled(false); final TreePath[] selectionPath = myTree.getSelectionPaths(); if (selectionPath != null) { - Object[] nodes = ContainerUtil.map2Array(selectionPath, treePath -> { - return treePath.getLastPathComponent(); - }); + Object[] nodes = ContainerUtil.map2Array(selectionPath, treePath -> treePath.getLastPathComponent()); if (!myCondition.value(nodes)) return; presentation.setEnabled(true); } diff --git a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java index a7c1731ce73a..c80b65ab94a4 100644 --- a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java +++ b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java @@ -90,9 +90,7 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr } public HyperlinkLabel createActionLabel(final String text, @NonNls final String actionId) { - return createActionLabel(text, () -> { - executeAction(actionId); - }); + return createActionLabel(text, () -> executeAction(actionId)); } public HyperlinkLabel createActionLabel(final String text, final Runnable action) { diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java index a0c92c5b310c..1271e33afb87 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java @@ -119,9 +119,7 @@ public class TabLabel extends JPanel implements Accessible { if (index > 0) { e.consume(); // Select the previous tab, then set the focus its TabLabel. - myTabs.select(myTabs.getTabAt(index - 1), false).doWhenDone(() -> { - myTabs.getSelectedLabel().requestFocusInWindow(); - }); + myTabs.select(myTabs.getTabAt(index - 1), false).doWhenDone(() -> myTabs.getSelectedLabel().requestFocusInWindow()); } } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { @@ -129,9 +127,7 @@ public class TabLabel extends JPanel implements Accessible { if (index < myTabs.getTabCount() - 1) { e.consume(); // Select the next tab, then set the focus its TabLabel. - myTabs.select(myTabs.getTabAt(index + 1), false).doWhenDone(() -> { - myTabs.getSelectedLabel().requestFocusInWindow(); - }); + myTabs.select(myTabs.getTabAt(index + 1), false).doWhenDone(() -> myTabs.getSelectedLabel().requestFocusInWindow()); } } } diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateTreeBuilder.java b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateTreeBuilder.java index 26c7ed66677d..c87b72bb6b74 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateTreeBuilder.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateTreeBuilder.java @@ -131,9 +131,7 @@ public class CertificateTreeBuilder extends AbstractTreeBuilder { } private static List extract(Collection wrappers) { - return ContainerUtil.map(wrappers, wrapper -> { - return wrapper.getCertificate(); - }); + return ContainerUtil.map(wrappers, wrapper -> wrapper.getCertificate()); } @Override diff --git a/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java b/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java index f7b4c0327a9c..9c805bcaaa9b 100644 --- a/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java +++ b/platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java @@ -152,9 +152,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { @NotNull private List getAllScheduledUpdates() { - return ContainerUtil.concat(myScheduledUpdates.values(), map -> { - return map.keySet(); - }); + return ContainerUtil.concat(myScheduledUpdates.values(), map -> map.keySet()); } public final boolean isPassThrough() { @@ -306,9 +304,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable { } if (each.executeInWriteAction()) { - ApplicationManager.getApplication().runWriteAction(() -> { - execute(each); - }); + ApplicationManager.getApplication().runWriteAction(() -> execute(each)); } else { execute(each); diff --git a/platform/platform-impl/src/com/intellij/diagnostic/GroupedLogMessage.java b/platform/platform-impl/src/com/intellij/diagnostic/GroupedLogMessage.java index 8dbe026cbd5d..2f8c8b9d43a8 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/GroupedLogMessage.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/GroupedLogMessage.java @@ -70,8 +70,6 @@ public class GroupedLogMessage extends AbstractMessage { @NotNull @Override public List getAllAttachments() { - return ContainerUtil.concat(getMessages(), message -> { - return message.getAllAttachments(); - }); + return ContainerUtil.concat(getMessages(), message -> message.getAllAttachments()); } } diff --git a/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java b/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java index b0b8b0ce5494..5179249e4b75 100644 --- a/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java +++ b/platform/platform-impl/src/com/intellij/execution/DelayedDocumentWatcher.java @@ -87,9 +87,7 @@ public class DelayedDocumentWatcher { @Override public void beforeAllDocumentsSaving() { myDocumentSavingInProgress = true; - ApplicationManager.getApplication().invokeLater(() -> { - myDocumentSavingInProgress = false; - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> myDocumentSavingInProgress = false, ModalityState.any()); } }); } @@ -177,9 +175,7 @@ public class DelayedDocumentWatcher { return false; } }); - ApplicationManager.getApplication().invokeLater(() -> { - errorsFoundConsumer.consume(errorsFound); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> errorsFoundConsumer.consume(errorsFound), ModalityState.any()); }); } } diff --git a/platform/platform-impl/src/com/intellij/ide/CommandLineProcessor.java b/platform/platform-impl/src/com/intellij/ide/CommandLineProcessor.java index 1786904fd9d2..31ba9caf8781 100644 --- a/platform/platform-impl/src/com/intellij/ide/CommandLineProcessor.java +++ b/platform/platform-impl/src/com/intellij/ide/CommandLineProcessor.java @@ -149,9 +149,7 @@ public class CommandLineProcessor { try { final String url = URLDecoder.decode(command, "UTF-8"); JetBrainsProtocolHandler.processJetBrainsLauncherParameters(url); - ApplicationManager.getApplication().invokeLater(() -> { - JBProtocolCommand.handleCurrentCommand(); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> JBProtocolCommand.handleCurrentCommand(), ModalityState.any()); } catch (UnsupportedEncodingException e) { LOG.error(e); diff --git a/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java b/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java index 1590561a1f20..f8fe765970b5 100644 --- a/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java +++ b/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java @@ -137,9 +137,7 @@ public class MacOSApplicationProvider implements ApplicationComponent { Project finalProject = project; if (!((ShowSettingsUtilImpl)ShowSettingsUtil.getInstance()).isAlreadyShown()) { - TransactionGuard.submitTransaction(project, () -> { - ShowSettingsUtil.getInstance().showSettingsDialog(finalProject, ShowSettingsUtilImpl.getConfigurableGroups(finalProject, true)); - }); + TransactionGuard.submitTransaction(project, () -> ShowSettingsUtil.getInstance().showSettingsDialog(finalProject, ShowSettingsUtilImpl.getConfigurableGroups(finalProject, true))); } applicationEvent.setHandled(true); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java index 7da62e972bc4..332001857ef2 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java @@ -334,9 +334,7 @@ public class Switcher extends AnAction implements DumbAware { toolWindows = new JBList(twModel); toolWindows.addFocusListener(new MyToolWindowsListFocusListener()); if (pinned) { - new NameFilteringListModel(toolWindows, window -> { - return window.getStripeTitle(); - }, new Condition() { + new NameFilteringListModel(toolWindows, window -> window.getStripeTitle(), new Condition() { @Override public boolean value(@NotNull String s) { return !mySpeedSearch.isPopupActive() @@ -532,9 +530,7 @@ public class Switcher extends AnAction implements DumbAware { files = new JBList(filesModel); if (pinned) { - new NameFilteringListModel(files, info -> { - return info.getNameForRendering(); - }, new Condition() { + new NameFilteringListModel(files, info -> info.getNameForRendering(), new Condition() { @Override public boolean value(@NotNull String s) { return !mySpeedSearch.isPopupActive() diff --git a/platform/platform-impl/src/com/intellij/ide/dnd/LinuxDragAndDropSupport.java b/platform/platform-impl/src/com/intellij/ide/dnd/LinuxDragAndDropSupport.java index ce86ab1f2c90..e1d9b8e830ca 100644 --- a/platform/platform-impl/src/com/intellij/ide/dnd/LinuxDragAndDropSupport.java +++ b/platform/platform-impl/src/com/intellij/ide/dnd/LinuxDragAndDropSupport.java @@ -84,9 +84,7 @@ public class LinuxDragAndDropSupport { @NotNull public static String toUriList(@NotNull final List files) { - return StringUtil.join(files, file -> { - return file.toURI().toString(); - }, "\n"); + return StringUtil.join(files, file -> file.toURI().toString(), "\n"); } public static boolean isMoveOperation(@NotNull final Transferable transferable) { diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/DisabledPluginsUsagesCollector.java b/platform/platform-impl/src/com/intellij/ide/plugins/DisabledPluginsUsagesCollector.java index ce51eeabf51c..4ab48850c44d 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/DisabledPluginsUsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/DisabledPluginsUsagesCollector.java @@ -34,8 +34,6 @@ public class DisabledPluginsUsagesCollector extends UsagesCollector { @NotNull public Set getUsages() { - return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), descriptor -> { - return new UsageDescriptor(descriptor, 1); - }); + return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), descriptor -> new UsageDescriptor(descriptor, 1)); } } diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java index aa07a3e56191..2f827a7f6d11 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java @@ -181,9 +181,7 @@ public class InstalledPluginsManagerMain extends PluginManagerMain { } } if (!notInstalled.isEmpty()) { - String deps = StringUtil.join(notInstalled, id -> { - return id.toString(); - }, ", "); + String deps = StringUtil.join(notInstalled, id -> id.toString(), ", "); String message = "Plugin " + pluginDescriptor.getName() + " depends on unknown plugin" + (notInstalled.size() > 1 ? "s " : " ") + deps; MessagesEx.showWarningDialog(parent, message, CommonBundle.getWarningTitle()); } @@ -195,9 +193,7 @@ public class InstalledPluginsManagerMain extends PluginManagerMain { } } String part = "disabled plugin" + (dependencies.size() > 1 ? "s " : " "); - String deps = StringUtil.join(dependencies, descriptor -> { - return descriptor.getName(); - }, ", "); + String deps = StringUtil.join(dependencies, descriptor -> descriptor.getName(), ", "); String message = "Plugin " + pluginDescriptor.getName() + " depends on " + part + deps + ". Enable " + part.trim() + "?"; if (MessagesEx.showOkCancelDialog(parent, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon()) == Messages.OK) { model.enableRows(dependencies.toArray(new IdeaPluginDescriptor[dependencies.size()]), Boolean.TRUE); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java index 810698019376..62fa6f8f5059 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java @@ -391,9 +391,7 @@ public class InstalledPluginsTableModel extends PluginTableModel { ); } if (!deps.isEmpty()) { - final String listOfSelectedPlugins = StringUtil.join(ideaPluginDescriptors, pluginDescriptor -> { - return pluginDescriptor.getName(); - }, ", "); + final String listOfSelectedPlugins = StringUtil.join(ideaPluginDescriptors, pluginDescriptor -> pluginDescriptor.getName(), ", "); final Set pluginDependencies = new HashSet(); final String listOfDependencies = StringUtil.join(deps, pluginId -> { final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(pluginId); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/NonBundledPluginsUsagesCollector.java b/platform/platform-impl/src/com/intellij/ide/plugins/NonBundledPluginsUsagesCollector.java index 43cc38b2db6e..5899fd08080e 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/NonBundledPluginsUsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/NonBundledPluginsUsagesCollector.java @@ -43,9 +43,7 @@ public class NonBundledPluginsUsagesCollector extends UsagesCollector { } }); - return ContainerUtil.map2Set(nonBundledEnabledPlugins, descriptor -> { - return new UsageDescriptor(descriptor.getPluginId().getIdString(), 1); - }); + return ContainerUtil.map2Set(nonBundledEnabledPlugins, descriptor -> new UsageDescriptor(descriptor.getPluginId().getIdString(), 1)); } } diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java index 0ed02be2c956..9416d3cfff74 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java @@ -173,9 +173,7 @@ public class PluginInstaller { try { GuiUtils.runOrInvokeAndWait(() -> { String title = IdeBundle.message("plugin.manager.dependencies.detected.title"); - String deps = StringUtil.join(depends, node -> { - return node.getName(); - }, ", "); + String deps = StringUtil.join(depends, node -> node.getName(), ", "); String message = IdeBundle.message("plugin.manager.dependencies.detected.message", depends.size(), deps); proceed[0] = Messages.showYesNoDialog(message, title, Messages.getWarningIcon()) == Messages.YES; }); @@ -193,9 +191,7 @@ public class PluginInstaller { try { GuiUtils.runOrInvokeAndWait(() -> { String title = IdeBundle.message("plugin.manager.dependencies.detected.title"); - String deps = StringUtil.join(optionalDeps, node -> { - return node.getName(); - }, ", "); + String deps = StringUtil.join(optionalDeps, node -> node.getName(), ", "); String message = IdeBundle.message("plugin.manager.optional.dependencies.detected.message", optionalDeps.size(), deps); proceed[0] = Messages.showYesNoDialog(message, title, Messages.getWarningIcon()) == Messages.YES; }); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java index edf602138cf6..7af1d9f40291 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java @@ -131,9 +131,7 @@ public class PluginManagerConfigurable extends BaseConfigurable implements Searc Disposer.register(d, new Disposable() { @Override public void dispose() { - ApplicationManager.getApplication().invokeLater(() -> { - showShutdownDialogIfNeeded(); - }, ApplicationManager.getApplication().getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> showShutdownDialogIfNeeded(), ApplicationManager.getApplication().getDisposed()); } }); } diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java index 1926a6ca6d9c..a54606c24461 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java @@ -245,9 +245,7 @@ public abstract class PluginManagerMain implements Disposable { @NotNull public static List mapToPluginIds(List plugins) { - return ContainerUtil.map(plugins, descriptor -> { - return descriptor.getPluginId(); - }); + return ContainerUtil.map(plugins, descriptor -> descriptor.getPluginId()); } private static String getTextPrefix() { @@ -659,9 +657,7 @@ public abstract class PluginManagerMain implements Disposable { message += "Updated plugin '" + disabled.iterator().next().getName() + "' is disabled."; } else if (!disabled.isEmpty()) { - message += "Updated plugins " + StringUtil.join(disabled, pluginDescriptor -> { - return pluginDescriptor.getName(); - }, ", ") + " are disabled."; + message += "Updated plugins " + StringUtil.join(disabled, pluginDescriptor -> pluginDescriptor.getName(), ", ") + " are disabled."; } if (!disabledDependants.isEmpty()) { @@ -671,9 +667,7 @@ public abstract class PluginManagerMain implements Disposable { message += " plugin '" + disabledDependants.iterator().next().getName() + "'."; } else { - message += " plugins " + StringUtil.join(disabledDependants, pluginDescriptor -> { - return pluginDescriptor.getName(); - }, ", ") + "."; + message += " plugins " + StringUtil.join(disabledDependants, pluginDescriptor -> pluginDescriptor.getName(), ", ") + "."; } } message += " Disabled plugins " + (disabled.isEmpty() ? "and plugins which depend on disabled " :"") + "won't be activated after restart."; diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java index f119fedb297d..0e8cf20906f8 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java @@ -60,12 +60,8 @@ public class PluginTable extends JBTable { protected Transferable createTransferable(JComponent c) { final IdeaPluginDescriptor[] selectedValues = getSelectedObjects(); if (selectedValues == null) return null; - final String text = StringUtil.join(selectedValues, descriptor -> { - return descriptor.getName(); - }, ", "); - final String htmlText = "\n
    \n" + StringUtil.join(selectedValues, descriptor -> { - return descriptor.getName(); - }, "\n
  • ") + "
\n\n"; + final String text = StringUtil.join(selectedValues, descriptor -> descriptor.getName(), ", "); + final String htmlText = "\n
    \n" + StringUtil.join(selectedValues, descriptor -> descriptor.getName(), "\n
  • ") + "
\n\n"; return new TextTransferable(XmlStringUtil.wrapInHtml(htmlText), text); } diff --git a/platform/platform-impl/src/com/intellij/ide/startupWizard/SelectPluginsStep.java b/platform/platform-impl/src/com/intellij/ide/startupWizard/SelectPluginsStep.java index 3445582b622f..cc6481dbd358 100644 --- a/platform/platform-impl/src/com/intellij/ide/startupWizard/SelectPluginsStep.java +++ b/platform/platform-impl/src/com/intellij/ide/startupWizard/SelectPluginsStep.java @@ -151,9 +151,7 @@ public class SelectPluginsStep extends WizardStep { requiresBuffer.append(" ("); } requiresBuffer.append("required by "); - requiresBuffer.append(StringUtil.join(requiredBy, ideaPluginDescriptor -> { - return getAbbreviatedName(ideaPluginDescriptor); - }, ", ")); + requiresBuffer.append(StringUtil.join(requiredBy, ideaPluginDescriptor -> getAbbreviatedName(ideaPluginDescriptor), ", ")); } if (requiresBuffer.length() > 0) { requiresBuffer.append(")"); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java b/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java index c03eca78eea7..eef982ae1e30 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java @@ -82,9 +82,7 @@ public class UsageTrigger implements PersistentStateComponent getUsages() { State state = getInstance().getState(); assert state != null; - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> { - return new UsageDescriptor(e.getKey(), e.getValue()); - }); + return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); } @NotNull diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java index fb1f8acbd1e0..8425febba39b 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java @@ -60,8 +60,6 @@ public class StatisticsConnectionService extends SettingsConnectionService { } final List disabledGroupsList = StringUtil.split(disabledGroupsString, ","); - return ContainerUtil.map2Set(disabledGroupsList, s -> { - return s.trim(); - }); + return ContainerUtil.map2Set(disabledGroupsList, s -> s.trim()); } } diff --git a/platform/platform-impl/src/com/intellij/notification/EventLog.java b/platform/platform-impl/src/com/intellij/notification/EventLog.java index cea4534d7925..01350d79b792 100644 --- a/platform/platform-impl/src/com/intellij/notification/EventLog.java +++ b/platform/platform-impl/src/com/intellij/notification/EventLog.java @@ -520,9 +520,7 @@ public class EventLog { @Override public void run() { if (!ShutDownTracker.isShutdownHookRunning() && !myProject.isDisposed()) { - ApplicationManager.getApplication().runReadAction(() -> { - console.doPrintNotification(notification); - }); + ApplicationManager.getApplication().runReadAction(() -> console.doPrintNotification(notification)); } } }); diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java index 14345a677cf3..514d04bbc4bf 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java @@ -152,9 +152,7 @@ public class NotificationsManagerImpl extends NotificationsManager { private static void showNotification(@NotNull final Notification notification, @Nullable final Project project) { Application application = ApplicationManager.getApplication(); if (application instanceof ApplicationEx && !((ApplicationEx)application).isLoaded()) { - application.invokeLater(() -> { - showNotification(notification, project); - }, ModalityState.current()); + application.invokeLater(() -> showNotification(notification, project), ModalityState.current()); return; } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java index 71a957703e57..bfdc747534c1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java @@ -197,9 +197,7 @@ public class MergeOperations { final ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(file); if (status.hasReadonlyFiles()) return; } - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, myModification, getName(), null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, myModification, getName(), null)); } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/Change.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/Change.java index d5886d3ed3bc..ee74b63a05aa 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/Change.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/Change.java @@ -153,9 +153,7 @@ public abstract class Change { } public static void apply(final Change change, final FragmentSide fromSide) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(change.getProject(), () -> doApply(change, fromSide), null, DiffBundle.message("save.merge.result.command.name")); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(change.getProject(), () -> doApply(change, fromSide), null, DiffBundle.message("save.merge.result.command.name"))); } public static void doApply(final Change change, final FragmentSide fromSide) { diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/ApplyNonConflicts.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/ApplyNonConflicts.java index 7a945a8dc2a1..e5f93563c54f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/ApplyNonConflicts.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/ApplyNonConflicts.java @@ -49,19 +49,17 @@ public class ApplyNonConflicts extends AnAction implements DumbAware { final List notConflicts = ContainerUtil.collect(getNotConflicts(mergeList)); final Project project = mergeList.getLeftChangeList().getProject(); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> { - mergeList.startBulkUpdate(); - try { - for (Change change : notConflicts) { - Change.doApply(change, MergeList.BRANCH_SIDE); - } + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { + mergeList.startBulkUpdate(); + try { + for (Change change : notConflicts) { + Change.doApply(change, MergeList.BRANCH_SIDE); } - finally { - mergeList.finishBulkUpdate(); - } - }, null, DiffBundle.message("save.merge.result.command.name")); - }); + } + finally { + mergeList.finishBulkUpdate(); + } + }, null, DiffBundle.message("save.merge.result.command.name"))); if (myDiffPanel != null) { myDiffPanel.requestScrollEditors(); diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeVersion.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeVersion.java index 763123002251..8071150bef85 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeVersion.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeVersion.java @@ -90,9 +90,7 @@ public interface MergeVersion { @Override public void applyText(@NotNull final String text, final Project project) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> doApplyText(text, project), "Merge changes", null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> doApplyText(text, project), "Merge changes", null)); } protected void doApplyText(@NotNull String text, Project project) { @@ -128,9 +126,7 @@ public interface MergeVersion { @Override public void restoreOriginalContent(final Project project) { - ApplicationManager.getApplication().runWriteAction(() -> { - doRestoreOriginalContent(project); - }); + ApplicationManager.getApplication().runWriteAction(() -> doRestoreOriginalContent(project)); } public static boolean isProjectFile(VirtualFile file) { diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java index f817cbfa97e3..cc3af7c825e0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java @@ -523,9 +523,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, ", document changed: " + isDocumentChanged + ", perform caret merging: " + myPerformCaretMergingAfterCurrentOperation + ", current caret: " + myCurrentCaret + - ", all carets: " + ContainerUtil.map(myCarets, caret -> { - return caret.dumpState(); - }) + "]"; + ", all carets: " + ContainerUtil.map(myCarets, caret -> caret.dumpState()) + "]"; } private static class VisualPositionComparator implements Comparator { diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoDesktopDirAction.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoDesktopDirAction.java index 48255b60a166..3f2184dd49c7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoDesktopDirAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoDesktopDirAction.java @@ -41,9 +41,7 @@ public class GotoDesktopDirAction extends FileChooserAction { protected void actionPerformed(final FileSystemTree tree, AnActionEvent e) { final VirtualFile dir = myDesktopDirectory.getValue(); if (dir != null) { - tree.select(dir, () -> { - tree.expand(dir, null); - }); + tree.select(dir, () -> tree.expand(dir, null)); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoHomeAction.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoHomeAction.java index 3363b2ba2823..519b86eaff44 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoHomeAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoHomeAction.java @@ -28,9 +28,7 @@ public final class GotoHomeAction extends FileChooserAction { protected void actionPerformed(final FileSystemTree fileSystemTree, final AnActionEvent e) { final VirtualFile userHomeDir = VfsUtil.getUserHomeDir(); if (userHomeDir != null) { - fileSystemTree.select(userHomeDir, () -> { - fileSystemTree.expand(userHomeDir, null); - }); + fileSystemTree.select(userHomeDir, () -> fileSystemTree.expand(userHomeDir, null)); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoProjectDirectory.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoProjectDirectory.java index bb4d4eb0ec31..663fa71eed2a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoProjectDirectory.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/GotoProjectDirectory.java @@ -36,9 +36,7 @@ public final class GotoProjectDirectory extends FileChooserAction { protected void actionPerformed(final FileSystemTree fileSystemTree, final AnActionEvent e) { final VirtualFile projectPath = getProjectDir(e); if (projectPath != null) { - fileSystemTree.select(projectPath, () -> { - fileSystemTree.expand(projectPath, null); - }); + fileSystemTree.select(projectPath, () -> fileSystemTree.expand(projectPath, null)); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/LocalFsFinder.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/LocalFsFinder.java index c779fc820729..2ff9bc9459c2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/LocalFsFinder.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/LocalFsFinder.java @@ -214,9 +214,7 @@ public class LocalFsFinder implements FileLookup.Finder, FileLookup { public List getChildren(final LookupFilter filter) { List result = new ArrayList(); - File[] files = myIoFile.listFiles(pathname -> { - return filter.isAccepted(new IoFile(pathname)); - }); + File[] files = myIoFile.listFiles(pathname -> filter.isAccepted(new IoFile(pathname))); if (files == null) return result; for (File each : files) { diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java index 6722933c245d..5f0a90571523 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java @@ -631,24 +631,22 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt } final Project project = ProjectLocator.getInstance().guessProjectForFile(file); - CommandProcessor.getInstance().executeCommand(project, () -> { - ApplicationManager.getApplication().runWriteAction( - new ExternalChangeAction.ExternalDocumentChange(document, project) { - @Override - public void run() { - boolean wasWritable = document.isWritable(); - DocumentEx documentEx = (DocumentEx)document; - documentEx.setReadOnly(false); - LoadTextUtil.setCharsetWasDetectedFromBytes(file, null); - file.setBOM(null); // reset BOM in case we had one and the external change stripped it away - if (!isBinaryWithoutDecompiler(file)) { - documentEx.replaceText(LoadTextUtil.loadText(file), file.getModificationStamp()); - documentEx.setReadOnly(!wasWritable); - } + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction( + new ExternalChangeAction.ExternalDocumentChange(document, project) { + @Override + public void run() { + boolean wasWritable = document.isWritable(); + DocumentEx documentEx = (DocumentEx)document; + documentEx.setReadOnly(false); + LoadTextUtil.setCharsetWasDetectedFromBytes(file, null); + file.setBOM(null); // reset BOM in case we had one and the external change stripped it away + if (!isBinaryWithoutDecompiler(file)) { + documentEx.replaceText(LoadTextUtil.loadText(file), file.getModificationStamp()); + documentEx.setReadOnly(!wasWritable); } } - ); - }, UIBundle.message("file.cache.conflict.action"), null, UndoConfirmationPolicy.REQUEST_CONFIRMATION); + } + ), UIBundle.message("file.cache.conflict.action"), null, UndoConfirmationPolicy.REQUEST_CONFIRMATION); myUnsavedDocuments.remove(document); @@ -829,9 +827,7 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt LOG.warn(exception); } - final String text = StringUtil.join(failures.values(), e -> { - return e.getMessage(); - }, "\n"); + final String text = StringUtil.join(failures.values(), e -> e.getMessage(), "\n"); final DialogWrapper dialog = new DialogWrapper(null) { { diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/http/HttpFileEditor.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/http/HttpFileEditor.java index 9b269ef1518c..5948768fe571 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/http/HttpFileEditor.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/http/HttpFileEditor.java @@ -41,9 +41,7 @@ class HttpFileEditor extends BaseRemoteFileEditor { RemoteFileInfo fileInfo = virtualFile.getFileInfo(); assert fileInfo != null; fileInfo.download() - .done(file -> ApplicationManager.getApplication().invokeLater(() -> { - contentLoaded(); - }, myProject.getDisposed())) + .done(file -> ApplicationManager.getApplication().invokeLater(() -> contentLoaded(), myProject.getDisposed())) .rejected(throwable -> contentRejected()); } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FileTypeChooser.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FileTypeChooser.java index 538c874ffb4f..d7daa896a5b1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FileTypeChooser.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FileTypeChooser.java @@ -163,9 +163,7 @@ public class FileTypeChooser extends DialogWrapper { final FileType type = chooser.getSelectedType(); if (type == FileTypes.UNKNOWN || type == null) return null; - ApplicationManager.getApplication().runWriteAction(() -> { - FileTypeManagerEx.getInstanceEx().associatePattern(type, (String)chooser.myPattern.getSelectedItem()); - }); + ApplicationManager.getApplication().runWriteAction(() -> FileTypeManagerEx.getInstanceEx().associatePattern(type, (String)chooser.myPattern.getSelectedItem())); return type; } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/ApproveRemovedMappingsActivity.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/ApproveRemovedMappingsActivity.java index 06a901334aba..5a8ad8a2eb27 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/ApproveRemovedMappingsActivity.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/ApproveRemovedMappingsActivity.java @@ -67,9 +67,7 @@ public class ApproveRemovedMappingsActivity implements StartupActivity { } }); Notifications.Bus.notify(notification, project); - ApplicationManager.getApplication().runWriteAction(() -> { - FileTypeManager.getInstance().associate(fileType, matcher); - }); + ApplicationManager.getApplication().runWriteAction(() -> FileTypeManager.getInstance().associate(fileType, matcher)); iterator.remove(); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java index f5cd0f46744a..9a2ea5e43613 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java @@ -434,9 +434,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent } } if (!changed.isEmpty()) { - ApplicationManager.getApplication().invokeLater(() -> { - FileContentUtilCore.reparseFiles(changed); - }, ApplicationManager.getApplication().getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> FileContentUtilCore.reparseFiles(changed), ApplicationManager.getApplication().getDisposed()); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java index bff00c54c35f..870f3e0defa3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/impl/ProgressManagerImpl.java @@ -138,9 +138,7 @@ public class ProgressManagerImpl extends CoreProgressManager implements Disposab final long time = end - start; if (canceled || progressIndicator.isCanceled()) { - ApplicationManager.getApplication().invokeLater(() -> { - task.onCancel(); - }, modalityState); + ApplicationManager.getApplication().invokeLater(() -> task.onCancel(), modalityState); } else { final Task.NotificationInfo notificationInfo = task.notifyFinished(); @@ -150,9 +148,7 @@ public class ProgressManagerImpl extends CoreProgressManager implements Disposab systemNotify(notificationInfo); } } - ApplicationManager.getApplication().invokeLater(() -> { - task.onSuccess(); - }, modalityState); + ApplicationManager.getApplication().invokeLater(() -> task.onSuccess(), modalityState); } } }; diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/BackgroundTaskUtil.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/BackgroundTaskUtil.java index b5f7e878c2d1..7e256051cd5d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/util/BackgroundTaskUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/BackgroundTaskUtil.java @@ -103,9 +103,7 @@ public class BackgroundTaskUtil { } if (!resultRef.compareAndSet(null, callback)) { - ApplicationManager.getApplication().invokeLater(() -> { - finish(callback, indicator); - }, modality); + ApplicationManager.getApplication().invokeLater(() -> finish(callback, indicator), modality); } semaphore.release(); }, indicator)); diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java index c2694b0c631b..4df6e997fe99 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java @@ -216,9 +216,7 @@ class ProgressDialog implements Disposable { void enableCancelButtonIfNeeded(final boolean enable) { if (myProgressWindow.myShouldShowCancel) { - ApplicationManager.getApplication().invokeLater(() -> { - myCancelButton.setEnabled(enable); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> myCancelButton.setEnabled(enable), ModalityState.any()); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java index 0cdbc2640722..116cbfc4aa56 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java @@ -403,9 +403,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements Disposable { } if (!project.isOpen()) { WelcomeFrame.showIfNoProjectOpened(); - ApplicationManager.getApplication().runWriteAction(() -> { - Disposer.dispose(project); - }); + ApplicationManager.getApplication().runWriteAction(() -> Disposer.dispose(project)); } return project; } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/ex/MessagesEx.java b/platform/platform-impl/src/com/intellij/openapi/ui/ex/MessagesEx.java index 57de3a1cf991..8c38b7165bb6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/ex/MessagesEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/ex/MessagesEx.java @@ -163,9 +163,7 @@ public class MessagesEx extends Messages { } public void showLater() { - ApplicationManager.getApplication().invokeLater(() -> { - showNow(); - }, ApplicationManager.getApplication().getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> showNow(), ApplicationManager.getApplication().getDisposed()); } @YesNoResult diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java index abfc60a24ab7..ebaab9fa065b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java @@ -42,9 +42,7 @@ public class AlphaNumericTypeCommand extends TypeCommand { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> { TypingTarget typingTarget = findTarget(context); if (typingTarget != null) { - typingTarget.type(text).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(() -> { - typeByRobot(context.getRobot(), text).notify(result); - }); + typingTarget.type(text).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(() -> typeByRobot(context.getRobot(), text).notify(result)); } else { typeByRobot(context.getRobot(), text).notify(result); } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java index 18e239a948cc..dd5558573d3b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java @@ -63,9 +63,7 @@ public class KeyCodeTypeCommand extends AlphaNumericTypeCommand { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> { TypingTarget typingTarget = findTarget(context); if (typingTarget != null) { - typingTarget.type(unicode).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(() -> { - typeCodes(context, context.getRobot(), codes).notify(result); - }); + typingTarget.type(unicode).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(() -> typeCodes(context, context.getRobot(), codes).notify(result)); } else { typeCodes(context, context.getRobot(), codes).notify(result); } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/EditorPlaybackCall.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/EditorPlaybackCall.java index b30378bb6ac3..74da6b2387ff 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/EditorPlaybackCall.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/EditorPlaybackCall.java @@ -66,9 +66,7 @@ public class EditorPlaybackCall { public static AsyncResult waitDaemonForFinish(final PlaybackContext context) { final AsyncResult result = new AsyncResult(); final Disposable connection = Disposer.newDisposable(); - result.doWhenProcessed(() -> { - Disposer.dispose(connection); - }); + result.doWhenProcessed(() -> Disposer.dispose(connection)); WindowSystemPlaybackCall.findProject().doWhenDone(new Consumer() { @@ -87,9 +85,7 @@ public class EditorPlaybackCall { } }); } - }).doWhenRejected(() -> { - result.setRejected("Cannot find project"); - }); + }).doWhenRejected(() -> result.setRejected("Cannot find project")); return result; } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/WindowSystemPlaybackCall.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/WindowSystemPlaybackCall.java index d8d8fe863a7e..024687f94036 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/WindowSystemPlaybackCall.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/util/WindowSystemPlaybackCall.java @@ -140,13 +140,9 @@ public class WindowSystemPlaybackCall { return; } - toolWindow.getReady(context).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(() -> { - result.setRejected("Cannot activate tool window with id:" + id); - }); + toolWindow.getReady(context).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(() -> result.setRejected("Cannot activate tool window with id:" + id)); } - }).doWhenRejected(() -> { - result.setRejected("Cannot retrieve open project"); - }); + }).doWhenRejected(() -> result.setRejected("Cannot retrieve open project")); return result; } @@ -197,9 +193,7 @@ public class WindowSystemPlaybackCall { return; } selectNext(context, path.split("\\|"), 0, selectedPath[0].getSubElements(), result); - })).doWhenRejected(() -> { - result.setRejected("Cannot invoke popup menu from the ShowPopupMenu action, action call rejected"); - }); + })).doWhenRejected(() -> result.setRejected("Cannot invoke popup menu from the ShowPopupMenu action, action call rejected")); }); return result; diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckerComponent.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckerComponent.java index ad7fdb6b52ce..fa475ca97701 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckerComponent.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckerComponent.java @@ -89,9 +89,7 @@ public class UpdateCheckerComponent implements ApplicationComponent { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) { notification.expire(); - app.invokeLater(() -> { - ShowSettingsUtil.getInstance().showSettingsDialog(null, UpdateSettingsConfigurable.class); - }, ModalityState.NON_MODAL); + app.invokeLater(() -> ShowSettingsUtil.getInstance().showSettingsDialog(null, UpdateSettingsConfigurable.class), ModalityState.NON_MODAL); } }).notify(null); } diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java index 1b4266f57e16..d687a206ccd4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java @@ -324,9 +324,7 @@ public class PluginsAdvertiser implements StartupActivity { } } - ApplicationManager.getApplication().invokeLater(() -> { - onSuccess(); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> onSuccess(), ModalityState.NON_MODAL); } catch (Exception e) { diff --git a/platform/platform-impl/src/com/intellij/openapi/util/RequestsMerger.java b/platform/platform-impl/src/com/intellij/openapi/util/RequestsMerger.java index c38697b60e5a..5917b2fb7340 100644 --- a/platform/platform-impl/src/com/intellij/openapi/util/RequestsMerger.java +++ b/platform/platform-impl/src/com/intellij/openapi/util/RequestsMerger.java @@ -114,9 +114,7 @@ public class RequestsMerger { LOG.debug("doAction: oldState: " + oldState.name() + ", newState: " + myState.name()); if (LOG.isDebugEnabled() && exitActions != null) { - final String debugExitActions = StringUtil.join(exitActions, exitAction -> { - return exitAction.name(); - }, " "); + final String debugExitActions = StringUtil.join(exitActions, exitAction -> exitAction.name(), " "); LOG.debug("exit actions: " + debugExitActions); } if (exitActions != null) { diff --git a/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/ReadOnlyStatusDialog.java b/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/ReadOnlyStatusDialog.java index 2bbf1943946a..5eacb84780f2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/ReadOnlyStatusDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/ReadOnlyStatusDialog.java @@ -173,9 +173,7 @@ public class ReadOnlyStatusDialog extends OptionsDialog { super.doOKAction(); } else { - String list = StringUtil.join(files, info -> { - return info.getFile().getPresentableUrl(); - }, "
"); + String list = StringUtil.join(files, info -> info.getFile().getPresentableUrl(), "
"); String message = VcsBundle.message("handle.ro.file.status.failed", list); Messages.showErrorDialog(getRootPane(), message, VcsBundle.message("dialog.title.clear.read.only.file.status")); myFiles = files.toArray(new FileInfo[files.size()]); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java index 922244c86214..4d8b601f3323 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java @@ -110,9 +110,7 @@ public class JarFileSystemImpl extends JarFileSystem { @NotNull @Override protected JarHandler getHandler(@NotNull VirtualFile entryFile) { - return VfsImplUtil.getHandler(this, entryFile, localPath -> { - return new JarHandler(localPath); - }); + return VfsImplUtil.getHandler(this, entryFile, localPath -> new JarHandler(localPath)); } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java index eb6c7fd564ef..da2537bab6c0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java @@ -155,9 +155,7 @@ public class FileWatcher { if (myFailureShown.compareAndSet(false, true)) { String title = ApplicationBundle.message("watcher.slow.sync"); - ApplicationManager.getApplication().invokeLater(() -> { - Notifications.Bus.notify(NOTIFICATION_GROUP.getValue().createNotification(title, cause, NotificationType.WARNING, listener)); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> Notifications.Bus.notify(NOTIFICATION_GROUP.getValue().createNotification(title, cause, NotificationType.WARNING, listener)), ModalityState.NON_MODAL); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java index 3c11eb142bd9..4d389bf679db 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java @@ -126,9 +126,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone if (!areChildrenLoaded(id)) { nameIds = persistAllChildren(file, id, nameIds); } - return ContainerUtil.map2Array(nameIds, String.class, id1 -> { - return id1.name.toString(); - }); + return ContainerUtil.map2Array(nameIds, String.class, id1 -> id1.name.toString()); } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java index 79f9f74ff949..878ead5989b9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java @@ -236,9 +236,7 @@ final class PaintersHelper implements Painter.Listener { : new File(PathManager.getConfigPath(), filePath)).toURI().toURL(); ApplicationManager.getApplication().executeOnPooledThread(() -> { final Image m = ImageLoader.loadFromUrl(url); - ApplicationManager.getApplication().invokeLater(() -> { - resetImage(propertyValue, m, newAlpha, newFillType, newPlace); - }, modalityState); + ApplicationManager.getApplication().invokeLater(() -> resetImage(propertyValue, m, newAlpha, newFillType, newPlace), modalityState); }); } catch (Exception e) { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java index bb2657158e14..e21c0dd71867 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java @@ -154,9 +154,7 @@ public class RecentProjectPanel extends JPanel { if (selection != null && selection.length > 0) { final int rc = Messages.showOkCancelDialog(RecentProjectPanel.this, - "Remove '" + StringUtil.join(selection, action -> { - return ((AnAction)action).getTemplatePresentation().getText(); - }, "'\n'") + + "Remove '" + StringUtil.join(selection, action -> ((AnAction)action).getTemplatePresentation().getText(), "'\n'") + "' from recent projects list?", "Remove Recent Project", Messages.getQuestionIcon()); diff --git a/platform/platform-impl/src/com/intellij/patterns/compiler/PatternCompilerImpl.java b/platform/platform-impl/src/com/intellij/patterns/compiler/PatternCompilerImpl.java index e830d723c523..21290775b2b7 100644 --- a/platform/platform-impl/src/com/intellij/patterns/compiler/PatternCompilerImpl.java +++ b/platform/platform-impl/src/com/intellij/patterns/compiler/PatternCompilerImpl.java @@ -333,9 +333,7 @@ public class PatternCompilerImpl implements PatternCompiler { throw e.getTargetException(); } } - throw new NoSuchMethodException("unknown symbol: " + methodName + "(" + StringUtil.join(arguments, o -> { - return String.valueOf(o); - }, ", ") + ")"); + throw new NoSuchMethodException("unknown symbol: " + methodName + "(" + StringUtil.join(arguments, o -> String.valueOf(o), ", ") + ")"); } @Nullable diff --git a/platform/platform-impl/src/com/intellij/platform/OpenDirectoryProjectAction.java b/platform/platform-impl/src/com/intellij/platform/OpenDirectoryProjectAction.java index f59fb8fe89f7..49073499feeb 100644 --- a/platform/platform-impl/src/com/intellij/platform/OpenDirectoryProjectAction.java +++ b/platform/platform-impl/src/com/intellij/platform/OpenDirectoryProjectAction.java @@ -36,8 +36,6 @@ public class OpenDirectoryProjectAction extends AnAction implements DumbAware { final FileChooserDescriptor descriptor = new OpenProjectFileChooserDescriptor(false); final Project project = e.getData(CommonDataKeys.PROJECT); - FileChooser.chooseFiles(descriptor, project, null, files -> { - PlatformProjectOpenProcessor.getInstance().doOpenProject(files.get(0), project, false); - }); + FileChooser.chooseFiles(descriptor, project, null, files -> PlatformProjectOpenProcessor.getInstance().doOpenProject(files.get(0), project, false)); } } diff --git a/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.java b/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.java index e9537c2ecc7b..2b41b54cd852 100644 --- a/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.java +++ b/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.java @@ -217,9 +217,7 @@ public class PlatformProjectOpenProcessor extends ProjectOpenProcessor { if (!projectManager.openProject(project)) { WelcomeFrame.showIfNoProjectOpened(); final Project finalProject = project; - ApplicationManager.getApplication().runWriteAction(() -> { - Disposer.dispose(finalProject); - }); + ApplicationManager.getApplication().runWriteAction(() -> Disposer.dispose(finalProject)); return project; } diff --git a/platform/platform-impl/src/com/intellij/platform/ProjectSetReader.java b/platform/platform-impl/src/com/intellij/platform/ProjectSetReader.java index 4df25b39d51e..44a7ba41303b 100644 --- a/platform/platform-impl/src/com/intellij/platform/ProjectSetReader.java +++ b/platform/platform-impl/src/com/intellij/platform/ProjectSetReader.java @@ -64,9 +64,7 @@ public class ProjectSetReader { if (object.entrySet().size() == 1 && object.entrySet().iterator().next().getValue().isJsonArray()) { final Map.Entry next = object.entrySet().iterator().next(); list = ContainerUtil.map(next.getValue().getAsJsonArray(), - o -> { - return Pair.create(next.getKey(), getString(o)); - }); + o -> Pair.create(next.getKey(), getString(o))); } else { list = ContainerUtil.map(object.entrySet(), entry1 -> { diff --git a/platform/platform-impl/src/com/intellij/psi/statistics/impl/StatisticsManagerImpl.java b/platform/platform-impl/src/com/intellij/psi/statistics/impl/StatisticsManagerImpl.java index b25e130ea5e4..f9e6e7c31d01 100644 --- a/platform/platform-impl/src/com/intellij/psi/statistics/impl/StatisticsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/psi/statistics/impl/StatisticsManagerImpl.java @@ -116,9 +116,7 @@ public class StatisticsManagerImpl extends StatisticsManager { synchronized (LOCK) { strings = getUnit(getUnitNumber(context)).getKeys2(context); } - return ContainerUtil.map2Array(strings, StatisticsInfo.class, (NotNullFunction)s -> { - return new StatisticsInfo(context, s); - }); + return ContainerUtil.map2Array(strings, StatisticsInfo.class, (NotNullFunction)s -> new StatisticsInfo(context, s)); } public void save() { diff --git a/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java b/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java index 8cf9259d139e..95f7b24eac8a 100644 --- a/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java +++ b/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java @@ -177,14 +177,12 @@ public class EditorComboBox extends JComboBox implements DocumentListener { } public void setText(final String text) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - myDocument.replaceString(0, myDocument.getTextLength(), text); - if (myEditorField != null && myEditorField.getEditor() != null) { - myEditorField.getCaretModel().moveToOffset(myDocument.getTextLength()); - } - }, null, myDocument); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + myDocument.replaceString(0, myDocument.getTextLength(), text); + if (myEditorField != null && myEditorField.getEditor() != null) { + myEditorField.getCaretModel().moveToOffset(myDocument.getTextLength()); + } + }, null, myDocument)); } public void removeSelection() { diff --git a/platform/platform-impl/src/com/intellij/ui/EditorTextField.java b/platform/platform-impl/src/com/intellij/ui/EditorTextField.java index 65ceeaf1fb9b..4f8a74950f87 100644 --- a/platform/platform-impl/src/com/intellij/ui/EditorTextField.java +++ b/platform/platform-impl/src/com/intellij/ui/EditorTextField.java @@ -244,17 +244,15 @@ public class EditorTextField extends NonOpaquePanel implements DocumentListener, } public void setText(@Nullable final String text) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - myDocument.replaceString(0, myDocument.getTextLength(), text == null ? "" : text); - if (myEditor != null) { - final CaretModel caretModel = myEditor.getCaretModel(); - if (caretModel.getOffset() >= myDocument.getTextLength()) { - caretModel.moveToOffset(myDocument.getTextLength()); - } + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + myDocument.replaceString(0, myDocument.getTextLength(), text == null ? "" : text); + if (myEditor != null) { + final CaretModel caretModel = myEditor.getCaretModel(); + if (caretModel.getOffset() >= myDocument.getTextLength()) { + caretModel.moveToOffset(myDocument.getTextLength()); } - }, null, null, UndoConfirmationPolicy.DEFAULT, getDocument()); - }); + } + }, null, null, UndoConfirmationPolicy.DEFAULT, getDocument())); } /** diff --git a/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java b/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java index 86a3498ea930..61a8a7afe30b 100644 --- a/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java +++ b/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java @@ -216,16 +216,14 @@ public class FocusTrackback { final IdeFocusManager focusManager = IdeFocusManager.getInstance(project); cleanParentWindow(); final Project finalProject = project; - focusManager.requestFocus(new MyFocusCommand(), myForcedRestore).doWhenProcessed(() -> dispose()).doWhenRejected(() -> { - focusManager.revalidateFocus(new ExpirableRunnable.ForProject(finalProject) { - @Override - public void run() { - if (UIUtil.isMeaninglessFocusOwner(focusManager.getFocusOwner())) { - focusManager.requestDefaultFocus(false); - } + focusManager.requestFocus(new MyFocusCommand(), myForcedRestore).doWhenProcessed(() -> dispose()).doWhenRejected(() -> focusManager.revalidateFocus(new ExpirableRunnable.ForProject(finalProject) { + @Override + public void run() { + if (UIUtil.isMeaninglessFocusOwner(focusManager.getFocusOwner())) { + focusManager.requestDefaultFocus(false); } - }); - }); + } + })); } else { // no ide focus manager, so no way -- do just later diff --git a/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java b/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java index 68d8bd86a2e1..124c8226eb8a 100644 --- a/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java +++ b/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java @@ -31,9 +31,7 @@ public class TableSpeedSearch extends SpeedSearchBase { } public TableSpeedSearch(JTable table, final Convertor toStringConvertor) { - this(table, (o, c) -> { - return toStringConvertor.convert(o); - }); + this(table, (o, c) -> toStringConvertor.convert(o)); } public TableSpeedSearch(JTable table, final PairFunction toStringConvertor) { diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacFileChooserDialogImpl.java b/platform/platform-impl/src/com/intellij/ui/mac/MacFileChooserDialogImpl.java index 376dbbe13d49..c6b5cdcdc52a 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacFileChooserDialogImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacFileChooserDialogImpl.java @@ -145,19 +145,15 @@ public class MacFileChooserDialogImpl implements PathChooserDialog { final List resultPaths = processResult(returnCode, openPanelDidEnd); if (resultPaths.size() > 0) { - ApplicationManager.getApplication().invokeLater(() -> { - DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, () -> { - final List files = getChosenFiles(resultPaths); - if (files.size() > 0) { - FileChooserUtil.setLastOpenedFile(impl.myProject, files.get(files.size() - 1)); - impl.myCallback.consume(files); - } - }); - }, impl.myModalityState); + ApplicationManager.getApplication().invokeLater(() -> DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, () -> { + final List files = getChosenFiles(resultPaths); + if (files.size() > 0) { + FileChooserUtil.setLastOpenedFile(impl.myProject, files.get(files.size() - 1)); + impl.myCallback.consume(files); + } + }), impl.myModalityState); } else if (impl.myCallback instanceof FileChooser.FileChooserConsumer) { - ApplicationManager.getApplication().invokeLater(() -> { - ((FileChooser.FileChooserConsumer)impl.myCallback).cancelled(); - }, impl.myModalityState); + ApplicationManager.getApplication().invokeLater(() -> ((FileChooser.FileChooserConsumer)impl.myCallback).cancelled(), impl.myModalityState); } } finally { diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index a5ab5dd9a805..b1c304c1d975 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -1004,9 +1004,7 @@ public class AbstractPopup implements JBPopup { return result; } - }, true).doWhenRejected(() -> { - afterShow.run(); - }); + }, true).doWhenRejected(() -> afterShow.run()); } else { //noinspection SSBasedInspection SwingUtilities.invokeLater(() -> { diff --git a/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java index fd858b29046d..5239b8b7aceb 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java @@ -359,9 +359,7 @@ public class PopupFactoryImpl extends JBPopupFactory { final ActionPopupStep actionPopupStep = ObjectUtils.tryCast(listStep, ActionPopupStep.class); if (actionPopupStep == null) return; - List filtered = ContainerUtil.mapNotNull(selectedValues, o -> { - return getActionByClass(o, actionPopupStep, ToggleAction.class); - }); + List filtered = ContainerUtil.mapNotNull(selectedValues, o -> getActionByClass(o, actionPopupStep, ToggleAction.class)); for (ToggleAction action : filtered) { actionPopupStep.performAction(action, 0); diff --git a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java index 96157243ac3d..ac4a5955e831 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java +++ b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java @@ -224,9 +224,7 @@ public class SwingHelper { setPreferredWidthToFitText((JTextField)component); } } - ApplicationManager.getApplication().invokeLater(() -> { - adjustDialogSizeToFitPreferredSize(dialogWrapper); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> adjustDialogSizeToFitPreferredSize(dialogWrapper), ModalityState.any()); } }); } diff --git a/platform/platform-tests/testSrc/com/intellij/application/options/codeInsight/editor/quotes/SelectionQuotingTypedHandlerTest.java b/platform/platform-tests/testSrc/com/intellij/application/options/codeInsight/editor/quotes/SelectionQuotingTypedHandlerTest.java index 08f095c3c6ab..30a31c8c99d2 100644 --- a/platform/platform-tests/testSrc/com/intellij/application/options/codeInsight/editor/quotes/SelectionQuotingTypedHandlerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/application/options/codeInsight/editor/quotes/SelectionQuotingTypedHandlerTest.java @@ -40,9 +40,7 @@ public class SelectionQuotingTypedHandlerTest extends LightPlatformCodeInsightFi * @param action Runnable to be executed */ public static void performAction(final Project project, final Runnable action) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, action, "test command", null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, action, "test command", null)); } @Override diff --git a/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java b/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java index 17255780614b..519837cf7aba 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java @@ -57,9 +57,7 @@ public class AnsiEscapeDecoderTest extends PlatformTestCase { @NotNull private static List> toListWithKeyName(@NotNull Collection> list) { - return ContainerUtil.map(list, pair -> { - return Pair.create(pair.first, pair.second.toString()); - }); + return ContainerUtil.map(list, pair -> Pair.create(pair.first, pair.second.toString())); } private static AnsiEscapeDecoder.ColoredChunksAcceptor createExpectedAcceptor(@NotNull final Pair... expected) { diff --git a/platform/platform-tests/testSrc/com/intellij/formatting/TestFormattingModel.java b/platform/platform-tests/testSrc/com/intellij/formatting/TestFormattingModel.java index 9dc7bf9e4a8e..69130f7c9fb5 100644 --- a/platform/platform-tests/testSrc/com/intellij/formatting/TestFormattingModel.java +++ b/platform/platform-tests/testSrc/com/intellij/formatting/TestFormattingModel.java @@ -65,9 +65,7 @@ public class TestFormattingModel implements FormattingModel, FormattingDocumentM final String whiteSpace ) { if (ApplicationManager.getApplication() != null) { - WriteCommandAction.runWriteCommandAction(null, () -> { - myDocument.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), whiteSpace); - }); + WriteCommandAction.runWriteCommandAction(null, () -> myDocument.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), whiteSpace)); } else { myDocument.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), whiteSpace); } diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/BasicsTest.java b/platform/platform-tests/testSrc/com/intellij/history/integration/BasicsTest.java index 8ed0a32c0f17..820b09256a88 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/BasicsTest.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/BasicsTest.java @@ -38,16 +38,14 @@ public class BasicsTest extends IntegrationTestCase { public void testProcessingCommands() throws Exception { final VirtualFile[] f = new VirtualFile[1]; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(myProject, new RunnableAdapter() { - @Override - public void doRun() throws IOException { - f[0] = createChildData(myRoot, "f1.txt"); - f[0].setBinaryContent(new byte[]{1}); - f[0].setBinaryContent(new byte[]{2}); - } - }, "name", null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myProject, new RunnableAdapter() { + @Override + public void doRun() throws IOException { + f[0] = createChildData(myRoot, "f1.txt"); + f[0].setBinaryContent(new byte[]{1}); + f[0].setBinaryContent(new byte[]{2}); + } + }, "name", null)); assertEquals(2, getRevisionsFor(f[0]).size()); diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/IntegrationTestCase.java b/platform/platform-tests/testSrc/com/intellij/history/integration/IntegrationTestCase.java index 3f03a3e9d2cb..c79d0f4bc60a 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/IntegrationTestCase.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/IntegrationTestCase.java @@ -144,9 +144,7 @@ public abstract class IntegrationTestCase extends PlatformTestCase { protected void setDocumentTextFor(VirtualFile f, String text) { Document document = FileDocumentManager.getInstance().getDocument(f); assertNotNull(f.getPath(), document); - ApplicationManager.getApplication().runWriteAction(() -> { - document.setText(text); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.setText(text)); } protected LocalHistoryFacade getVcs() { @@ -174,9 +172,7 @@ public abstract class IntegrationTestCase extends PlatformTestCase { } protected static void addContentRoot(final Module module, final String path) { - ApplicationManager.getApplication().runWriteAction(() -> { - ModuleRootModificationUtil.addContentRoot(module, FileUtil.toSystemIndependentName(path)); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModuleRootModificationUtil.addContentRoot(module, FileUtil.toSystemIndependentName(path))); } protected void addExcludedDir(final String path) { diff --git a/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java b/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java index c4e1f48a0769..65baedbe0de0 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java @@ -99,9 +99,7 @@ public class CodeSamplesCorrectnessTest extends LightPlatformCodeInsightFixtureT @NotNull private static String formReport(@NotNull List errorReports) { - return StringUtil.join(errorReports, report -> { - return report.createReport(); - }, "\n"); + return StringUtil.join(errorReports, report -> report.createReport(), "\n"); } } diff --git a/platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/LightFileTemplatesTest.java b/platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/LightFileTemplatesTest.java index 35329f6e6793..c438f369b764 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/LightFileTemplatesTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/LightFileTemplatesTest.java @@ -141,9 +141,7 @@ public class LightFileTemplatesTest extends LightPlatformTestCase { private static void closeProject(final Project project) { if (project != null && !project.isDisposed()) { ProjectManager.getInstance().closeProject(project); - ApplicationManager.getApplication().runWriteAction(() -> { - Disposer.dispose(project); - }); + ApplicationManager.getApplication().runWriteAction(() -> Disposer.dispose(project)); } } diff --git a/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java b/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java index dc143d77f4cb..a91921d5eb41 100644 --- a/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java @@ -79,9 +79,7 @@ public class ModulePointerTest extends PlatformTestCase { assertSame(module, pointer.getModule()); assertEquals("xxx", pointer.getModuleName()); - ApplicationManager.getApplication().runWriteAction(() -> { - modifiableModel.dispose(); - }); + ApplicationManager.getApplication().runWriteAction(() -> modifiableModel.dispose()); assertNull(pointer.getModule()); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java index eabae04062c5..a28086b2dd32 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java @@ -566,12 +566,8 @@ public class ApplicationImplTest extends LightPlatformTestCase { assertFalse(ApplicationManager.getApplication().isDispatchThread()); for (int i=0; i<100;i++) { //noinspection SSBasedInspection - SwingUtilities.invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { - TimeoutUtil.sleep(20); - })); - ApplicationManager.getApplication().runReadAction(() -> { - TimeoutUtil.sleep(20); - }); + SwingUtilities.invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> TimeoutUtil.sleep(20))); + ApplicationManager.getApplication().runReadAction(() -> TimeoutUtil.sleep(20)); } } catch (Exception e) { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java index b6b7966c2000..85f187b1ce30 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java @@ -288,9 +288,7 @@ public class LaterInvocatorTest extends PlatformTestCase { synchronized (this) { blockSwingThread(); SwingUtilities.invokeLater(new MyRunnable("1")); - ApplicationManager.getApplication().invokeLater(() -> { - ApplicationManager.getApplication().invokeLater(new MyRunnable("3"), ModalityState.NON_MODAL); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().invokeLater(new MyRunnable("3"), ModalityState.NON_MODAL), ModalityState.NON_MODAL); SwingUtilities.invokeLater(LEAVE_MODAL); ApplicationManager.getApplication().invokeLater(new MyRunnable("2"), ModalityState.NON_MODAL); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/DocumentTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/DocumentTest.java index 766e014dbd1d..9b462e9ff11a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/DocumentTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/DocumentTest.java @@ -85,18 +85,10 @@ public class DocumentTest extends LightPlatformTestCase { mustThrow(() -> doc.insertString(1, "x")); mustThrow(() -> doc.deleteString(1, 2)); mustThrow(() -> doc.replaceString(1, 2, "s")); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - doc.insertString(1,"s"); - }); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - doc.deleteString(1,2); - }); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - doc.replaceString(1,2,"xxx"); - }); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - doc.setText("sss"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.insertString(1, "s")); + WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.deleteString(1, 2)); + WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.replaceString(1, 2, "xxx")); + WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.setText("sss")); DocumentImpl console = new DocumentImpl("xxxx", true); // need no stinking command diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java index 5e9488e60b61..7fcc8b0c6d24 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java @@ -46,9 +46,7 @@ public class FoldingTest extends AbstractEditorTest { myModel.addFoldRegion(5, 9, "/*...*/"); }); assertSize(2, myModel.getAllFoldRegions()); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().deleteString(0, 5); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().deleteString(0, 5)); assertSize(1, myModel.getAllFoldRegions()); } @@ -172,9 +170,7 @@ public class FoldingTest extends AbstractEditorTest { addCollapsedFoldRegion(0, 10, "..."); addCollapsedFoldRegion(1, 9, "..."); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().deleteString(0, 1); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().deleteString(0, 1)); addFoldRegion(20, 21, "..."); // an arbitrary action to rebuild folding caches @@ -186,9 +182,7 @@ public class FoldingTest extends AbstractEditorTest { addFoldRegion(0, 4, "..."); assertNumberOfValidFoldRegions(2); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().deleteString(4, 5); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().deleteString(4, 5)); assertNumberOfValidFoldRegions(1); @@ -197,9 +191,7 @@ public class FoldingTest extends AbstractEditorTest { public void testTopLevelRegionRemainsTopLevelAfterMergingIdenticalRegions() { addCollapsedFoldRegion(10, 15, "..."); addCollapsedFoldRegion(10, 14, "..."); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().deleteString(14, 15); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().deleteString(14, 15)); FoldRegion region = myModel.getCollapsedRegionAtOffset(10); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java index b816f326af19..b2401b463938 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java @@ -352,7 +352,7 @@ public class EditorImplTest extends AbstractEditorTest { myEditor.getCaretModel().addCaretListener(caretListener); myEditor.getSelectionModel().addSelectionListener(selectionListener); ((DocumentEx)myEditor.getDocument()).setInBulkUpdate(true); - WriteCommandAction.runWriteCommandAction(ourProject, () -> {myEditor.getDocument().insertString(0, " ");}); + WriteCommandAction.runWriteCommandAction(ourProject, () -> myEditor.getDocument().insertString(0, " ")); assertEquals("", output.toString()); ((DocumentEx)myEditor.getDocument()).setInBulkUpdate(false); myEditor.getSelectionModel().removeSelectionListener(selectionListener); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/TrailingSpacesStripperTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/TrailingSpacesStripperTest.java index 1d4c95a9f1df..b27a9375a542 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/TrailingSpacesStripperTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/TrailingSpacesStripperTest.java @@ -174,9 +174,7 @@ public class TrailingSpacesStripperTest extends LightPlatformCodeInsightTestCase Document document = configureFromFileText("x.txt", "xxx \nyyy\n\t\t\t"); // make any modification, so that Document and file content differ. Otherwise save won't be, and "on-save" actions won't be called. WriteCommandAction.runWriteCommandAction(getProject(), - () -> { - document.insertString(0, " "); - }); + () -> document.insertString(0, " ")); FileDocumentManager.getInstance().saveAllDocuments(); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java index 0cb8d8022c60..f24f26e3ef94 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java @@ -727,9 +727,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT addCollapsedFoldRegion(foldStartOffset, foldEndOffset, "..."); // Simulate addition of the new import that modifies existing fold region. - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().insertString(foldEndOffset, "\nimport java.util.Date;\n"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().insertString(foldEndOffset, "\nimport java.util.Date;\n")); final FoldingModel foldingModel = myEditor.getFoldingModel(); foldingModel.runBatchFoldingOperation(() -> { @@ -761,9 +759,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT addCollapsedFoldRegion(foldStartOffset, foldEndOffset, "..."); int modificationOffset = text.indexOf("java.util.Set"); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().insertString(modificationOffset, "import java.util.HashSet;\n"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().insertString(modificationOffset, "import java.util.HashSet;\n")); // Used to get StackOverflowError here, hence, no additional checking is performed. } @@ -840,9 +836,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT final EditorSettings settings = getEditor().getSettings(); settings.setUseSoftWraps(false); int startOffset = text.indexOf("\t third") - 1; - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - getEditor().getDocument().deleteString(startOffset, text.length()); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> getEditor().getDocument().deleteString(startOffset, text.length())); // Enable soft wraps and ensure that the cache is correctly re-built. @@ -1054,9 +1048,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT addCollapsedFoldRegion(4, 8, "..."); addCollapsedFoldRegion(13, 15, "..."); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - myEditor.getDocument().insertString(10, "C"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> myEditor.getDocument().insertString(10, "C")); // verify that cached layout data is intact after document change and position recalculation is done correctly @@ -1133,9 +1125,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT configureSoftWraps(100); addCollapsedFoldRegion(0, 4, "..."); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - ((DocumentEx)myEditor.getDocument()).moveText(0, 4, 12); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> ((DocumentEx)myEditor.getDocument()).moveText(0, 4, 12)); assertEquals(new LogicalPosition(2, 0), myEditor.visualToLogicalPosition(new VisualPosition(2, 1))); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/view/LogicalPositionCacheStressTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/view/LogicalPositionCacheStressTest.java index 0598cb58443c..42265f27fd7a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/view/LogicalPositionCacheStressTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/view/LogicalPositionCacheStressTest.java @@ -93,9 +93,7 @@ public class LogicalPositionCacheStressTest extends AbstractEditorTest { Document document = editor.getDocument(); int offset = random.nextInt(document.getTextLength() + 1); CharSequence text = generateText(random); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(offset, text); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(offset, text)); } } @@ -107,9 +105,7 @@ public class LogicalPositionCacheStressTest extends AbstractEditorTest { if (textLength <= 0) return; int from = random.nextInt(textLength + 1); int to = random.nextInt(textLength + 1); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.deleteString(Math.min(from, to), Math.max(from, to)); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.deleteString(Math.min(from, to), Math.max(from, to))); } } @@ -122,9 +118,7 @@ public class LogicalPositionCacheStressTest extends AbstractEditorTest { int from = random.nextInt(textLength + 1); int to = random.nextInt(textLength + 1); CharSequence text = generateText(random); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.replaceString(Math.min(from, to), Math.max(from, to), text); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.replaceString(Math.min(from, to), Math.max(from, to), text)); } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/richcopy/SyntaxInfoConstructionTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/richcopy/SyntaxInfoConstructionTest.java index cb0a0b795e49..8e664e73d044 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/richcopy/SyntaxInfoConstructionTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/richcopy/SyntaxInfoConstructionTest.java @@ -380,9 +380,7 @@ public class SyntaxInfoConstructionTest extends LightPlatformCodeInsightFixtureT myFixture.configureByText(getTestName(true) + ".java", ""); final DocumentImpl document = (DocumentImpl)myFixture.getEditor().getDocument(); document.setAcceptSlashR(true); - ApplicationManager.getApplication().runWriteAction(() -> { - document.setText(text); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.setText(text)); myFixture.doHighlighting(); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileDocumentManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileDocumentManagerImplTest.java index 902fe9538607..0b824e31cf71 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileDocumentManagerImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileDocumentManagerImplTest.java @@ -140,9 +140,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = createFile(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "xxx")); final Document[] unsavedDocuments = myDocumentManager.getUnsavedDocuments(); @@ -155,9 +153,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = createFile(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "xxx")); myDocumentManager.saveAllDocuments(); @@ -169,9 +165,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = createFile(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "xxx")); myDocumentManager.saveDocument(document); @@ -191,9 +185,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "xxx")); try { @@ -210,9 +202,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { assertEquals("test", new String(file.contentsToByteArray(), CharsetToolkit.UTF8_CHARSET)); } finally { - ApplicationManager.getApplication().runWriteAction(() -> { - myDocumentManager.dropAllUnsavedDocuments(); - }); + ApplicationManager.getApplication().runWriteAction(() -> myDocumentManager.dropAllUnsavedDocuments()); } } @@ -221,9 +211,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { Document document = myDocumentManager.getDocument(file); int idCode = System.identityHashCode(document); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - ObjectUtils.assertNotNull(myDocumentManager.getDocument(file)).insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> ObjectUtils.assertNotNull(myDocumentManager.getDocument(file)).insertString(0, "xxx")); //noinspection UnusedAssignment document = null; @@ -239,9 +227,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = createFile(); Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - ObjectUtils.assertNotNull(myDocumentManager.getDocument(file)).insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> ObjectUtils.assertNotNull(myDocumentManager.getDocument(file)).insertString(0, "xxx")); int idCode = System.identityHashCode(document); //noinspection UnusedAssignment @@ -270,9 +256,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final long stamp = file.getModificationStamp(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "xxx "); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "xxx ")); myDocumentManager.saveDocument(document); @@ -286,9 +270,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final long stamp = file.getModificationStamp(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "xxx "); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "xxx ")); myDocumentManager.saveAllDocuments(); Assert.assertNotEquals(stamp, file.getModificationStamp()); @@ -313,9 +295,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = new MockVirtualFile("test.txt", "test\rtest"); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "xxx "); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "xxx ")); myDocumentManager.saveAllDocuments(); assertEquals("xxx test\rtest", new String(file.contentsToByteArray(), CharsetToolkit.UTF8_CHARSET)); @@ -375,9 +355,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { }; final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "xxx"); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "xxx")); final long stamp = document.getModificationStamp(); @@ -389,9 +367,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = createFile(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "zzz"); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "zzz")); myReloadFromDisk = Boolean.TRUE; @@ -406,9 +382,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final VirtualFile file = createFile(); final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "old "); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "old ")); myReloadFromDisk = Boolean.FALSE; long oldDocumentStamp = document.getModificationStamp(); @@ -479,9 +453,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { myReloadFromDisk = Boolean.FALSE; final Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "old "); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "old ")); long documentStamp = document.getModificationStamp(); @@ -603,9 +575,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(AppTopics.FILE_DOCUMENT_SYNC, saveListener); final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(file); assertNotNull(document); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(1,"y"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(1, "y")); FileDocumentManager.getInstance().saveAllDocuments(); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java index 5c6ecae86442..024b3ee0e361 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java @@ -209,9 +209,7 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase { private void assertOpenFiles(String... fileNames) { EditorWithProviderComposite[] files = myManager.getSplitters().getEditorsComposites(); - List names = ContainerUtil.map(files, composite -> { - return composite.getFile().getName(); - }); + List names = ContainerUtil.map(files, composite -> composite.getFile().getName()); assertEquals(Arrays.asList(fileNames), names); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java index 7ac62db1a66e..c653acf45da0 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java @@ -37,12 +37,8 @@ public class FileTypeUsagesCollectorTest extends LightPlatformCodeInsightFixture assertEquals(1, usage.getValue()); } assertEquals( - ContainerUtil.map2Set(fileTypes, (NotNullFunction)fileType -> { - return fileType.getName(); - }), - ContainerUtil.map2Set(usages, (NotNullFunction)usageDescriptor -> { - return usageDescriptor.getKey(); - }) + ContainerUtil.map2Set(fileTypes, (NotNullFunction)fileType -> fileType.getName()), + ContainerUtil.map2Set(usages, (NotNullFunction)usageDescriptor -> usageDescriptor.getKey()) ); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java index d841ce8f9ce7..9d1d3cf2407c 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java @@ -75,18 +75,14 @@ public class FileTypesTest extends PlatformTestCase { @Override protected void tearDown() throws Exception { FileTypeManagerImpl.reDetectAsync(false); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.setIgnoredFilesList(myOldIgnoredFilesList); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.setIgnoredFilesList(myOldIgnoredFilesList)); super.tearDown(); } public void testMaskExclude() { final String pattern1 = "a*b.c?d"; final String pattern2 = "xxx"; - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.setIgnoredFilesList(pattern1 + ";" + pattern2); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.setIgnoredFilesList(pattern1 + ";" + pattern2)); checkIgnored("ab.cxd"); checkIgnored("axb.cxd"); checkIgnored("xxx"); @@ -100,9 +96,7 @@ public class FileTypesTest extends PlatformTestCase { } public void testExcludePerformance() { - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.setIgnoredFilesList("1*2;3*4;5*6;7*8;9*0;*1;*3;*5;*6;7*;*8*"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.setIgnoredFilesList("1*2;3*4;5*6;7*8;9*0;*1;*3;*5;*6;7*;*8*")); final String[] names = new String[100]; for (int i = 0; i < names.length; i++) { String name = String.valueOf(i % 10 * 10 + i * 100 + i + 1); @@ -143,13 +137,9 @@ public class FileTypesTest extends PlatformTestCase { public void testIgnoreOrder() { final FileTypeManagerEx manager = FileTypeManagerEx.getInstanceEx(); - ApplicationManager.getApplication().runWriteAction(() -> { - manager.setIgnoredFilesList("a;b;"); - }); + ApplicationManager.getApplication().runWriteAction(() -> manager.setIgnoredFilesList("a;b;")); assertEquals("a;b;", manager.getIgnoredFilesList()); - ApplicationManager.getApplication().runWriteAction(() -> { - manager.setIgnoredFilesList("b;a;"); - }); + ApplicationManager.getApplication().runWriteAction(() -> manager.setIgnoredFilesList("b;a;")); assertEquals("b;a;", manager.getIgnoredFilesList()); } @@ -356,9 +346,7 @@ public class FileTypesTest extends PlatformTestCase { final FileType perlFileType = myFileTypeManager.getFileTypeByFileName("foo.pl"); assertEquals("Perl", perlFileType.getName()); assertEquals(PlainTextFileType.INSTANCE, myFileTypeManager.getFileTypeByFileName("foo.cgi")); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.associatePattern(perlFileType, "*.cgi"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(perlFileType, "*.cgi")); assertEquals(perlFileType, myFileTypeManager.getFileTypeByFileName("foo.cgi")); @@ -367,9 +355,7 @@ public class FileTypesTest extends PlatformTestCase { myFileTypeManager.initComponent(); assertEquals(perlFileType, myFileTypeManager.getFileTypeByFileName("foo.cgi")); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.removeAssociatedExtension(perlFileType, "*.cgi"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.removeAssociatedExtension(perlFileType, "*.cgi")); myFileTypeManager.clearForTests(); myFileTypeManager.initStandardFileTypes(); @@ -400,9 +386,7 @@ public class FileTypesTest extends PlatformTestCase { // for IDEA-114804 File types mapped to text are not remapped when corresponding plugin is installed public void testRemappingToInstalledPluginExtension() throws WriteExternalException, InvalidDataException { - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.associatePattern(PlainTextFileType.INSTANCE, "*.fromPlugin"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(PlainTextFileType.INSTANCE, "*.fromPlugin")); Element element = myFileTypeManager.getState(); //String s = JDOMUtil.writeElement(element); @@ -479,9 +463,7 @@ public class FileTypesTest extends PlatformTestCase { myFileTypeManager.loadState(element); myFileTypeManager.initComponent(); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.associatePattern(typeFromPlugin, "*.foo"); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(typeFromPlugin, "*.foo")); element = myFileTypeManager.getState(); @@ -535,24 +517,18 @@ public class FileTypesTest extends PlatformTestCase { Element map = myFileTypeManager.getState().getChild("extensionMap"); if (map != null) { List mapping = map.getChildren("mapping"); - assertNull(ContainerUtil.find(mapping, o -> { - return "zip".equals(o.getAttributeValue("ext")); - })); + assertNull(ContainerUtil.find(mapping, o -> "zip".equals(o.getAttributeValue("ext")))); } } public void testDefaultFileType() throws Exception { final String extension = "veryRareExtension"; final FileType idl = myFileTypeManager.findFileTypeByName("IDL"); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.associatePattern(idl, "*." + extension); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(idl, "*." + extension)); Element element = myFileTypeManager.getState(); //log(JDOMUtil.writeElement(element)); - ApplicationManager.getApplication().runWriteAction(() -> { - myFileTypeManager.removeAssociatedExtension(idl, extension); - }); + ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.removeAssociatedExtension(idl, extension)); myFileTypeManager.clearForTests(); myFileTypeManager.initStandardFileTypes(); @@ -632,47 +608,45 @@ public class FileTypesTest extends PlatformTestCase { int N = 1000; Random random = new Random(); AtomicReference exception = new AtomicReference<>(); - List threads = ContainerUtil.map(new Object[NThreads], o -> { - return new Thread(() -> { - try { - for (int i = 0; i < N; i++) { - boolean isText = ApplicationManager.getApplication().runReadAction((Computable)() -> { - if (virtualFile.getFileType().isBinary()) { - return false; - } - else { - LoadTextUtil.loadText(virtualFile); - return true; - } - }); - - if (random.nextInt(3) == 0) { - new WriteCommandAction.Simple(getProject()) { - @Override - protected void run() throws Throwable { - byte[] bytes = new byte[(int)PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD + (isText ? 1 : 0)]; - Arrays.fill(bytes, (byte)' '); - virtualFile.setBinaryContent(bytes); - } - }.execute().throwException(); - - - //RandomAccessFile ra = new RandomAccessFile(f, "rw"); - //ra.setLength(ra.length()+(isText ? 1 : -1)); - //ra.close(); - //LocalFileSystem.getInstance().refreshFiles(Collections.singletonList(virtualFile)); - System.out.println(i+"; f = " + f.length()+"; virtualFile="+virtualFile.getLength()+"; type="+virtualFile.getFileType()); - //Thread.sleep(random.nextInt(100)); + List threads = ContainerUtil.map(new Object[NThreads], o -> new Thread(() -> { + try { + for (int i = 0; i < N; i++) { + boolean isText = ApplicationManager.getApplication().runReadAction((Computable)() -> { + if (virtualFile.getFileType().isBinary()) { + return false; } + else { + LoadTextUtil.loadText(virtualFile); + return true; + } + }); + + if (random.nextInt(3) == 0) { + new WriteCommandAction.Simple(getProject()) { + @Override + protected void run() throws Throwable { + byte[] bytes = new byte[(int)PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD + (isText ? 1 : 0)]; + Arrays.fill(bytes, (byte)' '); + virtualFile.setBinaryContent(bytes); + } + }.execute().throwException(); + + + //RandomAccessFile ra = new RandomAccessFile(f, "rw"); + //ra.setLength(ra.length()+(isText ? 1 : -1)); + //ra.close(); + //LocalFileSystem.getInstance().refreshFiles(Collections.singletonList(virtualFile)); + System.out.println(i+"; f = " + f.length()+"; virtualFile="+virtualFile.getLength()+"; type="+virtualFile.getFileType()); + //Thread.sleep(random.nextInt(100)); } } - catch (Exception e) { - exception.set(e); - e.printStackTrace(); - throw new RuntimeException(e); - } - }, "reader"); - }); + } + catch (Exception e) { + exception.set(e); + e.printStackTrace(); + throw new RuntimeException(e); + } + }, "reader")); threads.forEach(Thread::start); for (Thread thread : threads) { while (thread.isAlive()) { @@ -694,29 +668,27 @@ public class FileTypesTest extends PlatformTestCase { int NThreads = 1; int N = 10; - List threads = ContainerUtil.map(new Object[NThreads], o -> { - return new Thread(() -> { - for (int i = 0; i < N; i++) { - ApplicationManager.getApplication().runReadAction(() -> { - String text = psiFile.getText(); - System.out.println("text = " + text.length()); - //if (!virtualFile.getFileType().isBinary()) { - // LoadTextUtil.loadText(virtualFile); - //} - }); - if (i % 1 == 0) { - try { - FileUtil.appendToFile(f, StringUtil.repeatSymbol(' ', 50)); - LocalFileSystem.getInstance().refreshFiles(Collections.singletonList(virtualFile)); - System.out.println("f = " + f.length()+"; virtualFile="+virtualFile.getLength()+"; psiFile="+psiFile.isValid()+"; type="+virtualFile.getFileType()); - } - catch (IOException e) { - throw new RuntimeException(e); - } + List threads = ContainerUtil.map(new Object[NThreads], o -> new Thread(() -> { + for (int i = 0; i < N; i++) { + ApplicationManager.getApplication().runReadAction(() -> { + String text = psiFile.getText(); + System.out.println("text = " + text.length()); + //if (!virtualFile.getFileType().isBinary()) { + // LoadTextUtil.loadText(virtualFile); + //} + }); + if (i % 1 == 0) { + try { + FileUtil.appendToFile(f, StringUtil.repeatSymbol(' ', 50)); + LocalFileSystem.getInstance().refreshFiles(Collections.singletonList(virtualFile)); + System.out.println("f = " + f.length()+"; virtualFile="+virtualFile.getLength()+"; psiFile="+psiFile.isValid()+"; type="+virtualFile.getFileType()); + } + catch (IOException e) { + throw new RuntimeException(e); } } - }, "reader"); - }); + } + }, "reader")); threads.forEach(Thread::start); for (Thread thread : threads) { while (thread.isAlive()) { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java index 2466ab02a621..230c21c64c6f 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java @@ -135,9 +135,7 @@ public class ProgressIndicatorTest extends LightPlatformTestCase { while (!insideReadAction.get()) { } - ApplicationManager.getApplication().runWriteAction(() -> { - assertTrue(indicator.isCanceled()); - }); + ApplicationManager.getApplication().runWriteAction(() -> assertTrue(indicator.isCanceled())); assertTrue(indicator.isCanceled()); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java index 1f6002226629..bd95921a2892 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java @@ -380,9 +380,7 @@ public class VirtualFilePointerTest extends PlatformTestCase { assertFalse(pointer_f2.isValid()); file_f1.createNewFile(); file_f2.createNewFile(); - ApplicationManager.getApplication().runWriteAction(() -> { - LocalFileSystem.getInstance().refresh(false); - }); + ApplicationManager.getApplication().runWriteAction(() -> LocalFileSystem.getInstance().refresh(false)); assertEquals("[before:false:false, after:true:true]", listener.getLog().toString()); } diff --git a/platform/platform-tests/testSrc/com/intellij/psi/impl/PsiDocumentManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/psi/impl/PsiDocumentManagerImplTest.java index 89cb0d6f4b77..221c3413d837 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/impl/PsiDocumentManagerImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/impl/PsiDocumentManagerImplTest.java @@ -149,9 +149,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { final Document document = getDocument(file); - WriteCommandAction.runWriteCommandAction(null, () -> { - getPsiDocumentManager().getSynchronizer().performAtomically(file, () -> changeDocument(document, getPsiDocumentManager())); - }); + WriteCommandAction.runWriteCommandAction(null, () -> getPsiDocumentManager().getSynchronizer().performAtomically(file, () -> changeDocument(document, getPsiDocumentManager()))); assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); @@ -160,9 +158,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { public void testGetUncommittedDocuments_documentNotRegistered() throws Exception { final Document document = new MockDocument(); - WriteCommandAction.runWriteCommandAction(null, () -> { - changeDocument(document, getPsiDocumentManager()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> changeDocument(document, getPsiDocumentManager())); assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); @@ -173,9 +169,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { final Document document = getDocument(file); - WriteCommandAction.runWriteCommandAction(null, () -> { - changeDocument(document, getPsiDocumentManager()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> changeDocument(document, getPsiDocumentManager())); getPsiDocumentManager().commitDocument(document); assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); @@ -196,9 +190,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { final Document document = getDocument(file); - WriteCommandAction.runWriteCommandAction(null, () -> { - changeDocument(document, getPsiDocumentManager()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> changeDocument(document, getPsiDocumentManager())); getPsiDocumentManager().commitAllDocuments(); @@ -266,9 +258,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { waitAndPump(semaphore, TIMEOUT); assertTrue(getPsiDocumentManager().isCommitted(document)); - WriteCommandAction.runWriteCommandAction(null, () -> { - document.insertString(0, "class X {}"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(0, "class X {}")); semaphore.down(); getPsiDocumentManager().performWhenAllCommitted(() -> { @@ -320,9 +310,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { final Document document = getDocument(file); assertNotNull(document); - WriteCommandAction.runWriteCommandAction(null, () -> { - document.insertString(0, "class X {"+StringUtil.repeat("public int IIII = 222;\n",10000)+"}"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(0, "class X {" + StringUtil.repeat("public int IIII = 222;\n", 10000) + "}")); while (!getPsiDocumentManager().isCommitted(document)) { UIUtil.dispatchAllInvocationEvents(); @@ -337,9 +325,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { assertFalse(getPsiDocumentManager().isCommitted(document)); }); waitForCommit(document, i); - WriteCommandAction.runWriteCommandAction(null, () -> { - document.deleteString(0, "/**/".length()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> document.deleteString(0, "/**/".length())); waitTenSecondsForCommit(document); assertTrue("Still not committed: " + document, getPsiDocumentManager().isCommitted(document)); //System.out.println("i = " + i); @@ -408,9 +394,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { System.err.println("commitThread: "+commitThread + ";\n"+commitThread.log+";\n"+ThreadDumper.dumpThreadsToString()); } assertFalse(commitThread.isEnabled()); - WriteCommandAction.runWriteCommandAction(null, () -> { - assertFalse(commitThread.isEnabled()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> assertFalse(commitThread.isEnabled())); assertFalse(commitThread.isEnabled()); }); assertTrue(commitThread.isEnabled()); @@ -578,16 +562,12 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { file.putUserData(TrailingSpacesStripper.OVERRIDE_STRIP_TRAILING_SPACES_KEY, EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED); final Document document = FileDocumentManager.getInstance().getDocument(file); assertNotNull(document); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(document.getTextLength(), " "); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(document.getTextLength(), " ")); PsiDocumentManager.getInstance(myProject).reparseFiles(Collections.singleton(file), false); assertEquals("1\n2\n3\n ", VfsUtilCore.loadText(file)); - WriteCommandAction.runWriteCommandAction(myProject, () -> { - document.insertString(0, "-"); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, "-")); FileDocumentManager.getInstance().saveDocument(document); assertEquals("-1\n2\n3\n", VfsUtilCore.loadText(file)); } @@ -599,9 +579,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { final Document document = getDocument(file); assertNotNull(document); - WriteCommandAction.runWriteCommandAction(null, () -> { - document.insertString(0, "class X {}"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(0, "class X {}")); getPsiDocumentManager().performWhenAllCommitted(() -> { try { @@ -632,24 +610,18 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase { String text = "class X {" + StringUtil.repeat("void fff() {}\n", 1000) + "}"; - WriteCommandAction.runWriteCommandAction(null, () -> { - document.insertString(0, text); - }); + WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(0, text)); for (int i=0;i<300;i++) { getPsiDocumentManager().commitAllDocuments(); assertTrue(getPsiDocumentManager().isCommitted(document)); String insert = "ddfdkjh"; - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, insert); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, insert)); TimeoutUtil.sleep(50); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.replaceString(0, insert.length(), ""); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.replaceString(0, insert.length(), "")); FileDocumentManager.getInstance().saveDocument(document); diff --git a/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java b/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java index 7416b6c9be48..ad95c82ca154 100644 --- a/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java +++ b/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java @@ -64,9 +64,7 @@ public class UsageViewTest extends LightPlatformCodeInsightFixtureTestCase { PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject()); Document document = documentManager.getDocument(psiFile); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "/* sdfsdfsd */"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "/* sdfsdfsd */")); documentManager.commitAllDocuments(); int navigationOffset = ((UsageInfo2UsageAdapter)usage).getUsageInfo().getNavigationOffset(); assertEquals(psiFile.getText().indexOf("xxx"), navigationOffset); @@ -80,9 +78,7 @@ public class UsageViewTest extends LightPlatformCodeInsightFixtureTestCase { PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject()); Document document = documentManager.getDocument(psiFile); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - document.insertString(0, "/* sdfsdfsd */"); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(0, "/* sdfsdfsd */")); documentManager.commitAllDocuments(); int navigationOffset = ((UsageInfo2UsageAdapter)usage).getUsageInfo().getNavigationOffset(); assertEquals(psiFile.getText().indexOf("xxx"), navigationOffset); diff --git a/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java b/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java index a76106b475d9..c78cf9e25ab2 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java @@ -37,9 +37,7 @@ public class JdkBundleTest { private static final String STANDARD_JDK_6_LOCATION_ON_MAC_OS_X = "/System/Library/Java/JavaVirtualMachines/"; private static File[] findJdkInDirectory (File locationToSearch, String version) { - return locationToSearch.listFiles(pathname -> { - return pathname.getName().contains(version); - }); + return locationToSearch.listFiles(pathname -> pathname.getName().contains(version)); } @Test diff --git a/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java b/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java index c2414e17729a..b72f782f8620 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java @@ -410,24 +410,22 @@ public class BoundedTaskExecutorTest extends TestCase { Set workers = ContainerUtil.newConcurrentSet(); CountDownLatch allStarted = new CountDownLatch(1); - List saturate = ContainerUtil.map(Collections.nCopies(nMaxThreads, null), o -> { - return executor.submit(new Runnable() { - @Override - public void run() { - try { - allStarted.await(); - } - catch (InterruptedException e) { - throw new RuntimeException(e); - } + List saturate = ContainerUtil.map(Collections.nCopies(nMaxThreads, null), o -> executor.submit(new Runnable() { + @Override + public void run() { + try { + allStarted.await(); } + catch (InterruptedException e) { + throw new RuntimeException(e); + } + } - @Override - public String toString() { - return "warmup"; - } - }); - }); + @Override + public String toString() { + return "warmup"; + } + })); List futures = new ArrayList<>(N); diff --git a/platform/platform-tests/testSrc/com/intellij/util/ui/tree/TreeUtilTest.java b/platform/platform-tests/testSrc/com/intellij/util/ui/tree/TreeUtilTest.java index e2dc8261a6c3..e6ef1a355f7d 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/ui/tree/TreeUtilTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/ui/tree/TreeUtilTest.java @@ -138,9 +138,7 @@ public class TreeUtilTest extends PlatformTestCase { DefaultMutableTreeNode node1_1 = new DefaultMutableTreeNode("1_1"); node1.add(node1_1); DefaultTreeModel model = new DefaultTreeModel(root); - TreeUtil.sort(model, (o1, o2) -> { - return o1.toString().compareTo(o2.toString()); - }); + TreeUtil.sort(model, (o1, o2) -> o1.toString().compareTo(o2.toString())); assertEquals(node1, root.getChildAt(0)); assertEquals(node2, root.getChildAt(1)); assertEquals(node1_1, node1.getChildAt(0)); diff --git a/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java b/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java index 0fa287501796..26253e4c8a69 100644 --- a/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java +++ b/platform/projectModel-impl/src/com/intellij/application/options/ReplacePathToMacroMap.java @@ -200,9 +200,7 @@ public class ReplacePathToMacroMap extends PathMacroMap { } ContainerUtil.sort(entries, (o1, o2) -> weights.get(o2) - weights.get(o1)); - myPathsIndex = ContainerUtil.map2List(entries, entry -> { - return entry.getKey(); - }); + myPathsIndex = ContainerUtil.map2List(entries, entry -> entry.getKey()); } return myPathsIndex; } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java index 54bdf498a8d1..c67334dd5b53 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java @@ -178,9 +178,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project loadModules((ModuleModelImpl)model); - ApplicationManager.getApplication().runWriteAction(() -> { - model.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> model.commit()); } } @@ -323,9 +321,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project final Module module = myModuleModel.getModuleByFilePath(FileUtil.toSystemIndependentName(error.getModulePath().getPath())); if (module != null) { myModuleModel.myModules.remove(module.getName()); - ApplicationManager.getApplication().invokeLater(() -> { - Disposer.dispose(module); - }, module.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> Disposer.dispose(module), module.getDisposed()); } } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkImpl.java index 274c1a9ab3ba..a4267dca030a 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkImpl.java @@ -320,9 +320,7 @@ public class ProjectJdkImpl extends UserDataHolderBase implements Sdk, SdkModifi if (myListeners.isEmpty()) { return; } - ApplicationManager.getApplication().runWriteAction(() -> { - fireRootSetChanged(); - }); + ApplicationManager.getApplication().runWriteAction(() -> fireRootSetChanged()); } } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java index 96c67a4820c0..8cb3e13499e3 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java @@ -325,9 +325,7 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume @Override public void forEach(@NotNull final Processor processor) { - forEach((entry, handlers) -> { - return processor.process(entry); - }); + forEach((entry, handlers) -> processor.process(entry)); } protected abstract void forEach(@NotNull PairProcessor> processor); diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java index 0385c58a4264..01b34f04e236 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java @@ -349,9 +349,7 @@ public abstract class LibraryTableBase implements PersistentStateComponent libraries = ContainerUtil.findAll(myLibraries, library -> !((LibraryEx)library).isDisposed()); // todo: do not sort if project is directory-based - ContainerUtil.sort(libraries, (o1, o2) -> { - return StringUtil.compare(o1.getName(), o2.getName(), true); - }); + ContainerUtil.sort(libraries, (o1, o2) -> StringUtil.compare(o1.getName(), o2.getName(), true)); for (final Library library : libraries) { if (library.getName() != null) { diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java index 533676c4ae1a..a23ce7fc622f 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java @@ -71,9 +71,7 @@ public class RemoteServerListConfigurable extends MasterDetailsComponent impleme @Override protected String getEmptySelectionString() { final String typeNames = StringUtil.join(ServerType.EP_NAME.getExtensions(), - type -> { - return type.getPresentableName(); - }, ", "); + type -> type.getPresentableName(), ", "); if (typeNames.length() > 0) { return CloudBundle.getText("clouds.configure.empty.selection.string", typeNames); diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java index d6ff7cd261a5..956cbd60381c 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java @@ -136,9 +136,7 @@ public class ServersTreeStructure extends AbstractTreeStructureBase { public Collection getChildren() { List> result = new ArrayList>(); result.addAll(myContribution.createServerNodes(doGetProject())); - result.addAll(ContainerUtil.map(myContribution.getRemoteServers(), (Function, AbstractTreeNode>)server -> { - return new RemoteServerNode(server); - })); + result.addAll(ContainerUtil.map(myContribution.getRemoteServers(), (Function, AbstractTreeNode>)server -> new RemoteServerNode(server))); return result; } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudServerRuntimeInstance.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudServerRuntimeInstance.java index 987be8ad6171..c4b32c1b0139 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudServerRuntimeInstance.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudServerRuntimeInstance.java @@ -117,9 +117,7 @@ public abstract class CloudServerRuntimeInstance if (applications == null) { return Collections.emptyList(); } - return ContainerUtil.map(applications, application -> { - return createApplicationRuntime(application); - }); + return ContainerUtil.map(applications, application -> createApplicationRuntime(application)); } }); } diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/AbstractImportTestsAction.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/AbstractImportTestsAction.java index c5b16f374eab..124683dcbe43 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/AbstractImportTestsAction.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/AbstractImportTestsAction.java @@ -123,9 +123,7 @@ public abstract class AbstractImportTestsAction extends AnAction { public static void adjustHistory(Project project) { int historySize = getHistorySize(); - final File[] files = TestStateStorage.getTestHistoryRoot(project).listFiles((dir, name) -> { - return name.endsWith(".xml"); - }); + final File[] files = TestStateStorage.getTestHistoryRoot(project).listFiles((dir, name) -> name.endsWith(".xml")); if (files != null && files.length >= historySize + 1) { Arrays.sort(files, (o1, o2) -> { final long l1 = o1.lastModified(); diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsGroup.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsGroup.java index cbb98da7ffc6..7788e54351dd 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsGroup.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/history/actions/ImportTestsGroup.java @@ -53,9 +53,7 @@ public class if (project == null) return EMPTY_ARRAY; final Collection filePaths = TestHistoryConfiguration.getInstance(project).getFiles(); final File testHistoryRoot = TestStateStorage.getTestHistoryRoot(project); - final List fileNames = ContainerUtil.map(filePaths, fileName -> { - return new File(testHistoryRoot, fileName); - }); + final List fileNames = ContainerUtil.map(filePaths, fileName -> new File(testHistoryRoot, fileName)); Collections.sort(fileNames, (f1, f2) -> f1.lastModified() > f2.lastModified() ? -1 : 1); final int historySize = fileNames.size(); final AnAction[] actions = new AnAction[historySize + 2]; diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/states/TestComparisonFailedStates.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/states/TestComparisonFailedStates.java index 49dc9df76af7..d94c64cccedf 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/states/TestComparisonFailedStates.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/states/TestComparisonFailedStates.java @@ -48,8 +48,6 @@ public class TestComparisonFailedStates extends TestFailedState { @NotNull public List getHyperlinks() { - return ContainerUtil.map(myStates, state -> { - return state.getHyperlink(); - }); + return ContainerUtil.map(myStates, state -> state.getHyperlink()); } } diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java index c861b1470f2d..e68dce94b560 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java @@ -259,9 +259,7 @@ public class MatcherImpl { } }; - ApplicationManager.getApplication().runReadAction(() -> { - FileBasedIndex.getInstance().iterateIndexableFiles(ci, project, progress); - }); + ApplicationManager.getApplication().runReadAction(() -> FileBasedIndex.getInstance().iterateIndexableFiles(ci, project, progress)); progress.setText2(""); } else { diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java index 19f33abd3821..43c259b2a2b7 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java @@ -192,9 +192,7 @@ public class Replacer { project, () -> { ApplicationManager.getApplication().runWriteAction( - () -> { - doReplace(element, replacementInfo); - } + () -> doReplace(element, replacementInfo) ); PsiDocumentManager.getInstance(project).commitAllDocuments(); }, diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java index ca530caa5d22..24d5d61cf3bc 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java @@ -245,7 +245,7 @@ class EditVarConstraintsDialog extends DialogWrapper { final Variable var = variables.get(parameterList.getSelectedIndex()); if (validateParameters()) { if (current!=null) copyValuesFromUI(current); - ApplicationManager.getApplication().runWriteAction(() -> { copyValuesToUI(var); }); + ApplicationManager.getApplication().runWriteAction(() -> copyValuesToUI(var)); current = var; } else { rollingBackSelection = true; diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java index 446c48ca2703..efe89a66a6a6 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java @@ -118,9 +118,7 @@ public class UIUtil { public static void setContent(final Editor editor, String val, final int from, final int end, final Project project) { final String value = val != null ? val : ""; - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - editor.getDocument().replaceString(from, (end == -1) ? editor.getDocument().getTextLength() : end, value); - }), MODIFY_EDITOR_CONTENT, SS_GROUP); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> editor.getDocument().replaceString(from, (end == -1) ? editor.getDocument().getTextLength() : end, value)), MODIFY_EDITOR_CONTENT, SS_GROUP); } static String getShortParamString(Configuration config, String varname) { diff --git a/platform/testFramework/src/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.java b/platform/testFramework/src/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.java index fd07fe3b9570..65a1682fd3f4 100644 --- a/platform/testFramework/src/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.java +++ b/platform/testFramework/src/com/intellij/psi/codeStyle/arrangement/AbstractRearrangerTest.java @@ -116,9 +116,7 @@ public abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFix @NotNull protected static StdArrangementMatchRule rule(@NotNull ArrangementSettingsToken... conditions) { - return rule(ContainerUtil.map(conditions, it -> { - return atom(it); - })); + return rule(ContainerUtil.map(conditions, it -> atom(it))); } @NotNull @@ -189,8 +187,7 @@ public abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFix new StdArrangementExtendableSettings(groupingRules, sectionRules, aliases); settings.setArrangementSettings(arrangementSettings); ArrangementEngine engine = ServiceManager.getService(myFixture.getProject(), ArrangementEngine.class); - CommandProcessor.getInstance().executeCommand(getProject(), ()-> { - engine.arrange(myFixture.getEditor(), myFixture.getFile(), info.ranges);}, null, null); + CommandProcessor.getInstance().executeCommand(getProject(), ()-> engine.arrange(myFixture.getEditor(), myFixture.getFile(), info.ranges), null, null); // Check expectation. diff --git a/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java b/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java index 85970fcf4810..b25e50a3674a 100644 --- a/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java +++ b/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java @@ -213,9 +213,7 @@ public abstract class FormatterTestCase extends LightPlatformTestCase { @SuppressWarnings({"UNUSED_SYMBOL"}) private void checkPsi(final PsiFile file, String textAfter) { - CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { - performFormatting(file); - }), "", ""); + CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", ""); String fileText = file.getText(); diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java index 683566f85eb1..72c0f7a4e44c 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java @@ -615,9 +615,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest executeAction(actionId, editor, getProject()); } public static void executeAction(@NonNls @NotNull final String actionId, @NotNull final Editor editor, Project project) { - CommandProcessor.getInstance().executeCommand(project, () -> { - EditorTestUtil.executeAction(editor, actionId); - }, "", null, editor.getDocument()); + CommandProcessor.getInstance().executeCommand(project, () -> EditorTestUtil.executeAction(editor, actionId), "", null, editor.getDocument()); } @NotNull diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java index 2dc2e974565c..348444dde2da 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java @@ -172,9 +172,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da @TestOnly public static void disposeApplication() { if (ourApplication != null) { - ApplicationManager.getApplication().runWriteAction(() -> { - Disposer.dispose(ourApplication); - }); + ApplicationManager.getApplication().runWriteAction(() -> Disposer.dispose(ourApplication)); ourApplication = null; } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index e542c08fe017..8f8de03bc55a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -712,9 +712,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig List intentions = getAvailableIntentions(filePaths); IntentionAction action = CodeInsightTestUtil.findIntentionByText(intentions, intentionName); if (action == null) { - System.out.println(intentionName + " not found among " + StringUtil.join(intentions, action1 -> { - return action1.getText(); - }, ",")); + System.out.println(intentionName + " not found among " + StringUtil.join(intentions, action1 -> action1.getText(), ",")); } return action; } @@ -786,9 +784,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig final LookupElement[] elements = getLookupElements(); if (elements == null) return null; - return ContainerUtil.map(elements, lookupItem -> { - return lookupItem.getLookupString(); - }); + return ContainerUtil.map(elements, lookupItem -> lookupItem.getLookupString()); } @Override diff --git a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java index a23d985d2c69..56ffa7554f7b 100644 --- a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java +++ b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java @@ -578,9 +578,7 @@ public abstract class KeymapsTestCase extends PlatformTestCase { Map>> duplicates = getKnownDuplicates(); THashSet allMaps = - new THashSet(ContainerUtil.map(KeymapManagerEx.getInstanceEx().getAllKeymaps(), keymap -> { - return keymap.getName(); - })); + new THashSet(ContainerUtil.map(KeymapManagerEx.getInstanceEx().getAllKeymaps(), keymap -> keymap.getName())); TestCase.assertTrue("Modify 'known duplicates list' test data. Keymaps were added: " + ContainerUtil.subtract(allMaps, duplicates.keySet()), ContainerUtil.subtract(allMaps, duplicates.keySet()).isEmpty() @@ -642,9 +640,7 @@ public abstract class KeymapsTestCase extends PlatformTestCase { .append(". Please modify known duplicates list:\n"); for (Shortcut eachShortcut : keymapToShortcuts.getValue()) { message.append(" { ").append(StringUtil.wrapWithDoubleQuote(getText(eachShortcut))).append(",\t") - .append(StringUtil.join(keymap.getActionIds(eachShortcut), s -> { - return StringUtil.wrapWithDoubleQuote(s); - }, ", ")) + .append(StringUtil.join(keymap.getActionIds(eachShortcut), s -> StringUtil.wrapWithDoubleQuote(s), ", ")) .append("},\n"); } } diff --git a/platform/usageView/src/com/intellij/usages/impl/SearchForUsagesRunnable.java b/platform/usageView/src/com/intellij/usages/impl/SearchForUsagesRunnable.java index 40481060cbef..be4f35b42c89 100644 --- a/platform/usageView/src/com/intellij/usages/impl/SearchForUsagesRunnable.java +++ b/platform/usageView/src/com/intellij/usages/impl/SearchForUsagesRunnable.java @@ -284,9 +284,7 @@ class SearchForUsagesRunnable implements Runnable { final Usage firstUsage = myFirstUsage.get(); if (firstUsage != null) { final UsageViewImpl finalUsageView = usageView; - ApplicationManager.getApplication().runReadAction(() -> { - finalUsageView.appendUsage(firstUsage); - }); + ApplicationManager.getApplication().runReadAction(() -> finalUsageView.appendUsage(firstUsage)); } } else { @@ -357,17 +355,13 @@ class SearchForUsagesRunnable implements Runnable { } if (usageView != null) { - ApplicationManager.getApplication().runReadAction(() -> { - usageView.appendUsage(usage); - }); + ApplicationManager.getApplication().runReadAction(() -> usageView.appendUsage(usage)); } } return !indicator1.isCanceled(); }); if (getUsageView(indicator) != null) { - ApplicationManager.getApplication().invokeLater(() -> { - myUsageViewManager.showToolWindow(true); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> myUsageViewManager.showToolWindow(true), myProject.getDisposed()); } Disposer.dispose(findUsagesStartedBalloon); ApplicationManager.getApplication().invokeLater(() -> { diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java index 085db51c1a3f..ad2819ecd883 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java @@ -888,9 +888,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra UsageViewImpl.this); } } - ApplicationManager.getApplication().runReadAction(() -> { - appendUsage(usage); - }); + ApplicationManager.getApplication().runReadAction(() -> appendUsage(usage)); } return !indicator.isCanceled(); }; diff --git a/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java b/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java index 4019832581f6..d3210d5b409f 100644 --- a/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java +++ b/platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java @@ -164,9 +164,7 @@ public class IoTestUtil { } private static char getFirstFreeDriveLetter() { - final Set roots = ContainerUtil.map2Set(File.listRoots(), root -> { - return root.getPath().toUpperCase(Locale.US).charAt(0); - }); + final Set roots = ContainerUtil.map2Set(File.listRoots(), root -> root.getPath().toUpperCase(Locale.US).charAt(0)); char drive = 0; for (char c = 'E'; c <= 'Z'; c++) { diff --git a/platform/util/testSrc/com/intellij/util/diff/DiffTreeTest.java b/platform/util/testSrc/com/intellij/util/diff/DiffTreeTest.java index d69a8a9f942a..b9ab52dbf319 100644 --- a/platform/util/testSrc/com/intellij/util/diff/DiffTreeTest.java +++ b/platform/util/testSrc/com/intellij/util/diff/DiffTreeTest.java @@ -60,9 +60,7 @@ public class DiffTreeTest extends TestCase { @Override public String toString() { - return getChildren().length == 0 ? String.valueOf(myId) : StringUtil.join(myChildren, node -> { - return node.toString(); - }, ""); + return getChildren().length == 0 ? String.valueOf(myId) : StringUtil.join(myChildren, node -> node.toString(), ""); } public TextRange getTextRange() { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/MoveChangesToAnotherListAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/MoveChangesToAnotherListAction.java index 016dacffec25..def91f8c5863 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/MoveChangesToAnotherListAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/MoveChangesToAnotherListAction.java @@ -201,9 +201,7 @@ public class MoveChangesToAnotherListAction extends AnAction implements DumbAwar LocalChangeList activeChangeList = ContainerUtil.find(lists, LocalChangeList::isDefault); if (activeChangeList != null) return activeChangeList; - LocalChangeList emptyList = ContainerUtil.find(lists, list -> { - return list.getChanges().isEmpty(); - }); + LocalChangeList emptyList = ContainerUtil.find(lists, list -> list.getChanges().isEmpty()); return ObjectUtils.chooseNotNull(emptyList, ContainerUtil.getFirstItem(lists)); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchChange.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchChange.java index cc579dc2814c..907f016d875f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchChange.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchChange.java @@ -318,20 +318,12 @@ class ApplyPatchChange { @Nullable private GutterIconRenderer createApplyRenderer() { - return createIconRenderer(DiffBundle.message("merge.dialog.apply.change.action.name"), DiffUtil.getArrowIcon(Side.RIGHT), () -> { - myViewer.executeCommand("Accept change", () -> { - myViewer.replaceChange(this); - }); - }); + return createIconRenderer(DiffBundle.message("merge.dialog.apply.change.action.name"), DiffUtil.getArrowIcon(Side.RIGHT), () -> myViewer.executeCommand("Accept change", () -> myViewer.replaceChange(this))); } @Nullable private GutterIconRenderer createIgnoreRenderer() { - return createIconRenderer(DiffBundle.message("merge.dialog.ignore.change.action.name"), AllIcons.Diff.Remove, () -> { - myViewer.executeCommand("Ignore change", () -> { - myViewer.markChangeResolved(this); - }); - }); + return createIconRenderer(DiffBundle.message("merge.dialog.ignore.change.action.name"), AllIcons.Diff.Remove, () -> myViewer.executeCommand("Ignore change", () -> myViewer.markChangeResolved(this))); } @Nullable diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchViewer.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchViewer.java index fbb8dc0a4c54..ca3782ee5673 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchViewer.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchViewer.java @@ -537,9 +537,7 @@ class ApplyPatchViewer implements DataProvider, Disposable { String title = e.getPresentation().getText() + " in patch resolve"; - executeCommand(title, () -> { - apply(selectedChanges); - }); + executeCommand(title, () -> apply(selectedChanges)); } private boolean isSomeChangeSelected(@NotNull Side side) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java index efaccf680d9c..16c54c73a6e6 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java @@ -251,9 +251,7 @@ public class LineStatusTracker { MarkupModel markupModel = DocumentMarkupModel.forDocument(myDocument, myProject, true); RangeHighlighter highlighter = LineStatusMarkerRenderer.createRangeHighlighter(range, new TextRange(first, second), markupModel); - highlighter.setLineMarkerRenderer(LineStatusMarkerRenderer.createRenderer(range, (editor) -> { - return new LineStatusTrackerDrawing.MyLineStatusMarkerPopup(this, editor, range); - })); + highlighter.setLineMarkerRenderer(LineStatusMarkerRenderer.createRenderer(range, (editor) -> new LineStatusTrackerDrawing.MyLineStatusMarkerPopup(this, editor, range))); highlighter.setEditorFilter(MarkupEditorFilterFactory.createIsNotDiffFilter()); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java index 8a693a46d3e6..fa6101c96212 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java @@ -363,7 +363,7 @@ public class NewMappings { public boolean isEmpty() { synchronized (myLock) { - return mySortedMappings.length == 0 || ContainerUtil.and(mySortedMappings, mapping -> { return mapping.getVcs().isEmpty(); }); + return mySortedMappings.length == 0 || ContainerUtil.and(mySortedMappings, mapping -> mapping.getVcs().isEmpty()); } } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java index fea5237ab262..d1c5afc54d7b 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java @@ -355,9 +355,7 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider, if (details == null || details instanceof LoadingDetails) return defaultStyle; List styles = - ContainerUtil.map(myHighlighters, highlighter -> { - return highlighter.getStyle(details, selected); - }); + ContainerUtil.map(myHighlighters, highlighter -> highlighter.getStyle(details, selected)); return VcsCommitStyleFactory.combine(ContainerUtil.append(styles, defaultStyle)); } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/PersistentUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/PersistentUtil.java index 9265e8cf5291..132c022f3838 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/PersistentUtil.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/PersistentUtil.java @@ -63,9 +63,7 @@ public class PersistentUtil { int version) throws IOException { final File storageFile = getStorageFile(logId, logKind, version); - return IOUtil.openCleanOrResetBroken(() -> { - return new PersistentEnumerator<>(storageFile, keyDescriptor, Page.PAGE_SIZE); - }, storageFile); + return IOUtil.openCleanOrResetBroken(() -> new PersistentEnumerator<>(storageFile, keyDescriptor, Page.PAGE_SIZE), storageFile); } @NotNull @@ -73,8 +71,6 @@ public class PersistentUtil { throws IOException { final File storageFile = getStorageFile(logId, logKind, version); - return IOUtil.openCleanOrResetBroken(() -> { - return new PersistentStringEnumerator(storageFile); - }, storageFile); + return IOUtil.openCleanOrResetBroken(() -> new PersistentStringEnumerator(storageFile), storageFile); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToLocalProcessAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToLocalProcessAction.java index 2fe26e8feb68..80d49409c258 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToLocalProcessAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToLocalProcessAction.java @@ -284,9 +284,7 @@ public class AttachToLocalProcessAction extends AnAction { mySelectedDebugger = selectedDebugger; if (debuggers.size() > 1) { - mySubItems = ContainerUtil.map(debuggers, debugger -> { - return new AttachItem(myGroup, false, myProcessInfo, Collections.singletonList(debugger)); - }); + mySubItems = ContainerUtil.map(debuggers, debugger -> new AttachItem(myGroup, false, myProcessInfo, Collections.singletonList(debugger))); } else { mySubItems = Collections.emptyList(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java index 70bbfa38a93e..3c75363ce79f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialog.java @@ -420,9 +420,7 @@ public class BreakpointsDialog extends DialogWrapper { } }); - dialogState.setSelectedGroupingRules(new HashSet<>(ContainerUtil.map(rulesEnabled, rule -> { - return rule.getId(); - }))); + dialogState.setSelectedGroupingRules(new HashSet<>(ContainerUtil.map(rulesEnabled, rule -> rule.getId()))); getBreakpointManager().setBreakpointsDialogSettings(dialogState); } diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestCase.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestCase.java index bc280370a7e0..4b296b069d95 100644 --- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestCase.java +++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestCase.java @@ -58,9 +58,7 @@ public abstract class XDebuggerTestCase extends PlatformTestCase { static void removeBreakPoint(final XBreakpointManagerImpl breakpointManager, final XBreakpoint breakpoint) { - ApplicationManager.getApplication().runWriteAction(() -> { - breakpointManager.removeBreakpoint(breakpoint); - }); + ApplicationManager.getApplication().runWriteAction(() -> breakpointManager.removeBreakpoint(breakpoint)); } @Override diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java index 00b8ba027381..76dfa585c256 100644 --- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java +++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java @@ -331,9 +331,7 @@ public class XDebuggerTestUtil { public static void assertSourcePosition(final XValue value, VirtualFile file, int offset) { final XTestNavigatable n = new XTestNavigatable(); - ApplicationManager.getApplication().runReadAction(() -> { - value.computeSourcePosition(n); - }); + ApplicationManager.getApplication().runReadAction(() -> value.computeSourcePosition(n)); assertNotNull(n.myPosition); assertEquals(file, n.myPosition.getFile()); assertEquals(offset, n.myPosition.getOffset()); diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/impl/actions/AttachToLocalProcessActionTest.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/impl/actions/AttachToLocalProcessActionTest.java index ab1c0d15a691..17938c1ddae1 100644 --- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/impl/actions/AttachToLocalProcessActionTest.java +++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/impl/actions/AttachToLocalProcessActionTest.java @@ -603,20 +603,18 @@ public class AttachToLocalProcessActionTest extends PlatformTestCase { @NotNull private static List createDebuggers(String... names) { - return ContainerUtil.map(names, s -> { - return new XLocalAttachDebugger() { - @NotNull - @Override - public String getDebuggerDisplayName() { - return s; - } + return ContainerUtil.map(names, s -> new XLocalAttachDebugger() { + @NotNull + @Override + public String getDebuggerDisplayName() { + return s; + } - @NotNull - @Override - public XDebugSession attachDebugSession(@NotNull Project project, @NotNull ProcessInfo processInfo) throws ExecutionException { - return null; - } - }; + @NotNull + @Override + public XDebugSession attachDebugSession(@NotNull Project project, @NotNull ProcessInfo processInfo) throws ExecutionException { + return null; + } }); } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ProtectedMemberInFinalClassInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ProtectedMemberInFinalClassInspection.java index e586c39a9254..99ab95b7cfe0 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ProtectedMemberInFinalClassInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ProtectedMemberInFinalClassInspection.java @@ -124,9 +124,7 @@ public class ProtectedMemberInFinalClassInspection extends ProtectedMemberInFina return; } final ConflictsDialog conflictsDialog = new ConflictsDialog(member.getProject(), conflicts, - () -> ApplicationManager.getApplication().runWriteAction(() -> { - modifierList.setModifierProperty(PRIVATE, true); - })); + () -> ApplicationManager.getApplication().runWriteAction(() -> modifierList.setModifierProperty(PRIVATE, true))); conflictsDialogOK = conflictsDialog.showAndGet(); } if (conflictsDialogOK) { diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/LanguageReference.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/LanguageReference.java index f731a98e0f7e..04f003fba0db 100644 --- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/LanguageReference.java +++ b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/LanguageReference.java @@ -52,9 +52,7 @@ public final class LanguageReference extends StringLiteralReference { @NotNull public Object[] getVariants() { List list = InjectLanguageAction.getAllInjectables(); - return ContainerUtil.map2Array(list, LookupElement.class, (Function)injectable -> { - return LookupElementBuilder.create(injectable.getId()).withIcon(injectable.getIcon()).withTailText( - "(" + injectable.getDisplayName() + ")", true); - }); + return ContainerUtil.map2Array(list, LookupElement.class, (Function)injectable -> LookupElementBuilder.create(injectable.getId()).withIcon(injectable.getIcon()).withTailText( + "(" + injectable.getDisplayName() + ")", true)); } } diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/RegExpEnumReference.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/RegExpEnumReference.java index b04ee21be154..e2d08317e520 100644 --- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/RegExpEnumReference.java +++ b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/RegExpEnumReference.java @@ -48,9 +48,7 @@ final class RegExpEnumReference extends StringLiteralReference { if (values == null || values.size() == 0) { return ArrayUtil.EMPTY_OBJECT_ARRAY; } - return ContainerUtil.map2Array(values, s -> { - return LookupElementBuilder.create(s).withIcon(PlatformIcons.ENUM_ICON); - }); + return ContainerUtil.map2Array(values, s -> LookupElementBuilder.create(s).withIcon(PlatformIcons.ENUM_ICON)); } public boolean isSoft() { diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/EditInjectionSettingsAction.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/EditInjectionSettingsAction.java index eeaa77cd761a..b6175e495dad 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/EditInjectionSettingsAction.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/EditInjectionSettingsAction.java @@ -60,9 +60,7 @@ public class EditInjectionSettingsAction implements IntentionAction, LowPriority } public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { - ApplicationManager.getApplication().runReadAction(() -> { - invokeImpl(project, editor, file); - }); + ApplicationManager.getApplication().runReadAction(() -> invokeImpl(project, editor, file)); } private static void invokeImpl(Project project, Editor editor, PsiFile file) { diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java index 6625851bf0bf..dab343ccf919 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java @@ -63,9 +63,7 @@ public class UnInjectLanguageAction implements IntentionAction, LowPriorityActio } public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { - ApplicationManager.getApplication().runReadAction(() -> { - invokeImpl(project, editor, file); - }); + ApplicationManager.getApplication().runReadAction(() -> invokeImpl(project, editor, file)); } public static void invokeImpl(Project project, Editor editor, PsiFile file) { diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/config/BaseInjection.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/config/BaseInjection.java index 1a2e56a7e313..ec35a8f07992 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/config/BaseInjection.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/config/BaseInjection.java @@ -137,9 +137,7 @@ public class BaseInjection implements Injection, PersistentStateComponent ranges = getMatchingRanges(myCompiledValuePattern.matcher(StringPattern.newBombedCharSequence(sb)), sb.length()); - return !ranges.isEmpty() ? ContainerUtil.map(ranges, s -> { - return new TextRange(textEscaper.getOffsetInHost(s.getStartOffset(), textRange), textEscaper.getOffsetInHost(s.getEndOffset(), textRange)); - }) : Collections.emptyList(); + return !ranges.isEmpty() ? ContainerUtil.map(ranges, s -> new TextRange(textEscaper.getOffsetInHost(s.getStartOffset(), textRange), textEscaper.getOffsetInHost(s.getEndOffset(), textRange))) : Collections.emptyList(); } } diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/util/StringMatcher.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/util/StringMatcher.java index d4d4a645b9e8..9d643c3407d5 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/util/StringMatcher.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/util/StringMatcher.java @@ -170,9 +170,7 @@ public abstract class StringMatcher { protected MatcherSet(Set target) { super(target); - myPattern = StringUtil.join(target, s -> { - return s.getPattern(); - }, "|"); + myPattern = StringUtil.join(target, s -> s.getPattern(), "|"); } public static StringMatcher create(Set matchers) { diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java index 8a008819837f..698ffe9d36e0 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java @@ -139,9 +139,7 @@ public class ConvertInterfaceToClassIntention extends Intention { throw new BaseRefactoringProcessor.ConflictsInTestsException(conflicts.values()); } final ConflictsDialog conflictsDialog = new ConflictsDialog(anInterface.getProject(), conflicts, - () -> ApplicationManager.getApplication().runWriteAction(() -> { - convertInterfaceToClass(anInterface); - })); + () -> ApplicationManager.getApplication().runWriteAction(() -> convertInterfaceToClass(anInterface))); conflictsDialogOK = conflictsDialog.showAndGet(); } if (conflictsDialogOK) { diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java index f0081ec10fd4..51655109dbd8 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/modifiers/ModifierIntention.java @@ -66,9 +66,7 @@ abstract class ModifierIntention extends Intention implements LowPriorityAction conflictsDialogOK = true; } else { final ConflictsDialog conflictsDialog = new ConflictsDialog(project, conflicts, - () -> ApplicationManager.getApplication().runWriteAction(() -> { - modifierList.setModifierProperty(getModifier(), true); - })); + () -> ApplicationManager.getApplication().runWriteAction(() -> modifierList.setModifierProperty(getModifier(), true))); conflictsDialogOK = conflictsDialog.showAndGet(); } if (conflictsDialogOK) { diff --git a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java index cb0cd03de696..b05b116cd220 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java @@ -501,9 +501,7 @@ public class AntExplorer extends SimpleToolWindowPanel implements DataProvider, } } final List result = new ArrayList(); - ContainerUtil.addAllNotNull(result, ContainerUtil.map(antFiles, buildFile -> { - return function.fun(buildFile); - })); + ContainerUtil.addAllNotNull(result, ContainerUtil.map(antFiles, buildFile -> function.fun(buildFile))); return result.isEmpty() ? null : result; } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntConfigurationImpl.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntConfigurationImpl.java index 32fa5186cb90..59b051bf2807 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntConfigurationImpl.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntConfigurationImpl.java @@ -396,9 +396,7 @@ public class AntConfigurationImpl extends AntConfigurationBase implements Persis private void runWhenInitialized(final Runnable runnable) { if (getProject().isInitialized()) { - ApplicationManager.getApplication().runReadAction(() -> { - runnable.run(); - }); + ApplicationManager.getApplication().runReadAction(() -> runnable.run()); } else { myStartupManager.runWhenProjectIsInitialized(() -> runnable.run()); @@ -780,9 +778,7 @@ public class AntConfigurationImpl extends AntConfigurationBase implements Persis finally { myInitThread = null; myIsInitialized = Boolean.TRUE; - ApplicationManager.getApplication().invokeLater(() -> { - myEventDispatcher.getMulticaster().configurationLoaded(); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> myEventDispatcher.getMulticaster().configurationLoaded(), ModalityState.any()); } } }); @@ -835,9 +831,7 @@ public class AntConfigurationImpl extends AntConfigurationBase implements Persis if (!app.isDispatchThread() || task.isHeadless()) { // for headless tasks we need to ensure async execution. // Otherwise calls to AntConfiguration.getInstance() from the task will cause SOE - app.invokeLater(() -> { - task.queue(); - }, ModalityState.any()); + app.invokeLater(() -> task.queue(), ModalityState.any()); } else { task.queue(); diff --git a/plugins/copyright/src/com/maddyhome/idea/copyright/actions/AbstractFileProcessor.java b/plugins/copyright/src/com/maddyhome/idea/copyright/actions/AbstractFileProcessor.java index 8db3220d1e8d..81ad01b5483e 100644 --- a/plugins/copyright/src/com/maddyhome/idea/copyright/actions/AbstractFileProcessor.java +++ b/plugins/copyright/src/com/maddyhome/idea/copyright/actions/AbstractFileProcessor.java @@ -309,9 +309,7 @@ public abstract class AbstractFileProcessor { } private void execute(final Runnable readAction, final Runnable writeAction) { - ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> { - readAction.run(); - }), title, true, myProject); + ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> readAction.run()), title, true, myProject); new WriteCommandAction(myProject, title) { @Override protected void run(@NotNull Result result) throws Throwable { diff --git a/plugins/coverage-common/src/com/intellij/coverage/CoverageSuitesBundle.java b/plugins/coverage-common/src/com/intellij/coverage/CoverageSuitesBundle.java index 0e5eaf69bc38..50c2cee9b719 100644 --- a/plugins/coverage-common/src/com/intellij/coverage/CoverageSuitesBundle.java +++ b/plugins/coverage-common/src/com/intellij/coverage/CoverageSuitesBundle.java @@ -138,9 +138,7 @@ public class CoverageSuitesBundle { } public String getPresentableName() { - return StringUtil.join(mySuites, coverageSuite -> { - return coverageSuite.getPresentableName(); - }, ", "); + return StringUtil.join(mySuites, coverageSuite -> coverageSuite.getPresentableName(), ", "); } public boolean isModuleChecked(final Module module) { diff --git a/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java b/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java index 77d113d64999..26c608b5601e 100644 --- a/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java +++ b/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java @@ -540,9 +540,7 @@ public class SrcFileAnnotator implements Disposable { myLabel.setText(message); } }; - panel.createActionLabel("Close", () -> { - fileEditorManager.removeTopComponent(editor, panel); - }); + panel.createActionLabel("Close", () -> fileEditorManager.removeTopComponent(editor, panel)); map.put(editor, panel); fileEditorManager.addTopComponent(editor, panel); break; diff --git a/plugins/devkit/src/dom/impl/IdeaPluginConverter.java b/plugins/devkit/src/dom/impl/IdeaPluginConverter.java index ca59fe0fef4e..554d6225523e 100644 --- a/plugins/devkit/src/dom/impl/IdeaPluginConverter.java +++ b/plugins/devkit/src/dom/impl/IdeaPluginConverter.java @@ -128,8 +128,6 @@ public class IdeaPluginConverter extends ResolvingConverter { if (DumbService.isDumb(project)) return Collections.emptyList(); List> files = DomService.getInstance().getFileElements(IdeaPlugin.class, project, scope); - return ContainerUtil.map(files, ideaPluginDomFileElement -> { - return ideaPluginDomFileElement.getRootElement(); - }); + return ContainerUtil.map(files, ideaPluginDomFileElement -> ideaPluginDomFileElement.getRootElement()); } } diff --git a/plugins/devkit/src/dom/impl/PropertyKeyReferenceProvider.java b/plugins/devkit/src/dom/impl/PropertyKeyReferenceProvider.java index ed7fc81b9c16..029638cb6ad0 100644 --- a/plugins/devkit/src/dom/impl/PropertyKeyReferenceProvider.java +++ b/plugins/devkit/src/dom/impl/PropertyKeyReferenceProvider.java @@ -152,9 +152,7 @@ public class PropertyKeyReferenceProvider extends PsiReferenceProvider { if (!(rootElement instanceof IdeaPlugin)) return Collections.emptyList(); IdeaPlugin plugin = (IdeaPlugin)rootElement; - return ContainerUtil.map(plugin.getResourceBundles(), value -> { - return value.getStringValue(); - }); + return ContainerUtil.map(plugin.getResourceBundles(), value -> value.getStringValue()); } } } \ No newline at end of file diff --git a/plugins/devkit/src/inspections/quickfix/CreateHtmlDescriptionFix.java b/plugins/devkit/src/inspections/quickfix/CreateHtmlDescriptionFix.java index 173dbfe2fa58..19789f24ac48 100644 --- a/plugins/devkit/src/inspections/quickfix/CreateHtmlDescriptionFix.java +++ b/plugins/devkit/src/inspections/quickfix/CreateHtmlDescriptionFix.java @@ -113,9 +113,7 @@ public class CreateHtmlDescriptionFix implements LocalQuickFix, Iconable { final List virtualFiles = getPotentialRoots(myModule, dirs); final VirtualFile[] roots = prepare(VfsUtilCore.toVirtualFileArray(virtualFiles)); if (roots.length == 1) { - ApplicationManager.getApplication().runWriteAction(() -> { - createDescription(roots[0]); - }); + ApplicationManager.getApplication().runWriteAction(() -> createDescription(roots[0])); } else { List options = new ArrayList(); @@ -131,9 +129,7 @@ public class CreateHtmlDescriptionFix implements LocalQuickFix, Iconable { .setItemChoosenCallback(() -> { final int index = files.getSelectedIndex(); if (0 <= index && index < roots.length) { - ApplicationManager.getApplication().runWriteAction(() -> { - createDescription(roots[index]); - }); + ApplicationManager.getApplication().runWriteAction(() -> createDescription(roots[index])); } }).createPopup(); final Editor editor = FileEditorManager.getInstance(myModule.getProject()).getSelectedTextEditor(); diff --git a/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java b/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java index e9bb4688ade5..e456315acd88 100644 --- a/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java +++ b/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java @@ -204,9 +204,7 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable { Sandbox sandbox = new Sandbox(mySandboxHome.getText(), (Sdk)myInternalJres.getSelectedItem(), myIdeaJdk); final SdkModificator modificator = myIdeaJdk.getSdkModificator(); modificator.setSdkAdditionalData(sandbox); - ApplicationManager.getApplication().runWriteAction(() -> { - modificator.commitChanges(); - }); + ApplicationManager.getApplication().runWriteAction(() -> modificator.commitChanges()); ((ProjectJdkImpl) myIdeaJdk).resetVersionString(); myModified = false; } diff --git a/plugins/devkit/src/testAssistant/TestCaseAsRelatedFileProvider.java b/plugins/devkit/src/testAssistant/TestCaseAsRelatedFileProvider.java index 680f018e419d..802839aaf5f6 100644 --- a/plugins/devkit/src/testAssistant/TestCaseAsRelatedFileProvider.java +++ b/plugins/devkit/src/testAssistant/TestCaseAsRelatedFileProvider.java @@ -45,8 +45,6 @@ public class TestCaseAsRelatedFileProvider extends GotoRelatedProvider { return Collections.emptyList(); } - return ContainerUtil.map(locations, location -> { - return new GotoRelatedItem(location.getPsiElement()); - }); + return ContainerUtil.map(locations, location -> new GotoRelatedItem(location.getPsiElement())); } } diff --git a/plugins/devkit/testSources/navigation/DevKitGutterTargetsChecker.java b/plugins/devkit/testSources/navigation/DevKitGutterTargetsChecker.java index dbb173be14c5..6edcefcc79a4 100644 --- a/plugins/devkit/testSources/navigation/DevKitGutterTargetsChecker.java +++ b/plugins/devkit/testSources/navigation/DevKitGutterTargetsChecker.java @@ -59,8 +59,6 @@ public class DevKitGutterTargetsChecker { throw new IllegalArgumentException(gutterMark.getClass() + ": gutter not supported"); } - UsefulTestCase.assertSameElements(ContainerUtil.map(targetElements, element -> { - return SymbolPresentationUtil.getSymbolPresentableText(element); - }), expectedTargets); + UsefulTestCase.assertSameElements(ContainerUtil.map(targetElements, element -> SymbolPresentationUtil.getSymbolPresentableText(element)), expectedTargets); } } diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java index b8f60d291679..da0a7493f24c 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java @@ -96,9 +96,7 @@ public class ExportEclipseProjectsAction extends AnAction implements DumbAware { } } else if (Messages.showOkCancelDialog(project, "Eclipse incompatible modules found:

  • " + - StringUtil.join(incompatibleModules, module -> { - return module.getName(); - }, "
  • ") + + StringUtil.join(incompatibleModules, module -> module.getName(), "
  • ") + "

Would you like to proceed and possibly lose your configurations?", EclipseBundle.message("eclipse.export.dialog.title"), Messages.getWarningIcon()) != Messages.OK) { return; diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java index 32bc2562c34e..730ee14d3d69 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java @@ -250,9 +250,7 @@ public class EclipseImportBuilder extends ProjectImportBuilder implement if (!files.isEmpty()) { final int resultCode = Messages.showYesNoCancelDialog(ApplicationNamesInfo.getInstance().getFullProductName() + " module files found:\n" + - StringUtil.join(files, file -> { - return file.getPath(); - }, "\n") + + StringUtil.join(files, file -> file.getPath(), "\n") + ".\n Would you like to reuse them?", "Module Files Found", Messages.getQuestionIcon()); if (resultCode != Messages.YES) { @@ -309,15 +307,11 @@ public class EclipseImportBuilder extends ProjectImportBuilder implement ClasspathStorage.setStorageType(rootModel, getParameters().linkConverted ? JpsEclipseClasspathSerializer.CLASSPATH_STORAGE_ID : ClassPathStorageUtil.DEFAULT_STORAGE); if (model != null) { - ApplicationManager.getApplication().runWriteAction(() -> { - rootModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> rootModel.commit()); } } if (model == null) { - ApplicationManager.getApplication().runWriteAction(() -> { - ModifiableModelCommitter.multiCommit(rootModels, moduleModel); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModifiableModelCommitter.multiCommit(rootModels, moduleModel)); } } catch (Exception e) { diff --git a/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringActionHandlerImpl.java b/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringActionHandlerImpl.java index 111ae7b8ce6d..b54efc6cc218 100644 --- a/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringActionHandlerImpl.java +++ b/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringActionHandlerImpl.java @@ -237,9 +237,7 @@ public class GenerateToStringActionHandlerImpl implements GenerateToStringAction } }; - ShowSettingsUtil.getInstance().editConfigurable(MemberChooserHeaderPanel.this, composite, () -> { - ui.selectItem(ToStringTemplatesManager.getInstance().getDefaultTemplate()); - }); + ShowSettingsUtil.getInstance().editConfigurable(MemberChooserHeaderPanel.this, composite, () -> ui.selectItem(ToStringTemplatesManager.getInstance().getDefaultTemplate())); Disposer.dispose(disposable); } }); diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java index 1c08e2592313..d22c56f7f2c2 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java @@ -219,9 +219,7 @@ public class GithubCreateGistAction extends DumbAwareAction { @Nullable private static String getContentFromEditor(@NotNull final Editor editor) { - String text = ReadAction.compute(() -> { - return editor.getSelectionModel().getSelectedText(); - }); + String text = ReadAction.compute(() -> editor.getSelectionModel().getSelectedText()); if (text == null) { text = editor.getDocument().getText(); } diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java index 7705e6ebc3da..fafb2a96c4f7 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java @@ -227,9 +227,7 @@ public class GithubRebaseAction extends DumbAwareAction { List rootsToSave = Collections.singletonList(gitRepository.getRoot()); GitPreservingProcess process = new GitPreservingProcess(project, git, rootsToSave, "Rebasing", "upstream/master", GitVcsSettings.UpdateChangesPolicy.STASH, indicator, - () -> { - doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator); - }); + () -> doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator)); process.execute(); } finally { diff --git a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java index 832c0a1b45e2..4300a01240ea 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java +++ b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java @@ -146,9 +146,7 @@ public class GithubRepository extends BaseRepositoryImpl { GithubApiUtil.getIssuesQueried(connection, getRepoAuthor(), getRepoName(), assigned, query, withClosed); } - return ContainerUtil.map2Array(issues, Task.class, issue -> { - return createTask(issue); - }); + return ContainerUtil.map2Array(issues, Task.class, issue -> createTask(issue)); } finally { connection.close(); @@ -242,11 +240,9 @@ public class GithubRepository extends BaseRepositoryImpl { try { List result = GithubApiUtil.getIssueComments(connection, getRepoAuthor(), getRepoName(), id); - return ContainerUtil.map2Array(result, Comment.class, comment -> { - return new GithubComment(comment.getCreatedAt(), comment.getUser().getLogin(), comment.getBodyHtml(), - comment.getUser().getAvatarUrl(), - comment.getUser().getHtmlUrl()); - }); + return ContainerUtil.map2Array(result, Comment.class, comment -> new GithubComment(comment.getCreatedAt(), comment.getUser().getLogin(), comment.getBodyHtml(), + comment.getUser().getAvatarUrl(), + comment.getUser().getHtmlUrl())); } finally { connection.close(); diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java index 5a68de844aec..0b435b4d7d7c 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java +++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java @@ -54,9 +54,7 @@ public class GithubCreatePullRequestDialog extends DialogWrapper { myProjectSettings = GithubProjectSettings.getInstance(project); myPanel = new GithubCreatePullRequestPanel(); - myPanel.getShowDiffButton().addActionListener(e -> { - myWorker.showDiffDialog(myPanel.getSelectedBranch()); - }); + myPanel.getShowDiffButton().addActionListener(e -> myWorker.showDiffDialog(myPanel.getSelectedBranch())); myPanel.getSelectForkButton().addActionListener(e -> { ForkInfo fork = myWorker.showTargetDialog(); if (fork != null) { diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java index dcffc231b0ef..b3f2a35d528c 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java +++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java @@ -244,9 +244,7 @@ public class GithubUtil { GithubApiUtil.askForTwoFactorCodeSMS(new GithubConnection(oldAuth, false)); final Ref codeRef = new Ref(); - ApplicationManager.getApplication().invokeAndWait(() -> { - codeRef.set(Messages.showInputDialog(project, "Authentication Code", "Github Two-Factor Authentication", null)); - }, indicator.getModalityState()); + ApplicationManager.getApplication().invokeAndWait(() -> codeRef.set(Messages.showInputDialog(project, "Authentication Code", "Github Two-Factor Authentication", null)), indicator.getModalityState()); if (codeRef.isNull()) { throw new GithubOperationCanceledException("Can't get two factor authentication code"); } diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/codeInsight/actions/AddGradleDslPluginActionTest.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/codeInsight/actions/AddGradleDslPluginActionTest.java index 6e556856e87b..7cb1ec16930f 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/codeInsight/actions/AddGradleDslPluginActionTest.java +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/codeInsight/actions/AddGradleDslPluginActionTest.java @@ -39,9 +39,7 @@ public class AddGradleDslPluginActionTest extends LightPlatformCodeInsightFixtur private void doTest(String file, String pluginName) { AddGradleDslPluginAction.TEST_THREAD_LOCAL.set(pluginName); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - CodeInsightTestUtil.doActionTest(new AddGradleDslPluginAction(), file, myFixture); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeInsightTestUtil.doActionTest(new AddGradleDslPluginAction(), file, myFixture)); } @Override diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/integrations/maven/codeInsight/actions/AddGradleDslDependencyActionTest.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/integrations/maven/codeInsight/actions/AddGradleDslDependencyActionTest.java index d6683d8be9de..3196f9801e71 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/integrations/maven/codeInsight/actions/AddGradleDslDependencyActionTest.java +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/integrations/maven/codeInsight/actions/AddGradleDslDependencyActionTest.java @@ -41,9 +41,7 @@ public class AddGradleDslDependencyActionTest extends LightPlatformCodeInsightFi } private void doTest(String file) { - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - CodeInsightTestUtil.doActionTest(new AddGradleDslDependencyAction(), file, myFixture); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeInsightTestUtil.doActionTest(new AddGradleDslDependencyAction(), file, myFixture)); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java index 4c5c46781dcf..bbcd51d81c56 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java @@ -116,9 +116,7 @@ public abstract class ClashingTraitMethodsInspectionBase extends BaseInspection @NotNull private String buildTraitString(@NotNull ClashingMethod entry) { - return StringUtil.join(entry.getSuperTraits(), tr -> { - return tr.getName(); - }, ", "); + return StringUtil.join(entry.getSuperTraits(), tr -> tr.getName(), ", "); } }; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java index 92850d9a5ec9..ecaf2177b143 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java @@ -921,9 +921,7 @@ public class GroovyTypeCheckVisitor extends BaseInspectionVisitor { GrParameter[] parameters = parameterList.getParameters(); if (parameters.length > 0) { List signatures = ClosureParamsEnhancer.findFittingSignatures((GrClosableBlock)parent); - final List paramTypes = ContainerUtil.map(parameters, parameter -> { - return parameter.getType(); - }); + final List paramTypes = ContainerUtil.map(parameters, parameter -> parameter.getType()); if (signatures.size() > 1) { final PsiType[] fittingSignature = ContainerUtil.find(signatures, new Condition() { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/config/GroovyConfigUtils.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/config/GroovyConfigUtils.java index d0f00cfe65a2..00bc5009d530 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/config/GroovyConfigUtils.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/config/GroovyConfigUtils.java @@ -154,8 +154,6 @@ public abstract class GroovyConfigUtils extends AbstractConfigUtils { } public Collection getSDKVersions(Library[] libraries) { - return ContainerUtil.map2List(libraries, library -> { - return getSDKLibVersion(library); - }); + return ContainerUtil.map2List(libraries, library -> getSDKLibVersion(library)); } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java index 366af3b3d0b4..b8a50fda5e7c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java @@ -180,9 +180,7 @@ public class LiteralConstructorReference extends PsiReferenceBase.Poly)grExpression -> { - return grExpression.getType(); - }); + return ContainerUtil.map2Array(arguments, PsiType.class, (NullableFunction)grExpression -> grExpression.getType()); } @NotNull diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppClosureParameterTypeProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppClosureParameterTypeProvider.java index de0711caf8b3..6507f17a5ed2 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppClosureParameterTypeProvider.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppClosureParameterTypeProvider.java @@ -152,9 +152,7 @@ public class GppClosureParameterTypeProvider extends AbstractClosureParameterEnh } public static PsiType[] getParameterTypes(final Pair pair) { - return ContainerUtil.map2Array(pair.first.getParameterList().getParameters(), PsiType.class, psiParameter -> { - return pair.second.substitute(psiParameter.getType()); - }); + return ContainerUtil.map2Array(pair.first.getParameterList().getParameters(), PsiType.class, psiParameter -> pair.second.substitute(psiParameter.getType())); } @NotNull diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java index 516d7ae1c7da..f4910ad56913 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java @@ -62,9 +62,7 @@ public class GppExpectedTypesContributor extends GroovyExpectedTypesContributor private static List addExpectedConstructorParameters(GrListOrMap list, GrExpression[] args, GrExpression arg) { - PsiType[] argTypes = ContainerUtil.map2Array(args, PsiType.class, (NullableFunction)grExpression -> { - return grExpression.getType(); - }); + PsiType[] argTypes = ContainerUtil.map2Array(args, PsiType.class, (NullableFunction)grExpression -> grExpression.getType()); final ArrayList result = new ArrayList(); for (PsiType type : GroovyExpectedTypesProvider.getDefaultExpectedTypes(list)) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java index cd629802525b..b672602e4b0b 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java @@ -100,9 +100,7 @@ public class GroovyExpectedTypesProvider { public static List getDefaultExpectedTypes(@NotNull GrExpression element) { TypeConstraint[] constraints = calculateTypeConstraints(element); - return ContainerUtil.map(constraints, constraint -> { - return constraint.getDefaultType(); - }); + return ContainerUtil.map(constraints, constraint -> constraint.getDefaultType()); } private static class MyCalculator extends GroovyElementVisitor { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrLiteralClassType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrLiteralClassType.java index 9163ecc39355..ea82caa68288 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrLiteralClassType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrLiteralClassType.java @@ -125,9 +125,7 @@ public abstract class GrLiteralClassType extends PsiClassType { final PsiType[] params = getParameters(); if (params.length == 0 || params[0] == null) return name; - return name + "<" + StringUtil.join(params, psiType -> { - return psiType.getPresentableText(); - }, ", ") + ">"; + return name + "<" + StringUtil.join(params, psiType -> psiType.getPresentableText(), ", ") + ">"; } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java index 49d2da5f3d2d..1fcfbdd3cda1 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java @@ -50,9 +50,7 @@ public class GrMapTypeFromNamedArgs extends GrMapType { @NotNull @Override protected List> compute() { - return ContainerUtil.map(myOtherEntries, pair -> { - return Couple.of(inferTypePreventingRecursion(pair.first), inferTypePreventingRecursion(pair.second)); - }); + return ContainerUtil.map(myOtherEntries, pair -> Couple.of(inferTypePreventingRecursion(pair.first), inferTypePreventingRecursion(pair.second))); } }; diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrTraitType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrTraitType.java index 963aad33b1d8..e975c8d4e0e7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrTraitType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrTraitType.java @@ -64,9 +64,7 @@ public class GrTraitType extends PsiType { @NotNull @Override public String getPresentableText() { - return myExprType.getPresentableText() + " as " + StringUtil.join(ContainerUtil.map(myTraitTypes, type -> { - return type.getPresentableText(); - }), ", "); + return myExprType.getPresentableText() + " as " + StringUtil.join(ContainerUtil.map(myTraitTypes, type -> type.getPresentableText()), ", "); } @NotNull @@ -78,9 +76,7 @@ public class GrTraitType extends PsiType { @NotNull @Override public String getInternalCanonicalText() { - return myExprType.getCanonicalText() + " as " + StringUtil.join(ContainerUtil.map(myTraitTypes, type -> { - return type.getInternalCanonicalText(); - }), ", "); + return myExprType.getCanonicalText() + " as " + StringUtil.join(ContainerUtil.map(myTraitTypes, type -> type.getInternalCanonicalText()), ", "); } @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyNamesUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyNamesUtil.java index c8c1e5967eb2..052b0800d602 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyNamesUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyNamesUtil.java @@ -100,9 +100,7 @@ public class GroovyNamesUtil { } public static String camelToSnake(final String string) { - return StringUtil.join(camelizeString(string), s -> { - return StringUtil.decapitalize(s); - }, "-"); + return StringUtil.join(camelizeString(string), s -> StringUtil.decapitalize(s), "-"); } public static boolean isKeyword(@NotNull String name) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromAbstractTypeMethodsHintProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromAbstractTypeMethodsHintProcessor.java index 11e543c1ffef..780613dc20f7 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromAbstractTypeMethodsHintProcessor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromAbstractTypeMethodsHintProcessor.java @@ -47,8 +47,6 @@ public class FromAbstractTypeMethodsHintProcessor extends SignatureHintProcessor if (aClass == null) return Collections.emptyList(); Collection abstractSignatures = OverrideImplementExploreUtil.getMethodSignaturesToImplement(aClass); - return ContainerUtil.map(abstractSignatures, signature -> { - return signature.getParameterTypes(); - }); + return ContainerUtil.map(abstractSignatures, signature -> signature.getParameterTypes()); } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/LibrariesUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/LibrariesUtil.java index 8abd83afc4f4..5076e87faede 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/LibrariesUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/LibrariesUtil.java @@ -238,9 +238,7 @@ public class LibrariesUtil { public static File[] getFilesInDirectoryByPattern(String dirPath, final Pattern pattern) { File distDir = new File(dirPath); - File[] files = distDir.listFiles((dir, name) -> { - return pattern.matcher(name).matches(); - }); + File[] files = distDir.listFiles((dir, name) -> pattern.matcher(name).matches()); return files != null ? files : new File[0]; } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/equals/GroovyGenerateEqualsHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/equals/GroovyGenerateEqualsHandler.java index 799388710f23..6257a97bee34 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/equals/GroovyGenerateEqualsHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/equals/GroovyGenerateEqualsHandler.java @@ -121,9 +121,7 @@ public class GroovyGenerateEqualsHandler extends GenerateMembersHandlerBase { GroovyGenerateEqualsHelper helper = new GroovyGenerateEqualsHelper(project, aClass, myEqualsFields, myHashCodeFields, myNonNullFields, useInstanceofToCheckParameterType); Collection methods = helper.generateMembers(); - return ContainerUtil.map2List(methods, (Function>)s -> { - return new GroovyGenerationInfo(s); - }); + return ContainerUtil.map2List(methods, (Function>)s -> new GroovyGenerationInfo(s)); } @Override diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java index 97cd0cca2ecf..be93bfdb4370 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java @@ -112,9 +112,7 @@ public abstract class GrCreateFromUsageBaseFix extends Intention { int index = list.getSelectedIndex(); if (index < 0) return; final PsiClass aClass = (PsiClass)list.getSelectedValue(); - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - invokeImpl(project, aClass); - }), getText(), null); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> invokeImpl(project, aClass)), getText(), null); }; builder. diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicManagerImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicManagerImpl.java index 87e9f2163229..71367e523e17 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicManagerImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicManagerImpl.java @@ -352,18 +352,14 @@ public class DynamicManagerImpl extends DynamicManager { public Iterable getMethods(final String classQname) { DClassElement classElement = getRootElement().getClassElement(classQname); if (classElement == null) return Collections.emptyList(); - return ContainerUtil.map(classElement.getMethods(), methodElement -> { - return methodElement.getPsi(PsiManager.getInstance(myProject), classQname); - }); + return ContainerUtil.map(classElement.getMethods(), methodElement -> methodElement.getPsi(PsiManager.getInstance(myProject), classQname)); } @Override public Iterable getProperties(final String classQname) { DClassElement classElement = getRootElement().getClassElement(classQname); if (classElement == null) return Collections.emptyList(); - return ContainerUtil.map(classElement.getProperties(), propertyElement -> { - return propertyElement.getPsi(PsiManager.getInstance(myProject), classQname); - }); + return ContainerUtil.map(classElement.getProperties(), propertyElement -> propertyElement.getPsi(PsiManager.getInstance(myProject), classQname)); } @Override diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/ExcludeFromStubGenerationAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/ExcludeFromStubGenerationAction.java index b274a67221e6..12b4a7c5b51c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/ExcludeFromStubGenerationAction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/ExcludeFromStubGenerationAction.java @@ -47,9 +47,7 @@ public class ExcludeFromStubGenerationAction extends AnAction implements DumbAwa final Project project = file.getProject(); final GroovyCompilerConfigurable configurable = new GroovyCompilerConfigurable(project); - ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> { - configurable.getExcludes().addEntry(new ExcludeEntryDescription(virtualFile, false, true, project)); - }); + ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> configurable.getExcludes().addEntry(new ExcludeEntryDescription(virtualFile, false, true, project))); } @Override diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyStubNotificationProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyStubNotificationProvider.java index 49ebe7eab5c6..f99b4f0c1b0b 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyStubNotificationProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyStubNotificationProvider.java @@ -68,22 +68,18 @@ public class GroovyStubNotificationProvider extends EditorNotifications.Provider private static EditorNotificationPanel decorateStubFile(final VirtualFile file, final Project project) { final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("This stub is generated for Groovy class to make Groovy-Java cross-compilation possible"); - panel.createActionLabel("Go to the Groovy class", () -> { - DumbService.getInstance(project).withAlternativeResolveEnabled(() -> { - final PsiClass original = findClassByStub(project, file); - if (original != null) { - original.navigate(true); - } - }); - }); - panel.createActionLabel("Exclude from stub generation", () -> { - DumbService.getInstance(project).withAlternativeResolveEnabled(() -> { - final PsiClass psiClass = findClassByStub(project, file); - if (psiClass != null) { - ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile()); - } - }); - }); + panel.createActionLabel("Go to the Groovy class", () -> DumbService.getInstance(project).withAlternativeResolveEnabled(() -> { + final PsiClass original = findClassByStub(project, file); + if (original != null) { + original.navigate(true); + } + })); + panel.createActionLabel("Exclude from stub generation", () -> DumbService.getInstance(project).withAlternativeResolveEnabled(() -> { + final PsiClass psiClass = findClassByStub(project, file); + if (psiClass != null) { + ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile()); + } + })); return panel; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/config/DefaultGroovyFrameworkConfigNotification.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/config/DefaultGroovyFrameworkConfigNotification.java index 1038b6ce5519..6e4f33de4c44 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/config/DefaultGroovyFrameworkConfigNotification.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/config/DefaultGroovyFrameworkConfigNotification.java @@ -43,9 +43,7 @@ public class DefaultGroovyFrameworkConfigNotification extends GroovyFrameworkCon public EditorNotificationPanel createConfigureNotificationPanel(@NotNull final Module module) { final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText(GroovyBundle.message("groovy.library.is.not.configured.for.module", module.getName())); - panel.createActionLabel(GroovyBundle.message("configure.groovy.library"), () -> { - AddCustomLibraryDialog.createDialog(new GroovyLibraryDescription(), module, null).show(); - }); + panel.createActionLabel(GroovyBundle.message("configure.groovy.library"), () -> AddCustomLibraryDialog.createDialog(new GroovyLibraryDescription(), module, null).show()); return panel; } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyCodeFragmentFactory.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyCodeFragmentFactory.java index ca820da03bc0..1f07d8647327 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyCodeFragmentFactory.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyCodeFragmentFactory.java @@ -80,9 +80,7 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory { final Map parameters = pair.first; List names = new ArrayList(parameters.keySet()); - List values = ContainerUtil.map(names, name -> { - return parameters.get(name); - }); + List values = ContainerUtil.map(names, name -> parameters.get(name)); String text = toEval.getText(); final String groovyText = StringUtil.join(names, ", ") + "->" + stripImports(text, toEval); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java index a121d63c57a2..498888d413fd 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java @@ -498,9 +498,7 @@ public class GroovyBlockGenerator { GrStatement first = embedded ? inner : group.get(1); List alignments = ContainerUtil - .map2List(getSpockTable(first), leaf -> { - return myAlignmentProvider.createAligner(leaf, true, Alignment.Anchor.RIGHT); - }); + .map2List(getSpockTable(first), leaf -> myAlignmentProvider.createAligner(leaf, true, Alignment.Anchor.RIGHT)); int second = embedded ? 1 : 2; for (int i = second; i < group.size(); i++) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/other/GrAliasImportIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/other/GrAliasImportIntention.java index 67b564ac3623..61785c6bd66d 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/other/GrAliasImportIntention.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/other/GrAliasImportIntention.java @@ -166,9 +166,7 @@ public class GrAliasImportIntention extends Intention { if (brokenOff) { if (importStatement != null) { - ApplicationManager.getApplication().runWriteAction(() -> { - importStatement.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> importStatement.delete()); } return; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java index 31dc674931dd..27c757a02b7c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/ConvertParameterToMapEntryIntention.java @@ -173,9 +173,7 @@ public class ConvertParameterToMapEntryIntention extends Intention { } private static String[] generateValidNames(final String[] names, final GrParameter param) { - return ContainerUtil.map2Array(names, String.class, s -> { - return (new GroovyValidationUtil.ParameterNameSuggester(s, param)).generateName(); - }); + return ContainerUtil.map2Array(names, String.class, s -> (new GroovyValidationUtil.ParameterNameSuggester(s, param)).generateName()); } private static void performRefactoring(final PsiElement element, @@ -274,9 +272,7 @@ public class ConvertParameterToMapEntryIntention extends Intention { final GrNamedArgument namedArg; if (argInfo.isMultiArg) { if (argInfo.args.isEmpty()) continue; - String arg = "[" + StringUtil.join(ContainerUtil.map(argInfo.args, element1 -> { - return element1.getText(); - }), ", ") + "]"; + String arg = "[" + StringUtil.join(ContainerUtil.map(argInfo.args, element1 -> element1.getText()), ", ") + "]"; for (PsiElement psiElement : argInfo.args) { psiElement.delete(); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java index b5a249def4de..3ea4bbf538f9 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java @@ -369,9 +369,7 @@ public class GroovyCompletionUtil { String tailText = getPackageText((PsiClass)element); final PsiClass psiClass = (PsiClass)element; if ((substitutor == null || substitutor.getSubstitutionMap().isEmpty()) && psiClass.getTypeParameters().length > 0) { - tailText = "<" + StringUtil.join(psiClass.getTypeParameters(), psiTypeParameter -> { - return psiTypeParameter.getName(); - }, "," + (showSpaceAfterComma(psiClass) ? " " : "")) + ">" + tailText; + tailText = "<" + StringUtil.join(psiClass.getTypeParameters(), psiTypeParameter -> psiTypeParameter.getName(), "," + (showSpaceAfterComma(psiClass) ? " " : "")) + ">" + tailText; } builder = builder.withTailText(tailText, true); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyTypeParameterInfoHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyTypeParameterInfoHandler.java index 4228f4a274d2..bccf9c761158 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyTypeParameterInfoHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parameterInfo/GroovyTypeParameterInfoHandler.java @@ -155,9 +155,7 @@ public class GroovyTypeParameterInfoHandler implements ParameterInfoHandlerWithT buffer.append(p.getName()); int highlightEndOffset = buffer.length(); buffer.append(" extends "); - buffer.append(StringUtil.join(p.getSuperTypes(), t -> { - return t.getPresentableText(); - }, ", ")); + buffer.append(StringUtil.join(p.getSuperTypes(), t -> t.getPresentableText(), ", ")); context.setupUIComponentPresentation(buffer.toString(), 0, highlightEndOffset, false, false, false, context.getDefaultParameterColor()); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java index c2823526040e..51742b5c9a55 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java @@ -253,9 +253,7 @@ public class MvcModuleStructureUtil { for (Consumer action : actions.second) { action.consume(model); } - application.invokeAndWait(() -> application.runWriteAction(() -> { - model.commit(); - }), application.getDefaultModalityState()); + application.invokeAndWait(() -> application.runWriteAction(() -> model.commit()), application.getDefaultModalityState()); } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcProjectWithoutLibraryNotificator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcProjectWithoutLibraryNotificator.java index 936aac196bf5..603909c82bdd 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcProjectWithoutLibraryNotificator.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcProjectWithoutLibraryNotificator.java @@ -59,9 +59,7 @@ public class MvcProjectWithoutLibraryNotificator implements StartupActivity, Dum .append("Module ").append('\'').append(module.getName()).append('\'') .append(" has no ").append(name).append(" SDK."); if (!actions.isEmpty()) content.append("
"); - content.append(StringUtil.join(actions.keySet(), actionName -> { - return String.format("%s", actionName, actionName); - }, " ")); + content.append(StringUtil.join(actions.keySet(), actionName -> String.format("%s", actionName, actionName), " ")); content.append(""); new Notification( diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureDialog.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureDialog.java index 1ef5deb1fdc2..55d46d616f74 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureDialog.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureDialog.java @@ -305,9 +305,7 @@ public class GrChangeSignatureDialog extends ChangeSignatureDialogBase infos = getParameters(); if (!infos.isEmpty()) { - final List paramsText = ContainerUtil.map(infos, info -> { - return generateParameterText(info); - }); + final List paramsText = ContainerUtil.map(infos, info -> generateParameterText(info)); builder.append("\n").append(INDENT); builder.append(StringUtil.join(paramsText, ",\n" + INDENT)); builder.append('\n'); @@ -317,9 +315,7 @@ public class GrChangeSignatureDialog extends ChangeSignatureDialogBase 0) { builder.append("\nthrows\n"); - final List exceptionNames = ContainerUtil.map(exceptions, fragment -> { - return fragment.getText(); - }); + final List exceptionNames = ContainerUtil.map(exceptions, fragment -> fragment.getText()); builder.append(INDENT).append(StringUtil.join(exceptionNames, ",\n" + INDENT)); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java index 7bad9e9d261a..26af8cdfa351 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ClassItemGeneratorImpl.java @@ -368,9 +368,7 @@ public class ClassItemGeneratorImpl implements ClassItemGenerator { Map setters = context.getSetters(); Set> entries = setters.entrySet(); if (ApplicationManager.getApplication().isUnitTestMode()) { - entries = ImmutableSortedSet.copyOf((o1, o2) -> { - return o1.getValue().compareTo(o2.getValue()); - }, entries); + entries = ImmutableSortedSet.copyOf((o1, o2) -> o1.getValue().compareTo(o2.getValue()), entries); } for (Map.Entry entry : entries) { new SetterWriter(builder, psiClass, entry.getKey(), entry.getValue(), classNameProvider, context).write(); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrAbstractInplaceIntroducer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrAbstractInplaceIntroducer.java index 877752195175..ddf9b72b0312 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrAbstractInplaceIntroducer.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrAbstractInplaceIntroducer.java @@ -175,9 +175,7 @@ public abstract class GrAbstractInplaceIntroducer result = ContainerUtil.map(getOccurrenceMarkers(), marker -> { - return PsiImplUtil.findElementInRange(myFile, marker.getStartOffset(), marker.getEndOffset(), GrExpression.class); - }); + List result = ContainerUtil.map(getOccurrenceMarkers(), marker -> PsiImplUtil.findElementInRange(myFile, marker.getStartOffset(), marker.getEndOffset(), GrExpression.class)); return PsiUtilCore.toPsiElementArray(result); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/safeDelete/JavaSafeDeleteDelegateForGroovy.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/safeDelete/JavaSafeDeleteDelegateForGroovy.java index 57c07d76a8b8..c25a6e4bb456 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/safeDelete/JavaSafeDeleteDelegateForGroovy.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/safeDelete/JavaSafeDeleteDelegateForGroovy.java @@ -73,9 +73,7 @@ public class JavaSafeDeleteDelegateForGroovy implements JavaSafeDeleteDelegate { newText.append('('); final List parameters = new ArrayList(Arrays.asList(method.getParameterList().getParameters())); parameters.remove(parameter); - newText.append(StringUtil.join(parameters, psiParameter -> { - return parameter.getType().getCanonicalText(); - }, ",")); + newText.append(StringUtil.join(parameters, psiParameter -> parameter.getType().getCanonicalText(), ",")); newText.append(")*/"); usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) { @Override diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/ConvertMapToClassTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/ConvertMapToClassTest.java index fee2a0cd91b7..a2d08fbb430c 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/ConvertMapToClassTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/ConvertMapToClassTest.java @@ -79,12 +79,10 @@ public class ConvertMapToClassTest extends GrIntentionTestCase { final GrTypeDefinition foo = ConvertMapToClassIntention.createClass(getProject(), map.getNamedArguments(), "", "Foo"); myFixture.addFileToProject(getTestName(true) + "/Foo.groovy", foo.getContainingFile().getText()); final PsiClass psiClass = myFixture.findClass("Foo"); - WriteCommandAction.runWriteCommandAction(null, () -> { - ConvertMapToClassIntention - .replaceMapWithClass(getProject(), map, psiClass, ConvertMapToClassIntention.checkForReturnFromMethod(map), - ConvertMapToClassIntention.checkForVariableDeclaration(map), - ConvertMapToClassIntention.checkForMethodParameter(map)); - }); + WriteCommandAction.runWriteCommandAction(null, () -> ConvertMapToClassIntention + .replaceMapWithClass(getProject(), map, psiClass, ConvertMapToClassIntention.checkForReturnFromMethod(map), + ConvertMapToClassIntention.checkForVariableDeclaration(map), + ConvertMapToClassIntention.checkForMethodParameter(map))); myFixture.checkResultByFile(getTestName(true) + "/Foo.groovy", getTestName(true) + "/Expected.groovy", true); myFixture.checkResultByFile(getTestName(true) + "/Test_after.groovy", true); diff --git a/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java index f20ae5559a45..f715f4faa335 100644 --- a/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -124,9 +124,7 @@ public class SingleClassesTest { File parent = classFile.getParentFile(); if (parent != null) { final String pattern = classFile.getName().replace(".class", "") + "\\$.+\\.class"; - File[] inner = parent.listFiles((dir, name) -> { - return name.matches(pattern); - }); + File[] inner = parent.listFiles((dir, name) -> name.matches(pattern)); if (inner != null) Collections.addAll(files, inner); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java index c0243bb55c0e..d1ec29cec2fe 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java @@ -135,19 +135,17 @@ public class I18nizeAction extends AnAction { if (!FileModificationService.getInstance().prepareFileForWrite(file.getContainingFile())) return; } - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> { - try { - handler.performI18nization(psiFile, editor, dialog.getLiteralExpression(), propertiesFiles, dialog.getKey(), - StringUtil.unescapeStringCharacters(dialog.getValue()), - dialog.getI18nizedText(), dialog.getParameters(), - dialog.getPropertyCreationHandler()); - } - catch (IncorrectOperationException e) { - LOG.error(e); - } - }, CodeInsightBundle.message("quickfix.i18n.command.name"), project); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { + try { + handler.performI18nization(psiFile, editor, dialog.getLiteralExpression(), propertiesFiles, dialog.getKey(), + StringUtil.unescapeStringCharacters(dialog.getValue()), + dialog.getI18nizedText(), dialog.getParameters(), + dialog.getPropertyCreationHandler()); + } + catch (IncorrectOperationException e) { + LOG.error(e); + } + }, CodeInsightBundle.message("quickfix.i18n.command.name"), project)); } @Override diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java index 5c068cfee651..3b95be9d1a36 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java @@ -149,9 +149,7 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor // XXX: strange behavior with undo/redo - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(myProject, () -> myDocument.setText(content), "JavaFX Scene Builder edit operation", null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myProject, () -> myDocument.setText(content), "JavaFX Scene Builder edit operation", null)); } finally { myChangeListener.setRunState(true); diff --git a/plugins/junit/src/com/intellij/execution/junit/TestObject.java b/plugins/junit/src/com/intellij/execution/junit/TestObject.java index 67f8a594fa87..aff6a8f5f946 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestObject.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestObject.java @@ -345,9 +345,7 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState> perModule = forkPerModule() ? new TreeMap>((o1, o2) -> { - return StringUtil.compare(o1.getName(), o2.getName(), true); - }) : null; + final Map> perModule = forkPerModule() ? new TreeMap>((o1, o2) -> StringUtil.compare(o1.getName(), o2.getName(), true)) : null; final List testNames = new ArrayList(); diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java index 2e8b767654a7..15325555956d 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java @@ -195,9 +195,7 @@ public class JUnitConfigurationModel { } } else { - WriteCommandAction.runWriteCommandAction(myProject, () -> { - ((Document)document).replaceString(0, ((Document)document).getTextLength(), text); - }); + WriteCommandAction.runWriteCommandAction(myProject, () -> ((Document)document).replaceString(0, ((Document)document).getTextLength(), text)); } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/generate/GenerateDependencyUtil.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/generate/GenerateDependencyUtil.java index 01e339cdd1aa..b0b8a4e544bc 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/generate/GenerateDependencyUtil.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/generate/GenerateDependencyUtil.java @@ -49,9 +49,7 @@ public class GenerateDependencyUtil { List dependencies = new ArrayList(); MavenDomProjectModelMember[] memberCandidates = - ContainerUtil.map2Array(candidates, MavenDomProjectModelMember.class, dependency -> { - return new MavenDomProjectModelMember(dependency); - }); + ContainerUtil.map2Array(candidates, MavenDomProjectModelMember.class, dependency -> new MavenDomProjectModelMember(dependency)); MemberChooser chooser = new MemberChooser(memberCandidates, true, true, project) { protected ShowContainersAction getShowContainersAction() { @@ -76,9 +74,7 @@ public class GenerateDependencyUtil { if (chooser.getExitCode() == MemberChooser.OK_EXIT_CODE) { final MavenDomProjectModelMember[] members = chooser.getSelectedElements(new MavenDomProjectModelMember[0]); if (members != null) { - dependencies.addAll(ContainerUtil.mapNotNull(members, mavenDomProjectModelMember -> { - return mavenDomProjectModelMember.getDependency(); - })); + dependencies.addAll(ContainerUtil.mapNotNull(members, mavenDomProjectModelMember -> mavenDomProjectModelMember.getDependency())); } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/javadoc/MojoClassAnnotationTagProvider.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/javadoc/MojoClassAnnotationTagProvider.java index 3f3acc93ca4e..b3c3541cc620 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/javadoc/MojoClassAnnotationTagProvider.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/javadoc/MojoClassAnnotationTagProvider.java @@ -44,9 +44,7 @@ public class MojoClassAnnotationTagProvider implements CustomJavadocTagProvider @Override public List getSupportedTags() { - return ContainerUtil.map(ANNOTATION_NAMES, name -> { - return new MojoAnnotationInfo(name); - }); + return ContainerUtil.map(ANNOTATION_NAMES, name -> new MojoAnnotationInfo(name)); } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java index 1f1060762f2f..5c95f8eb2c20 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java @@ -1246,9 +1246,7 @@ public class MavenProjectsTree { try { process.checkCanceled(); - final List names = ContainerUtil.mapNotNull(mavenProjects, project12 -> { - return project12.getDisplayName(); - }); + final List names = ContainerUtil.mapNotNull(mavenProjects, project12 -> project12.getDisplayName()); final String text = StringUtil.shortenPathWithEllipsis(StringUtil.join(names, ", "), 200); process.setText(ProjectBundle.message("maven.resolving.pom", text)); process.setText2(""); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderWrapper.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderWrapper.java index 7bdb019be924..eac8169c203a 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderWrapper.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderWrapper.java @@ -122,9 +122,7 @@ public abstract class MavenEmbedderWrapper extends RemoteObjectWrapper>() { @Override public Collection execute() throws RemoteException, MavenServerProcessCanceledException { - final List ioFiles = ContainerUtil.map(files, file -> { - return new File(file.getPath()); - }); + final List ioFiles = ContainerUtil.map(files, file -> new File(file.getPath())); return getOrCreateWrappee().resolveProject(ioFiles, activeProfiles, inactiveProfiles); } }); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java index 13ed1dd35d30..ce2bf4633f5a 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java @@ -444,9 +444,7 @@ public class MavenServerManager extends RemoteObjectWrapper impleme private static void addMavenLibs(List classpath, File mavenHome) { addDir(classpath, new File(mavenHome, "lib")); File bootFolder = new File(mavenHome, "boot"); - File[] classworldsJars = bootFolder.listFiles((dir, name) -> { - return StringUtil.contains(name, "classworlds"); - }); + File[] classworldsJars = bootFolder.listFiles((dir, name) -> StringUtil.contains(name, "classworlds")); if (classworldsJars != null) { Collections.addAll(classpath, classworldsJars); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java index 019dafc946c1..ad13d0c56a41 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java @@ -252,15 +252,11 @@ public class MavenUtil { } public static List collectPaths(List files) { - return ContainerUtil.map(files, file -> { - return file.getPath(); - }); + return ContainerUtil.map(files, file -> file.getPath()); } public static List collectFiles(Collection projects) { - return ContainerUtil.map(projects, project -> { - return project.getFile(); - }); + return ContainerUtil.map(projects, project -> project.getFile()); } public static boolean equalAsSets(final Collection collection1, final Collection collection2) { @@ -272,9 +268,7 @@ public class MavenUtil { } public static List> mapToList(Map map) { - return ContainerUtil.map2List(map.entrySet(), tuEntry -> { - return Pair.create(tuEntry.getKey(), tuEntry.getValue()); - }); + return ContainerUtil.map2List(map.entrySet(), tuEntry -> Pair.create(tuEntry.getKey(), tuEntry.getValue())); } public static String formatHtmlImage(URL url) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryAttachHandler.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryAttachHandler.java index ea2c9a0c3737..be41aad3a1f1 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryAttachHandler.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryAttachHandler.java @@ -268,9 +268,7 @@ public class RepositoryAttachHandler { if (!proceedFlag.get()) break; final Boolean aBoolean = i == length - 1 ? tooManyResults : null; ApplicationManager.getApplication().invokeLater( - () -> { - proceedFlag.set(resultProcessor.process(resultList, aBoolean)); - }, new Condition() { + () -> proceedFlag.set(resultProcessor.process(resultList, aBoolean)), new Condition() { @Override public boolean value(Object o) { return !proceedFlag.get(); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryLibrarySupport.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryLibrarySupport.java index 5f219006b590..ec5c6b844a36 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryLibrarySupport.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/RepositoryLibrarySupport.java @@ -91,9 +91,7 @@ public class RepositoryLibrarySupport { RepositoryLibraryProperties realLibraryProperties = (RepositoryLibraryProperties)library.getProperties(); realLibraryProperties.setMavenId(libraryProperties.getMavenId()); - ApplicationManager.getApplication().runWriteAction(() -> { - modifiableModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> modifiableModel.commit()); RepositoryUtils.loadDependencies( module.getProject(), library, diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/propertiesEditor/RepositoryLibraryPropertiesEditor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/propertiesEditor/RepositoryLibraryPropertiesEditor.java index dc0d901704f1..12a6e4862db4 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/propertiesEditor/RepositoryLibraryPropertiesEditor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/propertiesEditor/RepositoryLibraryPropertiesEditor.java @@ -253,15 +253,11 @@ public class RepositoryLibraryPropertiesEditor { return; } - ApplicationManager.getApplication().invokeLater(() -> { - initVersionsPanel(); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> initVersionsPanel(), ModalityState.any()); } private void versionsFailedToLoad() { - ApplicationManager.getApplication().invokeLater(() -> { - setState(State.FailedToLoad); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> setState(State.FailedToLoad), ModalityState.any()); } public String getSelectedVersion() { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/remote/MavenRemoteManager.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/remote/MavenRemoteManager.java index 34ddd775d232..d8167ab9ccd7 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/remote/MavenRemoteManager.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/library/remote/MavenRemoteManager.java @@ -109,9 +109,7 @@ public abstract class MavenRemoteManager { - startTask(); - }, ModalityState.any()); + ApplicationManager.getApplication().invokeLater(() -> startTask(), ModalityState.any()); } } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomTestCase.java index f2f125e9f8f7..58c005361837 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomTestCase.java @@ -383,9 +383,7 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase { }); PsiElement target = ((PsiElement2UsageTargetAdapter)targets[0]).getElement(); List result = new ArrayList(ReferencesSearch.search(target).findAll()); - return ContainerUtil.map(result, psiReference -> { - return psiReference.getElement(); - }); + return ContainerUtil.map(result, psiReference -> psiReference.getElement()); } protected void assertHighlighted(VirtualFile file, HighlightInfo... expected) throws IOException { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenPropertyResolverTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenPropertyResolverTest.java index 87aad68a56ed..fe58f73dec06 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenPropertyResolverTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenPropertyResolverTest.java @@ -259,15 +259,13 @@ public class MavenPropertyResolverTest extends MavenImportingTestCase { "1"); final Document doc = FileDocumentManager.getInstance().getDocument(myProjectPom); - WriteCommandAction.runWriteCommandAction(null, () -> { - doc.setText(createPomXml("test" + - "project" + - "2" + + WriteCommandAction.runWriteCommandAction(null, () -> doc.setText(createPomXml("test" + + "project" + + "2" + - "" + - " value" + - "")); - }); + "" + + " value" + + ""))); PsiDocumentManager.getInstance(myProject).commitDocument(doc); diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenClasspathsAndSearchScopesTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenClasspathsAndSearchScopesTest.java index 443efbb3e2b1..2e0a56cc34cf 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenClasspathsAndSearchScopesTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/execution/MavenClasspathsAndSearchScopesTest.java @@ -1314,7 +1314,7 @@ public class MavenClasspathsAndSearchScopesTest extends MavenImportingTestCase { } private static List orderEntriesToOwnerModules(List orderEntries) { - return ContainerUtil.map(orderEntries, orderEntry -> { return orderEntry.getOwnerModule(); }); + return ContainerUtil.map(orderEntries, orderEntry -> orderEntry.getOwnerModule()); } private static List orderEntriesToDepModules(List orderEntries) { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/WorkingWithOpenProjectTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/WorkingWithOpenProjectTest.java index df9570a70858..bad592ee329d 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/WorkingWithOpenProjectTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/WorkingWithOpenProjectTest.java @@ -56,19 +56,17 @@ public class WorkingWithOpenProjectTest extends MavenImportingTestCase { myProjectsManager.listenForExternalChanges(); final Document d = FileDocumentManager.getInstance().getDocument(myProjectPom); - WriteCommandAction.runWriteCommandAction(null, () -> { - d.setText(createPomXml("test" + - "project" + - "1" + + WriteCommandAction.runWriteCommandAction(null, () -> d.setText(createPomXml("test" + + "project" + + "1" + - "" + - " " + - " junit" + - " junit" + - " 4.0" + - " " + - "")); - }); + "" + + " " + + " junit" + + " junit" + + " 4.0" + + " " + + ""))); resolveDependenciesAndImport(); diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java index 50670bff0da6..b8fbf633e93f 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java @@ -1037,9 +1037,7 @@ public class MavenProjectReaderTest extends MavenTestCase { ""); MavenModel p = readProject(module); - assertOrderedElementsAreEqual(ContainerUtil.map(p.getProfiles(), (Function)profile -> { - return profile.getId(); - }), "profileFromChild", "profileFromParent"); + assertOrderedElementsAreEqual(ContainerUtil.map(p.getProfiles(), (Function)profile -> profile.getId()), "profileFromChild", "profileFromParent"); } public void testCorrectlyCollectProfilesFromDifferentSources() throws Exception { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeIgnoresTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeIgnoresTest.java index c17c28a2e6f4..09d1dace13d3 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeIgnoresTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeIgnoresTest.java @@ -87,9 +87,7 @@ public class MavenProjectsTreeIgnoresTest extends MavenProjectsTreeTestCase { } private String format(List projects) { - return StringUtil.join(projects, project -> { - return project.getMavenId().getArtifactId(); - }, ", "); + return StringUtil.join(projects, project -> project.getMavenId().getArtifactId(), ", "); } } } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeReadingTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeReadingTest.java index 900635679268..c54f32128362 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeReadingTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectsTreeReadingTest.java @@ -2254,9 +2254,7 @@ public class MavenProjectsTreeReadingTest extends MavenProjectsTreeTestCase { log += " "; return; } - log += StringUtil.join(updated, each -> { - return each.getMavenId().getArtifactId(); - }, " ") + " "; + log += StringUtil.join(updated, each -> each.getMavenId().getArtifactId(), " ") + " "; } @Override diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundle.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundle.java index 8a4a46a17747..b6efa805ec7e 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundle.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundle.java @@ -50,9 +50,7 @@ public class CustomResourceBundle extends ResourceBundle { public static CustomResourceBundle fromState(final CustomResourceBundleState state, final Project project) { final PsiManager psiManager = PsiManager.getInstance(project); final List files = - ContainerUtil.map(state.getFiles(VirtualFileManager.getInstance()), virtualFile -> { - return PropertiesImplUtil.getPropertiesFile(psiManager.findFile(virtualFile)); - }); + ContainerUtil.map(state.getFiles(VirtualFileManager.getInstance()), virtualFile -> PropertiesImplUtil.getPropertiesFile(psiManager.findFile(virtualFile))); return files.size() < 2 ? null : new CustomResourceBundle(files, state.getBaseName()); } diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundleState.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundleState.java index 4fc58b311c50..0bf96d232d5c 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundleState.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/CustomResourceBundleState.java @@ -56,9 +56,7 @@ public class CustomResourceBundleState { } public List getFiles(@NotNull final VirtualFileManager manager) { - return ContainerUtil.mapNotNull(getFileUrls(), url -> { - return manager.findFileByUrl(url); - }); + return ContainerUtil.mapNotNull(getFileUrls(), url -> manager.findFileByUrl(url)); } @Nullable diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java index f6e488bb4749..5fb32e6cc395 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java @@ -234,9 +234,7 @@ public class ResourceBundleManager implements PersistentStateComponent propertiesFiles, final String baseName) { myState.getCustomResourceBundles() - .add(new CustomResourceBundleState().addAll(ContainerUtil.map(propertiesFiles, file -> { - return file.getVirtualFile().getUrl(); - })).setBaseName(baseName)); + .add(new CustomResourceBundleState().addAll(ContainerUtil.map(propertiesFiles, file -> file.getVirtualFile().getUrl())).setBaseName(baseName)); } @Nullable diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java index f71e330febfb..70ca82600647 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java @@ -153,9 +153,7 @@ public class ResourceBundleFileStructureViewElement implements StructureViewTree @Override public PsiFile[] getFiles() { final List files = getValue().getPropertiesFiles(); - return ContainerUtil.map2Array(files, new PsiFile[files.size()], propertiesFile -> { - return propertiesFile.getContainingFile(); - }); + return ContainerUtil.map2Array(files, new PsiFile[files.size()], propertiesFile -> propertiesFile.getContainingFile()); } public void navigate(boolean requestFocus) { diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/inspections/ResourceBundleEditorInspectionPass.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/inspections/ResourceBundleEditorInspectionPass.java index f7e09db245b9..fd4b3831e07d 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/inspections/ResourceBundleEditorInspectionPass.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/inspections/ResourceBundleEditorInspectionPass.java @@ -49,9 +49,7 @@ public class ResourceBundleEditorInspectionPass { @Nullable public static InspectionPassInfo inspect(@NotNull final String key, ResourceBundle resourceBundle) { final List properties = - ContainerUtil.mapNotNull(resourceBundle.getPropertiesFiles(), propertiesFile -> { - return propertiesFile.findPropertyByKey(key); - }); + ContainerUtil.mapNotNull(resourceBundle.getPropertiesFiles(), propertiesFile -> propertiesFile.findPropertyByKey(key)); if (properties.isEmpty()) { return null; diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java index 2954ba9eb25e..407022bec9d3 100644 --- a/plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java +++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java @@ -69,9 +69,7 @@ public class PropertiesDocumentationProvider extends AbstractDocumentationProvid if (background != null) { info +="
"; } - String doc = StringUtil.join(ContainerUtil.map(StringUtil.split(text, "\n"), s -> { - return StringUtil.trimStart(StringUtil.trimStart(s, "#"), "!").trim(); - }), "
"); + String doc = StringUtil.join(ContainerUtil.map(StringUtil.split(text, "\n"), s -> StringUtil.trimStart(StringUtil.trimStart(s, "#"), "!").trim()), "
"); info += "" + doc + "\n
"; if (background != null) { info += "
"; diff --git a/plugins/properties/src/com/intellij/lang/properties/create/CreateResourceBundleDialogComponent.java b/plugins/properties/src/com/intellij/lang/properties/create/CreateResourceBundleDialogComponent.java index b9759f782a66..92905ac29978 100644 --- a/plugins/properties/src/com/intellij/lang/properties/create/CreateResourceBundleDialogComponent.java +++ b/plugins/properties/src/com/intellij/lang/properties/create/CreateResourceBundleDialogComponent.java @@ -322,9 +322,7 @@ public class CreateResourceBundleDialogComponent { restrictedLocales = Collections.emptyList(); } else { locales = Collections.emptyList(); - restrictedLocales = ContainerUtil.map(myResourceBundle.getPropertiesFiles(), propertiesFile -> { - return propertiesFile.getLocale(); - }); + restrictedLocales = ContainerUtil.map(myResourceBundle.getPropertiesFiles(), propertiesFile -> propertiesFile.getLocale()); } myLocalesModel = new CollectionListModel(locales) { @Override diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java b/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java index 242cf551718c..4ecf5c5f5f39 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java @@ -53,9 +53,7 @@ public class GotoResourceBundleLocalizationsProvider extends GotoRelatedProvider if (bundlePropertiesFiles.size() != 1) { final ArrayList propertiesFilesWithoutCurrent = ContainerUtil.newArrayList(bundlePropertiesFiles); propertiesFilesWithoutCurrent.remove(psiFile); - return ContainerUtil.map(propertiesFilesWithoutCurrent, propertiesFile -> { - return new GotoRelatedItem((PsiElement) propertiesFile, "Other Localizations"); - }); + return ContainerUtil.map(propertiesFilesWithoutCurrent, propertiesFile -> new GotoRelatedItem((PsiElement) propertiesFile, "Other Localizations")); } else { return Collections.emptyList(); } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java b/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java index ec5d3633dbdd..ab0ade64c0f4 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/NewPropertyAction.java @@ -160,11 +160,7 @@ class NewPropertyAction extends AnAction { } } - ApplicationManager.getApplication().runWriteAction(() -> { - WriteCommandAction.runWriteCommandAction(resourceBundle.getProject(), () -> { - myResourceBundleEditor.getPropertiesInsertDeleteManager().insertNewProperty(newPropertyName, ""); - }); - }); + ApplicationManager.getApplication().runWriteAction(() -> WriteCommandAction.runWriteCommandAction(resourceBundle.getProject(), () -> myResourceBundleEditor.getPropertiesInsertDeleteManager().insertNewProperty(newPropertyName, ""))); myResourceBundleEditor.updateTreeRoot(); myResourceBundleEditor.selectProperty(newPropertyName); diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java index 78733581f969..1f9006a4c6d4 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java @@ -102,9 +102,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase { } final ResourceBundle resourceBundle = representative.getPropertiesFile().getResourceBundle(); final List properties = ContainerUtil.mapNotNull(resourceBundle.getPropertiesFiles(), - (NullableFunction)propertiesFile -> { - return propertiesFile.findPropertyByKey(key); - }); + (NullableFunction)propertiesFile -> propertiesFile.findPropertyByKey(key)); final PropertiesCopyDialog dlg = new PropertiesCopyDialog(properties, resourceBundle); if (!properties.isEmpty() && dlg.showAndGet()) { final String propertyNewName = dlg.getCurrentPropertyName(); @@ -140,9 +138,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase { if (!propertiesFileMapping.isEmpty()) { WriteCommandAction.runWriteCommandAction(project, () -> { if (!FileModificationService.getInstance().preparePsiElementsForWrite(ContainerUtil.map(propertiesFileMapping.values(), - (Function)file -> { - return file.getContainingFile(); - }))) return; + (Function)file -> file.getContainingFile()))) return; for (Map.Entry entry : propertiesFileMapping.entrySet()) { final String value = entry.getKey().getValue(); final PropertiesFile target = entry.getValue(); diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java index d1130ebfb029..bfc20426a5d0 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java @@ -177,9 +177,7 @@ public class ResourceBundleAsVirtualFile extends VirtualFile { @Override public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) { - List files = ContainerUtil.mapNotNull(myResourceBundle.getPropertiesFiles(), file -> { - return file.getVirtualFile(); - }); + List files = ContainerUtil.mapNotNull(myResourceBundle.getPropertiesFiles(), file -> file.getVirtualFile()); if (!files.isEmpty()) { RefreshQueue.getInstance().refresh(false, false, postRunnable, files); } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java index 32878943fa50..de9aa32bf433 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java @@ -368,23 +368,21 @@ public class ResourceBundleEditor extends UserDataHolderBase implements Document return; } - ApplicationManager.getApplication().runWriteAction(() -> { - WriteCommandAction.runWriteCommandAction(myProject, () -> { - try { + ApplicationManager.getApplication().runWriteAction(() -> WriteCommandAction.runWriteCommandAction(myProject, () -> { + try { - if (currentValue.isEmpty() && - ResourceBundleEditorKeepEmptyValueToggleAction.keepEmptyProperties() && - propertiesFile.equals(myResourceBundle.getDefaultPropertiesFile().getVirtualFile())) { - myPropertiesInsertDeleteManager.deletePropertyIfExist(currentSelectedProperty, PropertiesImplUtil.getPropertiesFile(propertiesFile, myProject)); - } else { - myPropertiesInsertDeleteManager.insertOrUpdateTranslation(currentSelectedProperty, currentValue, PropertiesImplUtil.getPropertiesFile(propertiesFile, myProject)); - } + if (currentValue.isEmpty() && + ResourceBundleEditorKeepEmptyValueToggleAction.keepEmptyProperties() && + propertiesFile.equals(myResourceBundle.getDefaultPropertiesFile().getVirtualFile())) { + myPropertiesInsertDeleteManager.deletePropertyIfExist(currentSelectedProperty, PropertiesImplUtil.getPropertiesFile(propertiesFile, myProject)); + } else { + myPropertiesInsertDeleteManager.insertOrUpdateTranslation(currentSelectedProperty, currentValue, PropertiesImplUtil.getPropertiesFile(propertiesFile, myProject)); } - catch (final IncorrectOperationException e) { - LOG.error(e); - } - }); - }); + } + catch (final IncorrectOperationException e) { + LOG.error(e); + } + })); } void recreateEditorsPanel() { @@ -856,9 +854,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements Document @Override public Document[] getDocuments() { - return ContainerUtil.map2Array(myEditors.keySet(), new Document[myEditors.size()], propertiesFile -> { - return FileDocumentManager.getInstance().getDocument(propertiesFile); - }); + return ContainerUtil.map2Array(myEditors.keySet(), new Document[myEditors.size()], propertiesFile -> FileDocumentManager.getInstance().getDocument(propertiesFile)); } Map getTranslationEditors() { @@ -925,23 +921,21 @@ public class ResourceBundleEditor extends UserDataHolderBase implements Document if (currentSelectedProperty == null) { return; } - ApplicationManager.getApplication().runWriteAction(() -> { - WriteCommandAction.runWriteCommandAction(myProject, () -> { - try { - for (Map.Entry entry : myEditors.entrySet()) { - final Editor translationEditor = entry.getValue(); - if (translationEditor != editor) { - final VirtualFile propertiesFile = entry.getKey(); - myPropertiesInsertDeleteManager.insertOrUpdateTranslation(currentSelectedProperty, valueToPropagate, PropertiesImplUtil.getPropertiesFile(propertiesFile, myProject)); - translationEditor.getDocument().setText(valueToPropagate); - } + ApplicationManager.getApplication().runWriteAction(() -> WriteCommandAction.runWriteCommandAction(myProject, () -> { + try { + for (Map.Entry entry : myEditors.entrySet()) { + final Editor translationEditor = entry.getValue(); + if (translationEditor != editor) { + final VirtualFile propertiesFile = entry.getKey(); + myPropertiesInsertDeleteManager.insertOrUpdateTranslation(currentSelectedProperty, valueToPropagate, PropertiesImplUtil.getPropertiesFile(propertiesFile, myProject)); + translationEditor.getDocument().setText(valueToPropagate); } } - catch (final IncorrectOperationException e1) { - LOG.error(e1); - } - }); - }); + } + catch (final IncorrectOperationException e1) { + LOG.error(e1); + } + })); } }); EditorPopupHandler handler = EditorActionUtil.createEditorPopupHandler(group); diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java index af4676ee7f58..6d73c3a1bdbe 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java @@ -120,9 +120,7 @@ public class ResourceBundleStructureViewComponent extends PropertiesGroupingStru ContainerUtil.mapNotNull(selectedElements, (NullableFunction>)element -> { final IProperty[] properties = element.getProperties(); return properties == null ? null : ContainerUtil.newArrayList(properties); - })), count -> { - return new IProperty[count]; - }); + })), count -> new IProperty[count]); } } else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) { diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspection.java b/plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspection.java index 5df2e73a02a3..c53fe711300b 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspection.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspection.java @@ -137,9 +137,7 @@ public class IncompletePropertyInspection extends LocalInspectionTool implements final TreeSet suffixesToIgnore = new TreeSet(ContainerUtil.map(allFilesWithoutTranslation, - file -> { - return PropertiesUtil.getSuffix(file); - })); + file -> PropertiesUtil.getSuffix(file))); if (new IncompletePropertyInspectionOptionsPanel(suffixesToIgnore).showDialogAndGet(project)) { DisableInspectionToolAction.modifyAndCommitProjectProfile( modifiableModel -> ((IncompletePropertyInspection)modifiableModel.getInspectionTool(TOOL_KEY, element).getTool()).addSuffixes(suffixesToIgnore), project); @@ -148,15 +146,11 @@ public class IncompletePropertyInspection extends LocalInspectionTool implements } public boolean isPropertyComplete(final String key, final ResourceBundle resourceBundle) { - return isPropertyComplete(ContainerUtil.mapNotNull(resourceBundle.getPropertiesFiles(), file -> { - return file.findPropertyByKey(key); - }), resourceBundle); + return isPropertyComplete(ContainerUtil.mapNotNull(resourceBundle.getPropertiesFiles(), file -> file.findPropertyByKey(key)), resourceBundle); } private boolean isPropertyComplete(final List properties, final ResourceBundle resourceBundle) { - final Set existed = ContainerUtil.map2Set(properties, property -> { - return property.getPropertiesFile(); - }); + final Set existed = ContainerUtil.map2Set(properties, property -> property.getPropertiesFile()); for (PropertiesFile file : resourceBundle.getPropertiesFiles()) { if (!existed.contains(file) && !getIgnoredSuffixes().contains(PropertiesUtil.getSuffix(file))) { return false; diff --git a/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java b/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java index 6cf6946fd1ae..29f2344ee6e4 100644 --- a/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java +++ b/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java @@ -151,16 +151,14 @@ public class CreatePropertyFix implements IntentionAction, LocalQuickFix { } UndoUtil.markPsiFileForUndo(psiElement.getContainingFile()); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> { - try { - I18nUtil.createProperty(project, selectedPropertiesFiles, key, value); - } - catch (IncorrectOperationException e) { - LOG.error(e); - } - }, CodeInsightBundle.message("quickfix.i18n.command.name"), project); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { + try { + I18nUtil.createProperty(project, selectedPropertiesFiles, key, value); + } + catch (IncorrectOperationException e) { + LOG.error(e); + } + }, CodeInsightBundle.message("quickfix.i18n.command.name"), project)); } public boolean startInWriteAction() { diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/CustomResourceBundleTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/CustomResourceBundleTest.java index 4e5f04233af3..27b7a80cfea3 100644 --- a/plugins/properties/testSrc/com/intellij/lang/properties/CustomResourceBundleTest.java +++ b/plugins/properties/testSrc/com/intellij/lang/properties/CustomResourceBundleTest.java @@ -142,9 +142,7 @@ public class CustomResourceBundleTest extends LightPlatformCodeInsightFixtureTes final PsiDirectory newDir = PsiManager.getInstance(getProject()).findDirectory( myFixture.getTempDirFixture().findOrCreateDir("new-resources-dir")); new MoveFilesOrDirectoriesProcessor(getProject(), new PsiElement[] {file2.getContainingFile()}, newDir, false, false, null, null).run(); - ApplicationManager.getApplication().runWriteAction(() -> { - file3.getContainingFile().delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> file3.getContainingFile().delete()); assertSize(2, file.getResourceBundle().getPropertiesFiles()); @@ -159,9 +157,7 @@ public class CustomResourceBundleTest extends LightPlatformCodeInsightFixtureTes final PsiFile file = myFixture.addFileToProject("Base_Page.properties", ""); final PsiFile file2 = myFixture.addFileToProject("Base_Page_en.properties", ""); final String baseName = - PropertiesUtil.getDefaultBaseName(map(list(file, file2), psiFile -> { - return PropertiesImplUtil.getPropertiesFile(file); - })); + PropertiesUtil.getDefaultBaseName(map(list(file, file2), psiFile -> PropertiesImplUtil.getPropertiesFile(file))); assertEquals("Base_Page", baseName); } @@ -182,9 +178,7 @@ public class CustomResourceBundleTest extends LightPlatformCodeInsightFixtureTes final PsiFile someFile = myFixture.addFileToProject("to_remove/asd.txt", ""); final PsiDirectory toRemove = someFile.getParent(); assertNotNull(toRemove); - ApplicationManager.getApplication().runWriteAction(() -> { - toRemove.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> toRemove.delete()); final ResourceBundleManagerState state = resourceBundleManager.getState(); assertNotNull(state); @@ -193,18 +187,14 @@ public class CustomResourceBundleTest extends LightPlatformCodeInsightFixtureTes final PsiDirectory directory = propertiesFile.getParent().getParent(); assertNotNull(directory); - ApplicationManager.getApplication().runWriteAction(() -> { - directory.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> directory.delete()); assertSize(1, state.getCustomResourceBundles()); assertSize(0, state.getDissociatedFiles()); final PsiDirectory directory1 = propFile1.getParent().getParent(); assertNotNull(directory1); - ApplicationManager.getApplication().runWriteAction(() -> { - directory1.delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> directory1.delete()); assertSize(0, state.getCustomResourceBundles()); assertSize(0, state.getDissociatedFiles()); @@ -228,9 +218,7 @@ public class CustomResourceBundleTest extends LightPlatformCodeInsightFixtureTes final PsiDirectory toMove = myFixture.addFileToProject("asd/temp.txt", "").getParent(); assertNotNull(toMove); - ApplicationManager.getApplication().runWriteAction(() -> { - MoveFilesOrDirectoriesUtil.doMoveDirectory(propFile1.getParent(), toMove); - }); + ApplicationManager.getApplication().runWriteAction(() -> MoveFilesOrDirectoriesUtil.doMoveDirectory(propFile1.getParent(), toMove)); final PsiDirectory movedDir = toMove.findSubdirectory("qwe"); assertNotNull(movedDir); diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesFileTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesFileTest.java index 306c7da3ac45..660f8df5a6fc 100644 --- a/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesFileTest.java +++ b/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesFileTest.java @@ -79,9 +79,7 @@ public class PropertiesFileTest extends LightPlatformCodeInsightFixtureTestCase assertPropertyEquals(properties.get(0), "xxx", "yyy"); assertPropertyEquals(properties.get(1), "zzz", "ttt"); - WriteCommandAction.runWriteCommandAction(null, () -> { - properties.get(1).getPsiElement().delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> properties.get(1).getPsiElement().delete()); List propertiesAfter = propertiesFile.getProperties(); assertEquals(1, propertiesAfter.size()); @@ -92,9 +90,7 @@ public class PropertiesFileTest extends LightPlatformCodeInsightFixtureTestCase PropertiesFile propertiesFile = PropertiesElementFactory.createPropertiesFile(getProject(), "xxx=yyy\nxxx2=tyrt\nxxx3=ttt\n\n"); final Property property = (Property)propertiesFile.findPropertyByKey("xxx2"); - WriteCommandAction.runWriteCommandAction(null, () -> { - property.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> property.delete()); assertEquals("xxx=yyy\nxxx3=ttt\n\n", propertiesFile.getContainingFile().getText()); @@ -103,9 +99,7 @@ public class PropertiesFileTest extends LightPlatformCodeInsightFixtureTestCase PropertiesFile propertiesFile = PropertiesElementFactory.createPropertiesFile(getProject(), "xxx=yyy\nxxx2=tyrt\nxxx3=ttt\n\n"); final Property property = (Property)propertiesFile.findPropertyByKey("xxx"); - WriteCommandAction.runWriteCommandAction(null, () -> { - property.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> property.delete()); assertEquals("xxx2=tyrt\nxxx3=ttt\n\n", propertiesFile.getText()); diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleEditorInsertManagerTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleEditorInsertManagerTest.java index 142f42224143..0ad567e77873 100644 --- a/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleEditorInsertManagerTest.java +++ b/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleEditorInsertManagerTest.java @@ -100,10 +100,8 @@ public class ResourceBundleEditorInsertManagerTest extends LightPlatformCodeInsi final ResourceBundle bundle = basePropertiesFile.getResourceBundle(); final ResourceBundlePropertiesUpdateManager manager = new ResourceBundlePropertiesUpdateManager(bundle); assertInstanceOf(manager, ResourceBundlePropertiesUpdateManager.class); - WriteCommandAction.runWriteCommandAction(getProject(), () -> { - testAction.doTestAction(basePropertiesFile, PropertiesImplUtil.getPropertiesFile(translationFile), - manager); - }); + WriteCommandAction.runWriteCommandAction(getProject(), () -> testAction.doTestAction(basePropertiesFile, PropertiesImplUtil.getPropertiesFile(translationFile), + manager)); myFixture.checkResultByFile(getTestName(true) + "/p.properties", getTestName(true) + "/p-after.properties", true); myFixture.checkResultByFile(getTestName(true) + "/p_en.properties", getTestName(true) + "/p-after_en.properties",true); } diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/ui/TaskDialogPanelProvider.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/ui/TaskDialogPanelProvider.java index 9eacf4339e15..f60fe16f6b09 100644 --- a/plugins/tasks/tasks-api/src/com/intellij/tasks/ui/TaskDialogPanelProvider.java +++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/ui/TaskDialogPanelProvider.java @@ -36,16 +36,12 @@ public abstract class TaskDialogPanelProvider { public static List getOpenTaskPanels(@NotNull Project project, @NotNull Task task) { return ContainerUtil.mapNotNull(Extensions.getExtensions(EP_NAME), - (NullableFunction)provider -> { - return provider.getOpenTaskPanel(project, task); - }); + (NullableFunction)provider -> provider.getOpenTaskPanel(project, task)); } public static List getCloseTaskPanels(@NotNull Project project, @NotNull LocalTask task) { return ContainerUtil.mapNotNull(Extensions.getExtensions(EP_NAME), - (NullableFunction)provider -> { - return provider.getCloseTaskPanel(project, task); - }); + (NullableFunction)provider -> provider.getCloseTaskPanel(project, task)); } @Nullable diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestApi.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestApi.java index 57a47a2eca21..b038f6640ebe 100644 --- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestApi.java +++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestApi.java @@ -56,9 +56,7 @@ public abstract class JiraRestApi extends JiraRemoteApi { GetMethod method = getMultipleIssuesSearchMethod(jql, max); String response = myRepository.executeMethod(method); List issues = parseIssues(response); - return ContainerUtil.map(issues, issue -> { - return new JiraRestTask(issue, myRepository); - }); + return ContainerUtil.map(issues, issue -> new JiraRestTask(issue, myRepository)); } @Override diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestTask.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestTask.java index 6a9a2bece617..733a9d7b21ff 100644 --- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestTask.java +++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/rest/JiraRestTask.java @@ -63,26 +63,24 @@ public class JiraRestTask extends JiraTask { @Override @NotNull public Comment[] getComments() { - return ContainerUtil.map2Array(myJiraIssue.getComments(), Comment.class, (Function)comment -> { - return new Comment() { + return ContainerUtil.map2Array(myJiraIssue.getComments(), Comment.class, (Function)comment -> new Comment() { - public String getText() { - return comment.getBody(); - } + public String getText() { + return comment.getBody(); + } - public String getAuthor() { - return comment.getAuthor().getDisplayName(); - } + public String getAuthor() { + return comment.getAuthor().getDisplayName(); + } - public Date getDate() { - return comment.getCreated(); - } + public Date getDate() { + return comment.getCreated(); + } - @Override - public String toString() { - return comment.getAuthor().getDisplayName(); - } - }; + @Override + public String toString() { + return comment.getAuthor().getDisplayName(); + } }); } diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java index 559938a6fa04..da64154c7117 100644 --- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java +++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java @@ -73,9 +73,7 @@ public class JiraLegacyApi extends JiraRemoteApi { if (channel != null) { List children = channel.getChildren("item"); LOG.debug("Total issues in JIRA RSS feed: " + children.size()); - return ContainerUtil.map(children, element -> { - return new JiraSoapTask(element, myRepository); - }); + return ContainerUtil.map(children, element -> new JiraSoapTask(element, myRepository)); } else { LOG.warn("JIRA channel not found"); diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapTask.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapTask.java index db88ef94cd69..1d364a82c83a 100644 --- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapTask.java +++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapTask.java @@ -73,25 +73,23 @@ class JiraSoapTask extends JiraTask { Element comments = element.getChild("comments"); if (comments != null) { - myComments = ContainerUtil.map(comments.getChildren("comment"), element1 -> { - return new Comment() { - @Override - public String getText() { - return element1.getText(); - } + myComments = ContainerUtil.map(comments.getChildren("comment"), element1 -> new Comment() { + @Override + public String getText() { + return element1.getText(); + } - @Nullable - @Override - public String getAuthor() { - return element1.getAttributeValue("author"); - } + @Nullable + @Override + public String getAuthor() { + return element1.getAttributeValue("author"); + } - @Nullable - @Override - public Date getDate() { - return parseDate(element1.getAttributeValue("created")); - } - }; + @Nullable + @Override + public Date getDate() { + return parseDate(element1.getAttributeValue("created")); + } }); } else { myComments = ContainerUtil.emptyList(); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/context/LoadContextAction.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/context/LoadContextAction.java index 0d4add5eaf89..d8abb26f446e 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/context/LoadContextAction.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/context/LoadContextAction.java @@ -58,34 +58,32 @@ public class LoadContextAction extends BaseTaskAction { DefaultActionGroup group = new DefaultActionGroup(); final WorkingContextManager manager = WorkingContextManager.getInstance(project); List history = manager.getContextHistory(); - List infos = new ArrayList(ContainerUtil.map2List(history, (Function)info -> { - return new ContextHolder() { - @Override - void load(final boolean clear) { - LoadContextUndoableAction undoableAction = LoadContextUndoableAction.createAction(manager, clear, info.name); - UndoableCommand.execute(project, undoableAction, "Load context " + info.comment, "Context"); - } + List infos = new ArrayList(ContainerUtil.map2List(history, (Function)info -> new ContextHolder() { + @Override + void load(final boolean clear) { + LoadContextUndoableAction undoableAction = LoadContextUndoableAction.createAction(manager, clear, info.name); + UndoableCommand.execute(project, undoableAction, "Load context " + info.comment, "Context"); + } - @Override - void remove() { - manager.removeContext(info.name); - } + @Override + void remove() { + manager.removeContext(info.name); + } - @Override - Date getDate() { - return new Date(info.date); - } + @Override + Date getDate() { + return new Date(info.date); + } - @Override - String getComment() { - return info.comment; - } + @Override + String getComment() { + return info.comment; + } - @Override - Icon getIcon() { - return TasksIcons.SavedContext; - } - }; + @Override + Icon getIcon() { + return TasksIcons.SavedContext; + } })); final TaskManager taskManager = TaskManager.getManager(project); List tasks = taskManager.getLocalTasks(); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/bugzilla/BugzillaRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/bugzilla/BugzillaRepository.java index b77757a8e1a7..1606beb16ffe 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/bugzilla/BugzillaRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/bugzilla/BugzillaRepository.java @@ -84,9 +84,7 @@ public class BugzillaRepository extends BaseRepositoryImpl { Hashtable response = createIssueSearchRequest(query, offset, limit, withClosed).execute(); Vector> bugs = (Vector>)response.get("bugs"); - return ContainerUtil.map2Array(bugs, BugzillaTask.class, hashTable -> { - return new BugzillaTask(hashTable, BugzillaRepository.this); - }); + return ContainerUtil.map2Array(bugs, BugzillaTask.class, hashTable -> new BugzillaTask(hashTable, BugzillaRepository.this)); } private BugzillaXmlRpcRequest createIssueSearchRequest(String query, int offset, int limit, boolean withClosed) throws Exception { @@ -243,9 +241,7 @@ public class BugzillaRepository extends BaseRepositoryImpl { @NotNull private static List extractNotEmptyNames(@NotNull Vector> vector) { - return ContainerUtil.mapNotNull(vector, table -> { - return StringUtil.nullize((String)table.get("name")); - }); + return ContainerUtil.mapNotNull(vector, table -> StringUtil.nullize((String)table.get("name"))); } @Override diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java index 36b1c6900c4f..248ee02f44dd 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java @@ -219,9 +219,7 @@ public class TaskRepositoriesConfigurable extends BaseConfigurable implements Co } public void apply() throws ConfigurationException { - List newRepositories = ContainerUtil.map(myRepositories, taskRepository -> { - return taskRepository.clone(); - }); + List newRepositories = ContainerUtil.map(myRepositories, taskRepository -> taskRepository.clone()); myManager.setRepositories(newRepositories); myManager.updateIssues(null); RecentTaskRepositories.getInstance().addRepositories(myRepositories); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerBreakpointsContextProvider.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerBreakpointsContextProvider.java index cfc96486bb60..86abf474a080 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerBreakpointsContextProvider.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerBreakpointsContextProvider.java @@ -74,9 +74,7 @@ public class XDebuggerBreakpointsContextProvider extends WorkingContextProvider public void clearContext() { XBreakpointBase[] breakpoints = myBreakpointManager.getAllBreakpoints(); for (final XBreakpointBase breakpoint : breakpoints) { - ApplicationManager.getApplication().runWriteAction(() -> { - myBreakpointManager.removeBreakpoint(breakpoint); - }); + ApplicationManager.getApplication().runWriteAction(() -> myBreakpointManager.removeBreakpoint(breakpoint)); } } } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/fogbugz/FogBugzRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/fogbugz/FogBugzRepository.java index 429ce4eff448..ed5adc32ddad 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/fogbugz/FogBugzRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/fogbugz/FogBugzRepository.java @@ -92,9 +92,7 @@ public class FogBugzRepository extends BaseRepositoryImpl { } final XPath commentPath = XPath.newInstance("events/event"); final List nodes = (List)XPath.newInstance("/response/cases/case").selectNodes(document); - final List tasks = ContainerUtil.mapNotNull(nodes, (NotNullFunction)element -> { - return createCase(element, commentPath); - }); + final List tasks = ContainerUtil.mapNotNull(nodes, (NotNullFunction)element -> createCase(element, commentPath)); return tasks.toArray(new Task[tasks.size()]); } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java index 28ce5db26202..2a1d51f5e105 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java @@ -86,9 +86,7 @@ public class GenericRepositoryUtil { } public static List createPlaceholdersList(List variables) { - return ContainerUtil.map2List(variables, variable -> { - return String.format("{%s}", variable.getName()); - }); + return ContainerUtil.map2List(variables, variable -> String.format("{%s}", variable.getName())); } public static String prettifyVariableName(String variableName) { diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java index 6ce726aeb728..68c9abb020af 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java @@ -85,9 +85,7 @@ public final class JsonPathResponseHandler extends SelectorBasedResponseHandler if (list == null) { return ContainerUtil.emptyList(); } - return ContainerUtil.map2List(list, (Function)o -> { - return o.toString(); - }).subList(0, Math.min(list.size(), max)); + return ContainerUtil.map2List(list, (Function)o -> o.toString()).subList(0, Math.min(list.size(), max)); } @Nullable diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/gitlab/GitlabRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/gitlab/GitlabRepository.java index da3093e12a28..a2ddfdf313d9 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/gitlab/GitlabRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/gitlab/GitlabRepository.java @@ -105,9 +105,7 @@ public class GitlabRepository extends NewBaseRepositoryImpl { @Override public Task[] getIssues(@Nullable String query, int offset, int limit, boolean withClosed) throws Exception { final List issues = fetchIssues((offset / limit) + 1, limit, !withClosed); - return ContainerUtil.map2Array(issues, GitlabTask.class, issue -> { - return new GitlabTask(GitlabRepository.this, issue); - }); + return ContainerUtil.map2Array(issues, GitlabTask.class, issue -> new GitlabTask(GitlabRepository.this, issue)); } @Nullable diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java index 64623b91bba9..dfd489a98ff8 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java @@ -50,9 +50,7 @@ public class TaskCheckinHandlerFactory extends CheckinHandlerFactory { final LocalTask localTask = manager.addTask(task); localTask.setUpdated(new Date()); - ApplicationManager.getApplication().invokeLater(() -> { - WorkingContextManager.getInstance(project).saveContext(localTask); - }, project.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> WorkingContextManager.getInstance(project).saveContext(localTask), project.getDisposed()); } } }; diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java index 64b8f5d48188..e6bf779fcc02 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java @@ -159,9 +159,7 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe public void defaultListChanged(ChangeList oldDefaultList, ChangeList newDefaultList) { final LocalTask associatedTask = getAssociatedTask((LocalChangeList)newDefaultList); if (associatedTask != null && !getActiveTask().equals(associatedTask)) { - ApplicationManager.getApplication().invokeLater(() -> { - activateTask(associatedTask, true); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> activateTask(associatedTask, true), myProject.getDisposed()); } } }; diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java index e484ba87251c..9bb2202bd558 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java @@ -140,9 +140,7 @@ public abstract class TaskStateCombo extends JPanel { @NotNull static List wrapList(@NotNull Collection states) { - return ContainerUtil.map(states, state -> { - return new CustomStateTrinityAdapter(state); - }); + return ContainerUtil.map(states, state -> new CustomStateTrinityAdapter(state)); } @NotNull diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskUiUtil.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskUiUtil.java index 5f863dea6250..92e5073e62e3 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskUiUtil.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskUiUtil.java @@ -65,9 +65,7 @@ public class TaskUiUtil { @Nullable @Override public final NotificationInfo notifyFinished() { - ApplicationManager.getApplication().invokeLater(() -> { - updateUI(); - }, myModalityState); + ApplicationManager.getApplication().invokeLater(() -> updateUI(), myModalityState); return null; } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/lighthouse/LighthouseRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/lighthouse/LighthouseRepository.java index f41c089a0b4a..61a50d5c9b3e 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/lighthouse/LighthouseRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/lighthouse/LighthouseRepository.java @@ -100,9 +100,7 @@ public class LighthouseRepository extends BaseRepositoryImpl { List children = element.getChildren("ticket"); - List taskList = ContainerUtil.mapNotNull(children, (NullableFunction)o -> { - return createIssue(o); - }); + List taskList = ContainerUtil.mapNotNull(children, (NullableFunction)o -> createIssue(o)); tasks.addAll(taskList); page++; } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java index 7372d1091f16..ae9dfd0f32d9 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java @@ -181,9 +181,7 @@ public class MantisRepository extends BaseRepositoryImpl { myAllProjectsAvailable = checkAllProjectsAvailable(soap); List projects = - new ArrayList(ContainerUtil.map(fetchUserProjects(soap), data -> { - return new MantisProject(data); - })); + new ArrayList(ContainerUtil.map(fetchUserProjects(soap), data -> new MantisProject(data))); List commonFilters = new LinkedList(); for (MantisProject project : projects) { FilterData[] rawFilters = fetchProjectFilters(soap, project); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisTask.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisTask.java index 517a4248d454..ce9417b16a51 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisTask.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisTask.java @@ -41,25 +41,23 @@ public class MantisTask extends Task { myComments = Comment.EMPTY_ARRAY; } else { - myComments = ContainerUtil.map2Array(data.getNotes(), Comment.class, (Function)data1 -> { - return new Comment() { - @Override - public String getText() { - return data1.getText(); - } + myComments = ContainerUtil.map2Array(data.getNotes(), Comment.class, (Function)data1 -> new Comment() { + @Override + public String getText() { + return data1.getText(); + } - @Nullable - @Override - public String getAuthor() { - return data1.getReporter().getName(); - } + @Nullable + @Override + public String getAuthor() { + return data1.getReporter().getName(); + } - @Nullable - @Override - public Date getDate() { - return data1.getDate_submitted().getTime(); - } - }; + @Nullable + @Override + public Date getDate() { + return data1.getDate_submitted().getTime(); + } }); } } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java index 2e14aa65c4b5..2bdfb2a0be26 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java @@ -87,9 +87,7 @@ public class PivotalTrackerRepository extends BaseRepositoryImpl { public Task[] getIssues(@Nullable final String query, final int max, final long since) throws Exception { List children = getStories(query, max); - final List tasks = ContainerUtil.mapNotNull(children, (NullableFunction)o -> { - return createIssue(o); - }); + final List tasks = ContainerUtil.mapNotNull(children, (NullableFunction)o -> createIssue(o)); return tasks.toArray(new Task[tasks.size()]); } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/redmine/RedmineRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/redmine/RedmineRepository.java index 0e566674985c..56c6a2627870 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/redmine/RedmineRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/redmine/RedmineRepository.java @@ -150,9 +150,7 @@ public class RedmineRepository extends NewBaseRepositoryImpl { @Override public Task[] getIssues(@Nullable String query, int offset, int limit, boolean withClosed) throws Exception { List issues = fetchIssues(query, offset, limit, withClosed); - List result = ContainerUtil.map(issues, issue -> { - return new RedmineTask(RedmineRepository.this, issue); - }); + List result = ContainerUtil.map(issues, issue -> new RedmineTask(RedmineRepository.this, issue)); if (query != null && ID_PATTERN.matcher(query).matches()) { LOG.debug("Query '" + query + "' looks like an issue ID. Requesting it explicitly from the server " + this); final Task found = findTask(query); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java index 067e44570b67..579dd7fc0b03 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java @@ -137,9 +137,7 @@ public final class TrelloRepository extends NewBaseRepositoryImpl { @Override public Task[] getIssues(@Nullable String query, int offset, int limit, boolean withClosed) throws Exception { final List cards = fetchCards(offset + limit, withClosed); - return ContainerUtil.map2Array(cards, Task.class, (Function)card -> { - return new TrelloTask(card, TrelloRepository.this); - }); + return ContainerUtil.map2Array(cards, Task.class, (Function)card -> new TrelloTask(card, TrelloRepository.this)); } @Nullable @@ -322,9 +320,7 @@ public final class TrelloRepository extends NewBaseRepositoryImpl { .addParameter("fields", "none"); final List visibleCards = makeRequestAndDeserializeJsonResponse(visibleCardsUrl.build(), TrelloUtil.LIST_OF_CARDS_TYPE); LOG.debug("Total " + visibleCards.size() + " visible cards"); - final Set visibleCardsIDs = ContainerUtil.map2Set(visibleCards, card -> { - return card.getId(); - }); + final Set visibleCardsIDs = ContainerUtil.map2Set(visibleCards, card -> card.getId()); for (TrelloCard card : cards) { card.setVisible(visibleCardsIDs.contains(card.getId())); } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackIntellisense.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackIntellisense.java index 90000aada769..2dff4ddd2aa6 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackIntellisense.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackIntellisense.java @@ -139,15 +139,11 @@ public class YouTrackIntellisense { TaskUtil.prettyFormatXmlToLog(LOG, root); @NotNull final Element highlight = root.getChild("highlight"); //assert highlight != null : "no '/IntelliSense/highlight' element in YouTrack response"; - myHighlightRanges = ContainerUtil.map(highlight.getChildren("range"), range -> { - return new HighlightRange(range); - }); + myHighlightRanges = ContainerUtil.map(highlight.getChildren("range"), range -> new HighlightRange(range)); @NotNull final Element suggest = root.getChild("suggest"); //assert suggest != null : "no '/IntelliSense/suggest' element in YouTrack response"; - myCompletionItems = ContainerUtil.map(suggest.getChildren("item"), item -> { - return new CompletionItem(item); - }); + myCompletionItems = ContainerUtil.map(suggest.getChildren("item"), item -> new CompletionItem(item)); } @NotNull diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepository.java index 709dd05511af..da3af81ddacf 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepository.java @@ -117,9 +117,7 @@ public class YouTrackRepository extends BaseRepositoryImpl { List children = element.getChildren("issue"); - final List tasks = ContainerUtil.mapNotNull(children, (NullableFunction)o -> { - return createIssue(o); - }); + final List tasks = ContainerUtil.mapNotNull(children, (NullableFunction)o -> createIssue(o)); return tasks.toArray(new Task[tasks.size()]); } finally { diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java index b7a811f7cde1..582bafc47452 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/lang/codeinsight/YouTrackCompletionContributor.java @@ -54,12 +54,10 @@ public class YouTrackCompletionContributor extends CompletionContributor { final List suggestions = future.get(TIMEOUT, TimeUnit.MILLISECONDS); // actually backed by original CompletionResultSet result = result.withPrefixMatcher(extractPrefix(parameters)).caseInsensitive(); - result.addAllElements(ContainerUtil.map(suggestions, (Function)item -> { - return LookupElementBuilder.create(item, item.getOption()) - .withTypeText(item.getDescription(), true) - .withInsertHandler(INSERT_HANDLER) - .withBoldness(item.getStyleClass().equals("keyword")); - })); + result.addAllElements(ContainerUtil.map(suggestions, (Function)item -> LookupElementBuilder.create(item, item.getOption()) + .withTypeText(item.getDescription(), true) + .withInsertHandler(INSERT_HANDLER) + .withBoldness(item.getStyleClass().equals("keyword")))); } catch (Exception ignored) { //noinspection InstanceofCatchParameter diff --git a/plugins/tasks/tasks-java/src/com/intellij/tasks/context/java/BreakpointsContextProvider.java b/plugins/tasks/tasks-java/src/com/intellij/tasks/context/java/BreakpointsContextProvider.java index d0e0dcd2130b..85fdacba01a3 100644 --- a/plugins/tasks/tasks-java/src/com/intellij/tasks/context/java/BreakpointsContextProvider.java +++ b/plugins/tasks/tasks-java/src/com/intellij/tasks/context/java/BreakpointsContextProvider.java @@ -66,9 +66,7 @@ public class BreakpointsContextProvider extends WorkingContextProvider { final BreakpointManager breakpointManager = ((DebuggerManagerEx)myDebuggerManager).getBreakpointManager(); List breakpoints = breakpointManager.getBreakpoints(); for (final Breakpoint breakpoint : breakpoints) { - ApplicationManager.getApplication().runWriteAction(() -> { - breakpointManager.removeBreakpoint(breakpoint); - }); + ApplicationManager.getApplication().runWriteAction(() -> breakpointManager.removeBreakpoint(breakpoint)); } } } diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/BugzillaIntegrationTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/BugzillaIntegrationTest.java index 94e927e631c0..dd9173b19c62 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/BugzillaIntegrationTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/BugzillaIntegrationTest.java @@ -32,9 +32,7 @@ public class BugzillaIntegrationTest extends TaskManagerTestCase { assertEquals(TaskState.OPEN, task.getState()); Set states = myRepository.getAvailableTaskStates(task); - List stateNames = ContainerUtil.map(states, state -> { - return state.getPresentableName(); - }); + List stateNames = ContainerUtil.map(states, state -> state.getPresentableName()); assertContainsElements(stateNames, "IN_PROGRESS"); assertDoesntContain(stateNames, "CONFIRMED"); @@ -42,9 +40,7 @@ public class BugzillaIntegrationTest extends TaskManagerTestCase { setStateAndCheckResult(task, IN_PROGRESS_STATE, TaskState.IN_PROGRESS); states = myRepository.getAvailableTaskStates(task); - stateNames = ContainerUtil.map(states, state -> { - return state.getPresentableName(); - }); + stateNames = ContainerUtil.map(states, state -> state.getPresentableName()); assertContainsElements(stateNames, "CONFIRMED"); assertDoesntContain(stateNames, "IN_PROGRESS"); } diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskVcsTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskVcsTest.java index 3c49bfa44e4b..dcfc7f0e5b67 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskVcsTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskVcsTest.java @@ -304,9 +304,7 @@ public class TaskVcsTest extends CodeInsightFixtureTestCase { assertEquals(2, myTaskManager.getLocalTasks().size()); // extra task created assertEquals(2, myChangeListManager.getChangeListsCopy().size()); - assertTrue(ContainerUtil.exists(myTaskManager.getLocalTasks(), task -> { - return task.getSummary().equals("New Changelist"); - })); + assertTrue(ContainerUtil.exists(myTaskManager.getLocalTasks(), task -> task.getSummary().equals("New Changelist"))); } private LocalChangeList addChangeList(String title, String comment) { diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java index e99ea51beb26..4ead3d009a20 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java @@ -250,9 +250,7 @@ public class TestNGRunnableState extends JavaTestFrameworkRunnableState>> classes) { if (forkPerModule()) { - final Map> perModule = new TreeMap>((o1, o2) -> { - return StringUtil.compare(o1.getName(), o2.getName(), true); - }); + final Map> perModule = new TreeMap>((o1, o2) -> StringUtil.compare(o1.getName(), o2.getName(), true)); for (final PsiClass psiClass : classes.keySet()) { final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass); diff --git a/plugins/testng/src/com/theoryinpractice/testng/model/TestNGConfigurationModel.java b/plugins/testng/src/com/theoryinpractice/testng/model/TestNGConfigurationModel.java index efeecee0602a..2be2d936b2eb 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/model/TestNGConfigurationModel.java +++ b/plugins/testng/src/com/theoryinpractice/testng/model/TestNGConfigurationModel.java @@ -205,10 +205,8 @@ public class TestNGConfigurationModel throw new RuntimeException(e); } } else { - WriteCommandAction.runWriteCommandAction(project, () -> { - ((com.intellij.openapi.editor.Document)document) - .replaceString(0, ((com.intellij.openapi.editor.Document)document).getTextLength(), value); - }); + WriteCommandAction.runWriteCommandAction(project, () -> ((com.intellij.openapi.editor.Document)document) + .replaceString(0, ((com.intellij.openapi.editor.Document)document).getTextLength(), value)); } } diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java b/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java index 03cff26e9bef..c7f1592b3a2e 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java +++ b/plugins/testng/src/com/theoryinpractice/testng/ui/TestNGResults.java @@ -324,9 +324,7 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn //look up the psiclass now if (owner.getPsiElement() == null) { final TestProxy finalOwner = owner; - ApplicationManager.getApplication().runReadAction(() -> { - finalOwner.setPsiElement(ClassUtil.findPsiClass(PsiManager.getInstance(project), result.getTestClass())); - }); + ApplicationManager.getApplication().runReadAction(() -> finalOwner.setPsiElement(ClassUtil.findPsiClass(PsiManager.getInstance(project), result.getTestClass()))); } return owner; } diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java b/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java index b293d3879a93..4b8c46cc07f4 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java +++ b/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java @@ -70,9 +70,7 @@ public class RerunFailedTestsAction extends JavaRerunFailedTestsAction { final GlobalSearchScope scope = getConfiguration().getConfigurationModule().getSearchScope(); final Project project = getConfiguration().getProject(); for (final AbstractTestProxy proxy : failedTests) { - ApplicationManager.getApplication().runReadAction(() -> { - includeFailedTestWithDependencies(classes, scope, project, proxy); - }); + ApplicationManager.getApplication().runReadAction(() -> includeFailedTestWithDependencies(classes, scope, project, proxy)); } } diff --git a/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java b/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java index edf4605ee83c..1ffd5d9325a5 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java +++ b/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java @@ -359,9 +359,7 @@ public class TestNGUtil { if (psiMethods != null) { for (final PsiMethod psiMethod : psiMethods) { ApplicationManager.getApplication().runReadAction( - () -> { - appendAnnotationAttributeValues(results, AnnotationUtil.findAnnotation(psiMethod, test), psiMethod); - } + () -> appendAnnotationAttributeValues(results, AnnotationUtil.findAnnotation(psiMethod, test), psiMethod) ); } } diff --git a/plugins/ui-designer-core/src/com/intellij/designer/designSurface/InplaceEditingLayer.java b/plugins/ui-designer-core/src/com/intellij/designer/designSurface/InplaceEditingLayer.java index b08cdbc45101..4b0d46f0efad 100644 --- a/plugins/ui-designer-core/src/com/intellij/designer/designSurface/InplaceEditingLayer.java +++ b/plugins/ui-designer-core/src/com/intellij/designer/designSurface/InplaceEditingLayer.java @@ -60,9 +60,7 @@ public class InplaceEditingLayer extends JComponent { return; } // [vova] we need LaterInvocator here to prevent write-access assertions - ApplicationManager.getApplication().invokeLater(() -> { - finishEditing(true); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> finishEditing(true), ModalityState.NON_MODAL); } }; private final ComponentSelectionListener mySelectionListener = new ComponentSelectionListener() { diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateListenerAction.java b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateListenerAction.java index 34a26871528d..339d6fb7003a 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateListenerAction.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateListenerAction.java @@ -133,9 +133,7 @@ public class CreateListenerAction extends AbstractGuiEditorAction { public void actionPerformed(AnActionEvent e) { CommandProcessor.getInstance().executeCommand( mySelection.get(0).getProject(), - () -> ApplicationManager.getApplication().runWriteAction(() -> { - createListener(); - }), UIDesignerBundle.message("create.listener.command"), null + () -> ApplicationManager.getApplication().runWriteAction(() -> createListener()), UIDesignerBundle.message("create.listener.command"), null ); } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferenceProvider.java b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferenceProvider.java index 5722283b5364..158b5ac9c9d8 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferenceProvider.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferenceProvider.java @@ -157,9 +157,7 @@ public class FormReferenceProvider extends PsiReferenceProvider { } final PsiReference finalClassReference = classReference; - ApplicationManager.getApplication().runReadAction(() -> { - processReferences(rootTag, finalClassReference, file, processor); - }); + ApplicationManager.getApplication().runReadAction(() -> processReferences(rootTag, finalClassReference, file, processor)); } private static TextRange getValueRange(final XmlAttribute classToBind) { diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java index 599c7a45679e..df37d70df8e5 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java @@ -349,9 +349,7 @@ public final class InplaceEditingLayer extends JComponent{ return; } // [vova] we need LaterInvocator here to prevent write-access assertions - ApplicationManager.getApplication().invokeLater(() -> { - finishInplaceEditing(); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> finishInplaceEditing(), ModalityState.NON_MODAL); } } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InsertComponentProcessor.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InsertComponentProcessor.java index f409f02469bb..9ab108adb975 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InsertComponentProcessor.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InsertComponentProcessor.java @@ -218,15 +218,13 @@ public final class InsertComponentProcessor extends EventProcessor { return; } ApplicationManager.getApplication().runWriteAction( - () -> { - CreateFieldFix.runImpl(editor.getProject(), - editor.getRootContainer(), - aClass, - insertedComponent.getComponentClassName(), - insertedComponent.getBinding(), - false, // silently skip all errors (if any) - null); - } + () -> CreateFieldFix.runImpl(editor.getProject(), + editor.getRootContainer(), + aClass, + insertedComponent.getComponentClassName(), + insertedComponent.getBinding(), + false, // silently skip all errors (if any) + null) ); } } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/properties/BindingProperty.java b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/properties/BindingProperty.java index 9d8870f937b4..800e74235f60 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/properties/BindingProperty.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/properties/BindingProperty.java @@ -236,21 +236,19 @@ public final class BindingProperty extends Property { return; } ApplicationManager.getApplication().runWriteAction( - () -> { - CommandProcessor.getInstance().executeCommand( - project, - () -> { - try { - oldBindingField.delete(); - } - catch (IncorrectOperationException e) { - Messages.showErrorDialog(project, UIDesignerBundle.message("error.cannot.delete.unused.field", e.getMessage()), - CommonBundle.getErrorTitle()); - } - }, - UIDesignerBundle.message("command.delete.unused.field"), undoGroupId - ); - } + () -> CommandProcessor.getInstance().executeCommand( + project, + () -> { + try { + oldBindingField.delete(); + } + catch (IncorrectOperationException e) { + Messages.showErrorDialog(project, UIDesignerBundle.message("error.cannot.delete.unused.field", e.getMessage()), + CommonBundle.getErrorTitle()); + } + }, + UIDesignerBundle.message("command.delete.unused.field"), undoGroupId + ) ); } } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/ChangeFieldTypeFix.java b/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/ChangeFieldTypeFix.java index da3ba9c06a7d..f88eb6dc08ba 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/ChangeFieldTypeFix.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/ChangeFieldTypeFix.java @@ -48,18 +48,16 @@ public class ChangeFieldTypeFix extends QuickFix { final PsiFile psiFile = myField.getContainingFile(); if (psiFile == null) return; if (!FileModificationService.getInstance().preparePsiElementForWrite(psiFile)) return; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(myField.getProject(), () -> { - try { - final PsiManager manager = myField.getManager(); - myField.getTypeElement().replace(JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createTypeElement(myNewType)); - } - catch (final IncorrectOperationException e) { - ApplicationManager.getApplication().invokeLater( - () -> Messages.showErrorDialog(myEditor, UIDesignerBundle.message("error.cannot.change.field.type", myField.getName(), e.getMessage()), - CommonBundle.getErrorTitle())); - } - }, getName(), null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(myField.getProject(), () -> { + try { + final PsiManager manager = myField.getManager(); + myField.getTypeElement().replace(JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createTypeElement(myNewType)); + } + catch (final IncorrectOperationException e) { + ApplicationManager.getApplication().invokeLater( + () -> Messages.showErrorDialog(myEditor, UIDesignerBundle.message("error.cannot.change.field.type", myField.getName(), e.getMessage()), + CommonBundle.getErrorTitle())); + } + }, getName(), null)); } } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateClassToBindFix.java b/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateClassToBindFix.java index e444426d5b35..fe27f7acb557 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateClassToBindFix.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateClassToBindFix.java @@ -65,52 +65,50 @@ public final class CreateClassToBindFix extends QuickFix{ } ApplicationManager.getApplication().runWriteAction( - () -> { - CommandProcessor.getInstance().executeCommand( - project, - () -> { - // 1. Create all necessary packages - final int indexOfLastDot = myClassName.lastIndexOf('.'); - final String packageName = myClassName.substring(0, indexOfLastDot != -1 ? indexOfLastDot : 0); - final PsiDirectory psiDirectory; - if(packageName.length() > 0){ - final PackageWrapper packageWrapper = new PackageWrapper(PsiManager.getInstance(project), packageName); - try { - psiDirectory = RefactoringUtil.createPackageDirectoryInSourceRoot(packageWrapper, sourceRoot); - LOG.assertTrue(psiDirectory != null); - } - catch (final IncorrectOperationException e) { - ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog( - myEditor, - UIDesignerBundle.message("error.cannot.create.package", packageName, e.getMessage()), - CommonBundle.getErrorTitle() - )); - return; - } - } - else{ - psiDirectory = PsiManager.getInstance(project).findDirectory(sourceRoot); - LOG.assertTrue(psiDirectory != null); - } - - // 2. Create class in the package + () -> CommandProcessor.getInstance().executeCommand( + project, + () -> { + // 1. Create all necessary packages + final int indexOfLastDot = myClassName.lastIndexOf('.'); + final String packageName = myClassName.substring(0, indexOfLastDot != -1 ? indexOfLastDot : 0); + final PsiDirectory psiDirectory; + if(packageName.length() > 0){ + final PackageWrapper packageWrapper = new PackageWrapper(PsiManager.getInstance(project), packageName); try { - final String name = myClassName.substring(indexOfLastDot != -1 ? indexOfLastDot + 1 : 0); - final PsiClass aClass = JavaDirectoryService.getInstance().createClass(psiDirectory, name); - createBoundFields(aClass); + psiDirectory = RefactoringUtil.createPackageDirectoryInSourceRoot(packageWrapper, sourceRoot); + LOG.assertTrue(psiDirectory != null); } catch (final IncorrectOperationException e) { ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog( myEditor, - UIDesignerBundle.message("error.cannot.create.class", packageName, e.getMessage()), + UIDesignerBundle.message("error.cannot.create.package", packageName, e.getMessage()), CommonBundle.getErrorTitle() )); + return; } - }, - getName(), - null - ); - } + } + else{ + psiDirectory = PsiManager.getInstance(project).findDirectory(sourceRoot); + LOG.assertTrue(psiDirectory != null); + } + + // 2. Create class in the package + try { + final String name = myClassName.substring(indexOfLastDot != -1 ? indexOfLastDot + 1 : 0); + final PsiClass aClass = JavaDirectoryService.getInstance().createClass(psiDirectory, name); + createBoundFields(aClass); + } + catch (final IncorrectOperationException e) { + ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog( + myEditor, + UIDesignerBundle.message("error.cannot.create.class", packageName, e.getMessage()), + CommonBundle.getErrorTitle() + )); + } + }, + getName(), + null + ) ); } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateFieldFix.java b/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateFieldFix.java index b37ecbe59ed5..874907f0b807 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateFieldFix.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/quickFixes/CreateFieldFix.java @@ -102,9 +102,7 @@ public final class CreateFieldFix extends QuickFix{ CommandProcessor.getInstance().executeCommand( project, () -> ApplicationManager.getApplication().runWriteAction( - () -> { - createField(project, fieldClass, fieldName, boundClass, showErrors, rootContainer); - } + () -> createField(project, fieldClass, fieldName, boundClass, showErrors, rootContainer) ), UIDesignerBundle.message("command.create.field"), undoGroupId diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java b/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java index eb9b154cb9a9..9c6fe87d4549 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java @@ -214,22 +214,20 @@ public class CreateSnapShotAction extends AnAction { if (snapshot != null) { final String snapshot1 = snapshot; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> { - try { - PsiFile formFile = PsiFileFactory.getInstance(dir.getProject()) - .createFileFromText(dlg.getFormName() + GuiFormFileType.DOT_DEFAULT_EXTENSION, snapshot1); - formFile = (PsiFile)dir.add(formFile); - formFile.getVirtualFile().setCharset(CharsetToolkit.UTF8_CHARSET); - formFile.getViewProvider().getDocument().setText(snapshot1); - view.selectElement(formFile); - } - catch (IncorrectOperationException ex) { - Messages.showMessageDialog(project, UIDesignerBundle.message("snapshot.save.error", ex.getMessage()), - UIDesignerBundle.message("snapshot.title"), Messages.getErrorIcon()); - } - }, "", null); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { + try { + PsiFile formFile = PsiFileFactory.getInstance(dir.getProject()) + .createFileFromText(dlg.getFormName() + GuiFormFileType.DOT_DEFAULT_EXTENSION, snapshot1); + formFile = (PsiFile)dir.add(formFile); + formFile.getVirtualFile().setCharset(CharsetToolkit.UTF8_CHARSET); + formFile.getViewProvider().getDocument().setText(snapshot1); + view.selectElement(formFile); + } + catch (IncorrectOperationException ex) { + Messages.showMessageDialog(project, UIDesignerBundle.message("snapshot.save.error", ex.getMessage()), + UIDesignerBundle.message("snapshot.title"), Messages.getErrorIcon()); + } + }, "", null)); } } diff --git a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java index 5295305f32cc..66f628052470 100644 --- a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java +++ b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java @@ -91,9 +91,7 @@ public class FormSourceCodeGeneratorTest extends PsiTestCase { assertNotNull(form); CommandProcessor.getInstance().executeCommand(myProject, () -> { try { - ApplicationManager.getApplication().runWriteAction(() -> { - myGenerator.generate(form); - }); + ApplicationManager.getApplication().runWriteAction(() -> myGenerator.generate(form)); } catch (Exception e) { fail(e.getMessage()); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathCompletionContributor.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathCompletionContributor.java index afcd4aa86ae9..1ae0a5fd5155 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathCompletionContributor.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/completion/XPathCompletionContributor.java @@ -92,9 +92,7 @@ public class XPathCompletionContributor extends CompletionContributor { if (namespaceContext != null) { final String prefixForURI = namespaceContext.getPrefixForURI(XPath2Type.XMLSCHEMA_NS, parent.getXPathContext().getContextElement()); if (prefixForURI != null && prefixForURI.length() > 0) { - addResult(result, ContainerUtil.map(XPath2Type.SchemaType.listSchemaTypes(), type -> { - return new MyLookup(prefixForURI + ":" + type.getQName().getLocalPart()); - }), parameters.getPosition(), parameters.getOffset()); + addResult(result, ContainerUtil.map(XPath2Type.SchemaType.listSchemaTypes(), type -> new MyLookup(prefixForURI + ":" + type.getQName().getLocalPart())), parameters.getPosition(), parameters.getOffset()); } } } @@ -106,9 +104,7 @@ public class XPathCompletionContributor extends CompletionContributor { final QName qName = parent.getXPathContext().getQName(parent); if (qName != null && qName.getNamespaceURI().equals(XPath2Type.XMLSCHEMA_NS)) { - addResult(result, ContainerUtil.map(XPath2Type.SchemaType.listSchemaTypes(), type -> { - return new MyLookup(type.getQName().getLocalPart()); - }), parameters.getPosition(), parameters.getOffset()); + addResult(result, ContainerUtil.map(XPath2Type.SchemaType.listSchemaTypes(), type -> new MyLookup(type.getQName().getLocalPart())), parameters.getPosition(), parameters.getOffset()); } } }); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltIncludeIndex.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltIncludeIndex.java index 5dd2896b4af9..ad854350bb06 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltIncludeIndex.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltIncludeIndex.java @@ -79,9 +79,7 @@ public class XsltIncludeIndex { private static boolean _process(VirtualFile[] files, Project project, Processor processor) { final PsiManager psiManager = PsiManager.getInstance(project); - final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, (NullableFunction)file -> { - return psiManager.findFile(file); - }); + final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, (NullableFunction)file -> psiManager.findFile(file)); for (final PsiFile psiFile : psiFiles) { if (XsltSupport.isXsltFile(psiFile)) { if (!processor.process((XmlFile)psiFile)) { diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/quickfix/DownloadManager.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/quickfix/DownloadManager.java index 60b8406b4bdf..4f601d6b7e47 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/quickfix/DownloadManager.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/quickfix/DownloadManager.java @@ -81,9 +81,7 @@ public abstract class DownloadManager { resourceManager.addResource(location, file.getAbsolutePath()); } else { - ApplicationManager.getApplication().invokeLater(() -> { - Messages.showErrorDialog(myProject, "Not a valid file: " + vf.getPresentableUrl(), "Download Problem"); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(myProject, "Not a valid file: " + vf.getPresentableUrl(), "Download Problem"), myProject.getDisposed()); } } diff --git a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/xslt/XsltHighlightingTest.java b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/xslt/XsltHighlightingTest.java index 2ddd6fd20574..0da4ba209a0f 100644 --- a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/xslt/XsltHighlightingTest.java +++ b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/xslt/XsltHighlightingTest.java @@ -36,9 +36,7 @@ public class XsltHighlightingTest extends TestBase { protected void setUp() throws Exception { super.setUp(); myFixture.enableInspections(XsltStuffProvider.INSPECTION_CLASSES); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("urn:my"); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("urn:my")); } public void xtestBackwardIncludedVariable() throws Throwable { diff --git a/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java b/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java index 5566607057bb..c9f03d06b854 100644 --- a/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java +++ b/plugins/yaml/src/org/jetbrains/yaml/completion/YamlKeyCompletionInsertHandler.java @@ -36,9 +36,7 @@ public abstract class YamlKeyCompletionInsertHandler im context.getEditor().getCaretModel().moveToOffset(created.getTextRange().getEndOffset()); if (oldValue != null) { - WriteCommandAction.runWriteCommandAction(context.getProject(), () -> { - created.setValue(oldValue); - }); + WriteCommandAction.runWriteCommandAction(context.getProject(), () -> created.setValue(oldValue)); } PsiDocumentManager.getInstance(context.getProject()).doPostponedOperationsAndUnblockDocument(context.getDocument()); @@ -74,9 +72,7 @@ public abstract class YamlKeyCompletionInsertHandler im } context.setTailOffset(keyValue.getTextRange().getEndOffset()); - WriteCommandAction.runWriteCommandAction(context.getProject(), () -> { - keyValue.getParentMapping().deleteKeyValue(keyValue); - }); + WriteCommandAction.runWriteCommandAction(context.getProject(), () -> keyValue.getParentMapping().deleteKeyValue(keyValue)); return oldValue; } diff --git a/plugins/yaml/testSrc/org/jetbrains/yaml/psiModification/YAMLMappingModificationTest.java b/plugins/yaml/testSrc/org/jetbrains/yaml/psiModification/YAMLMappingModificationTest.java index 5e9409960968..6fb2f3a1e483 100644 --- a/plugins/yaml/testSrc/org/jetbrains/yaml/psiModification/YAMLMappingModificationTest.java +++ b/plugins/yaml/testSrc/org/jetbrains/yaml/psiModification/YAMLMappingModificationTest.java @@ -70,9 +70,7 @@ public class YAMLMappingModificationTest extends LightPlatformCodeInsightFixture final YAMLKeyValue dummyKV = YAMLElementGenerator.getInstance(myFixture.getProject()).createYamlKeyValue("foo", valueText); assertNotNull(dummyKV.getValue()); - WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> { - keyValue.setValue(dummyKV.getValue()); - }); + WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> keyValue.setValue(dummyKV.getValue())); assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", myFixture.getFile().getText(), false); } @@ -98,9 +96,7 @@ public class YAMLMappingModificationTest extends LightPlatformCodeInsightFixture final YAMLKeyValue dummyKeyValue = YAMLElementGenerator.getInstance(myFixture.getProject()).createYamlKeyValue(key, content); assertNotNull(dummyKeyValue); - WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> { - mapping.putKeyValue(dummyKeyValue); - }); + WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> mapping.putKeyValue(dummyKeyValue)); } assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", myFixture.getFile().getText(), false); diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCFromCourseArchive.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCFromCourseArchive.java index 72c5b5826edd..40a81611150e 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCFromCourseArchive.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCFromCourseArchive.java @@ -92,9 +92,7 @@ public class CCFromCourseArchive extends DumbAwareAction { task.setLesson(lesson); if (taskDir == null) continue; for (final Map.Entry entry : task.getTaskFiles().entrySet()) { - ApplicationManager.getApplication().runWriteAction(() -> { - createAnswerFile(project, taskDir, entry); - }); + ApplicationManager.getApplication().runWriteAction(() -> createAnswerFile(project, taskDir, entry)); } taskIndex += 1; } @@ -139,9 +137,7 @@ public class CCFromCourseArchive extends DumbAwareAction { final Document document = FileDocumentManager.getInstance().getDocument(file); if (document == null) return; - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - document.replaceString(0, document.getTextLength(), originDocument.getCharsSequence()); - }), "Create answer document", "Create answer document"); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> document.replaceString(0, document.getTextLength(), originDocument.getCharsSequence())), "Create answer document", "Create answer document"); EduDocumentListener listener = new EduDocumentListener(taskFile, false); document.addDocumentListener(listener); taskFile.sortAnswerPlaceholders(); @@ -149,9 +145,7 @@ public class CCFromCourseArchive extends DumbAwareAction { final AnswerPlaceholder answerPlaceholder = taskFile.getAnswerPlaceholders().get(i); replaceAnswerPlaceholder(project, document, answerPlaceholder); } - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - FileDocumentManager.getInstance().saveDocument(document); - }), "x", "qwe"); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> FileDocumentManager.getInstance().saveDocument(document)), "x", "qwe"); document.removeDocumentListener(listener); } diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java index a3a381f1ad64..6c278dbc04b4 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java @@ -121,9 +121,7 @@ public class CCShowPreview extends DumbAwareAction { return; } - ApplicationManager.getApplication().runWriteAction(() -> { - EduUtils.createStudentFileFromAnswer(project, generatedFilesFolder, taskDir.getVirtualFile(), virtualFile.getName(), taskFileCopy); - }); + ApplicationManager.getApplication().runWriteAction(() -> EduUtils.createStudentFileFromAnswer(project, generatedFilesFolder, taskDir.getVirtualFile(), virtualFile.getName(), taskFileCopy)); VirtualFile userFile = generatedFilesFolder.findChild(virtualFile.getName()); if (userFile == null) { diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java b/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java index 2c41cda8d574..8559bd500b52 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java @@ -345,9 +345,7 @@ public class StudyUtils { final DocumentImpl documentImpl = (DocumentImpl)document; List blocks = documentImpl.getGuardedBlocks(); for (final RangeMarker block : blocks) { - ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { - document.removeGuardedBlock(block); - })); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> document.removeGuardedBlock(block))); } } } diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java b/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java index 33c626a05bcb..b1626645bf7e 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java @@ -159,9 +159,7 @@ public class StudyCheckUtils { final String text = answerPlaceholder.getPossibleAnswer(); document.replaceString(start, end, text); } - ApplicationManager.getApplication().runWriteAction(() -> { - documentManager.saveDocument(document); - }); + ApplicationManager.getApplication().runWriteAction(() -> documentManager.saveDocument(document)); } } catch (IOException e) { diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudySmartChecker.java b/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudySmartChecker.java index 14870203abac..7bea87d39e51 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudySmartChecker.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudySmartChecker.java @@ -60,9 +60,7 @@ public class StudySmartChecker { int userEnd = userStart + userAnswerPlaceholder.getRealLength(); String text = usersDocument.getText(new TextRange(userStart, userEnd)); windowDocument.replaceString(start, end, text); - ApplicationManager.getApplication().runWriteAction(() -> { - documentManager.saveDocument(windowDocument); - }); + ApplicationManager.getApplication().runWriteAction(() -> documentManager.saveDocument(windowDocument)); VirtualFile fileWindows = EduUtils.flushWindows(windowTaskFile, windowCopy, true); Process smartTestProcess = testRunner.createCheckProcess(project, windowCopy.getPath()); final CapturingProcessHandler handler = new CapturingProcessHandler(smartTestProcess, null, windowCopy.getPath()); diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/core/EduUtils.java b/python/educational-core/student/src/com/jetbrains/edu/learning/core/EduUtils.java index ce7b3fe21790..fb5df916db6c 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/core/EduUtils.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/core/EduUtils.java @@ -99,9 +99,7 @@ public class EduUtils { final String windowDescription = document.getText(new TextRange(start, start + length)); printWriter.println("#educational_plugin_window = " + windowDescription); } - ApplicationManager.getApplication().runWriteAction(() -> { - FileDocumentManager.getInstance().saveDocument(document); - }); + ApplicationManager.getApplication().runWriteAction(() -> FileDocumentManager.getInstance().saveDocument(document)); } catch (IOException e) { LOG.error(e); @@ -194,9 +192,7 @@ public class EduUtils { } replaceAnswerPlaceholder(project, document, answerPlaceholder); } - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - FileDocumentManager.getInstance().saveDocument(document); - }), "Create Student File", "Create Student File"); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> FileDocumentManager.getInstance().saveDocument(document)), "Create Student File", "Create Student File"); document.removeDocumentListener(listener); } diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Course.java b/python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Course.java index 21b4c6001973..162011126916 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Course.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Course.java @@ -77,9 +77,7 @@ public class Course { } public static String getAuthorsString(@NotNull List authors) { - return StringUtil.join(authors, author -> { - return author.getName(); - }, ", "); + return StringUtil.join(authors, author -> author.getName(), ", "); } public void setAuthors(String[] authors) { diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java b/python/educational-core/student/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java index 908a0e215948..d87b5be1b4fa 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java @@ -417,9 +417,7 @@ public class StudyProjectGenerator { @Nullable private static CourseInfo addCourse(List courses, File courseDir) { if (courseDir.isDirectory()) { - File[] courseFiles = courseDir.listFiles((dir, name) -> { - return name.equals(EduNames.COURSE_META_FILE); - }); + File[] courseFiles = courseDir.listFiles((dir, name) -> name.equals(EduNames.COURSE_META_FILE)); if (courseFiles.length != 1) { LOG.info("User tried to add course with more than one or without course files"); return null; @@ -441,9 +439,7 @@ public class StudyProjectGenerator { @Nullable private static CourseInfo getCourseInfo(File courseFile) { if (courseFile.isDirectory()) { - File[] courseFiles = courseFile.listFiles((dir, name) -> { - return name.equals(EduNames.COURSE_META_FILE); - }); + File[] courseFiles = courseFile.listFiles((dir, name) -> name.equals(EduNames.COURSE_META_FILE)); if (courseFiles.length != 1) { LOG.info("More than one or without course files"); return null; diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicConnector.java b/python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicConnector.java index eac6c6c7c720..8a20545cfc2e 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicConnector.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicConnector.java @@ -432,9 +432,7 @@ public class EduStepicConnector { postUnit(lessonId, position, sectionId); position += 1; } - ApplicationManager.getApplication().runReadAction(() -> { - postAdditionalFiles(project, postedCourse.id, indicator); - }); + ApplicationManager.getApplication().runReadAction(() -> postAdditionalFiles(project, postedCourse.id, indicator)); } catch (IOException e) { LOG.error(e.getMessage()); diff --git a/python/educational-python/src/com/jetbrains/python/edu/PyCharmEduInitialConfigurator.java b/python/educational-python/src/com/jetbrains/python/edu/PyCharmEduInitialConfigurator.java index 3c3d756e4b80..49d301b1c327 100644 --- a/python/educational-python/src/com/jetbrains/python/edu/PyCharmEduInitialConfigurator.java +++ b/python/educational-python/src/com/jetbrains/python/edu/PyCharmEduInitialConfigurator.java @@ -163,9 +163,7 @@ public class PyCharmEduInitialConfigurator { uiSettings.SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES = true; uiSettings.SHOW_MEMORY_INDICATOR = false; final String ignoredFilesList = fileTypeManager.getIgnoredFilesList(); - ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { - FileTypeManager.getInstance().setIgnoredFilesList(ignoredFilesList + ";*$py.class"); - })); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> FileTypeManager.getInstance().setIgnoredFilesList(ignoredFilesList + ";*$py.class"))); PyCodeInsightSettings.getInstance().SHOW_IMPORT_POPUP = false; } final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); diff --git a/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyCheckAction.java b/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyCheckAction.java index fdb110718b34..7fb403665248 100644 --- a/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyCheckAction.java +++ b/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyCheckAction.java @@ -31,49 +31,47 @@ public class PyStudyCheckAction extends StudyCheckAction { public static final String ACTION_ID = "PyCheckAction"; public void check(@NotNull Project project) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().runUndoTransparentAction(() -> { - final StudyEditor selectedEditor = StudyUtils.getSelectedStudyEditor(project); - if (selectedEditor == null) return; - final StudyState studyState = new StudyState(selectedEditor); - if (!studyState.isValid()) { - LOG.info("StudyCheckAction was invoked outside study editor"); - return; + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().runUndoTransparentAction(() -> { + final StudyEditor selectedEditor = StudyUtils.getSelectedStudyEditor(project); + if (selectedEditor == null) return; + final StudyState studyState = new StudyState(selectedEditor); + if (!studyState.isValid()) { + LOG.info("StudyCheckAction was invoked outside study editor"); + return; + } + if (StudyCheckUtils.hasBackgroundProcesses(project)) return; + + + if (!runTask(project)) return; + + final Task task = studyState.getTask(); + final VirtualFile taskDir = studyState.getTaskDir(); + StudyCheckUtils.flushWindows(task, taskDir); + + + ApplicationManager.getApplication().invokeLater( + () -> IdeFocusManager.getInstance(project).requestFocus(studyState.getEditor().getComponent(), true)); + + final StudyTestRunner testRunner = StudyUtils.getTestRunner(task, taskDir); + Process testProcess = null; + String commandLine = ""; + try { + final VirtualFile executablePath = getTaskVirtualFile(studyState, task, taskDir); + if (executablePath != null) { + commandLine = executablePath.getPath(); + testProcess = testRunner.createCheckProcess(project, commandLine); } - if (StudyCheckUtils.hasBackgroundProcesses(project)) return; - - - if (!runTask(project)) return; - - final Task task = studyState.getTask(); - final VirtualFile taskDir = studyState.getTaskDir(); - StudyCheckUtils.flushWindows(task, taskDir); - - - ApplicationManager.getApplication().invokeLater( - () -> IdeFocusManager.getInstance(project).requestFocus(studyState.getEditor().getComponent(), true)); - - final StudyTestRunner testRunner = StudyUtils.getTestRunner(task, taskDir); - Process testProcess = null; - String commandLine = ""; - try { - final VirtualFile executablePath = getTaskVirtualFile(studyState, task, taskDir); - if (executablePath != null) { - commandLine = executablePath.getPath(); - testProcess = testRunner.createCheckProcess(project, commandLine); - } - } - catch (ExecutionException e) { - LOG.error(e); - } - if (testProcess == null) { - return; - } - myCheckInProgress.set(true); - StudyCheckTask checkTask = getCheckTask(project, studyState, testRunner, testProcess, commandLine); - ProgressManager.getInstance().run(checkTask); - }); - }); + } + catch (ExecutionException e) { + LOG.error(e); + } + if (testProcess == null) { + return; + } + myCheckInProgress.set(true); + StudyCheckTask checkTask = getCheckTask(project, studyState, testRunner, testProcess, commandLine); + ProgressManager.getInstance().run(checkTask); + })); } private static boolean runTask(@NotNull Project project) { @@ -105,9 +103,7 @@ public class PyStudyCheckAction extends StudyCheckAction { continue; } if (EduNames.STUDY.equals(myTaskManger.getCourse().getCourseMode())) { - CommandProcessor.getInstance().runUndoTransparentAction(() -> ApplicationManager.getApplication().runWriteAction(() -> { - StudyCheckUtils.runSmartTestProcess(myTaskDir, testRunner, name, taskFile, project); - })); + CommandProcessor.getInstance().runUndoTransparentAction(() -> ApplicationManager.getApplication().runWriteAction(() -> StudyCheckUtils.runSmartTestProcess(myTaskDir, testRunner, name, taskFile, project))); } } StudyCheckUtils.showTestResultPopUp(testsOutput.getMessage(), MessageType.ERROR.getPopupBackground(), project); diff --git a/python/ide/src/com/jetbrains/python/PyCharmInitialConfigurator.java b/python/ide/src/com/jetbrains/python/PyCharmInitialConfigurator.java index 10b68db1c3af..9a095d6b2121 100644 --- a/python/ide/src/com/jetbrains/python/PyCharmInitialConfigurator.java +++ b/python/ide/src/com/jetbrains/python/PyCharmInitialConfigurator.java @@ -56,9 +56,7 @@ public class PyCharmInitialConfigurator { propertiesComponent.setValue("PyCharm.InitialConfiguration.V3", "true"); UISettings.getInstance().SHOW_MEMORY_INDICATOR = false; final String ignoredFilesList = fileTypeManager.getIgnoredFilesList(); - ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { - FileTypeManager.getInstance().setIgnoredFilesList(ignoredFilesList + ";*$py.class"); - })); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> FileTypeManager.getInstance().setIgnoredFilesList(ignoredFilesList + ";*$py.class"))); } if (!propertiesComponent.getBoolean("PyCharm.InitialConfiguration.V4")) { propertiesComponent.setValue("PyCharm.InitialConfiguration.V4", true); diff --git a/python/ide/src/com/jetbrains/python/buildout/BuildoutConfigurable.java b/python/ide/src/com/jetbrains/python/buildout/BuildoutConfigurable.java index 0d5bc35953f9..f66137ae77d3 100644 --- a/python/ide/src/com/jetbrains/python/buildout/BuildoutConfigurable.java +++ b/python/ide/src/com/jetbrains/python/buildout/BuildoutConfigurable.java @@ -144,9 +144,7 @@ public class BuildoutConfigurable implements Configurable, NonDefaultProjectConf private void removeFacet(BuildoutFacet facet) { final ModifiableFacetModel model = FacetManager.getInstance(myModule).createModifiableModel(); model.removeFacet(facet); - ApplicationManager.getApplication().runWriteAction(() -> { - model.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> model.commit()); } @Override diff --git a/python/ide/src/com/jetbrains/python/newProject/PythonBaseProjectGenerator.java b/python/ide/src/com/jetbrains/python/newProject/PythonBaseProjectGenerator.java index 18947ab1dcb4..463121e96106 100644 --- a/python/ide/src/com/jetbrains/python/newProject/PythonBaseProjectGenerator.java +++ b/python/ide/src/com/jetbrains/python/newProject/PythonBaseProjectGenerator.java @@ -69,9 +69,7 @@ public class PythonBaseProjectGenerator extends PythonProjectGenerator implement (RemoteSdkCredentials)((RemoteProjectSettings)settings).getSdk().getSdkAdditionalData()); } else if (settings instanceof PyNewProjectSettings) { - ApplicationManager.getApplication().runWriteAction(() -> { - ModuleRootModificationUtil.setModuleSdk(module, ((PyNewProjectSettings)settings).getSdk()); - }); + ApplicationManager.getApplication().runWriteAction(() -> ModuleRootModificationUtil.setModuleSdk(module, ((PyNewProjectSettings)settings).getSdk())); } } diff --git a/python/openapi/src/com/jetbrains/python/packaging/PyRequirement.java b/python/openapi/src/com/jetbrains/python/packaging/PyRequirement.java index 7879722ad09b..2fab9eeec1f1 100644 --- a/python/openapi/src/com/jetbrains/python/packaging/PyRequirement.java +++ b/python/openapi/src/com/jetbrains/python/packaging/PyRequirement.java @@ -170,9 +170,7 @@ public class PyRequirement { @Override public String toString() { return myName + StringUtil.join(myVersionSpecs, - spec -> { - return spec.toString(); - }, + spec -> spec.toString(), "," ); } diff --git a/python/pluginJava/com/jetbrains/python/facet/PythonSdkTableListener.java b/python/pluginJava/com/jetbrains/python/facet/PythonSdkTableListener.java index f931adfa39dd..ce52d8bd8bea 100644 --- a/python/pluginJava/com/jetbrains/python/facet/PythonSdkTableListener.java +++ b/python/pluginJava/com/jetbrains/python/facet/PythonSdkTableListener.java @@ -71,33 +71,29 @@ public class PythonSdkTableListener implements ApplicationComponent { } private static void removeLibrary(final Sdk sdk) { - ApplicationManager.getApplication().invokeLater(() -> { - ApplicationManager.getApplication().runWriteAction(() -> { - final LibraryTable.ModifiableModel libraryTableModel = - ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel(); - final Library library = libraryTableModel.getLibraryByName(PythonFacet.getFacetLibraryName(sdk.getName())); - if (library != null) { - libraryTableModel.removeLibrary(library); - } - libraryTableModel.commit(); - }); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { + final LibraryTable.ModifiableModel libraryTableModel = + ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel(); + final Library library = libraryTableModel.getLibraryByName(PythonFacet.getFacetLibraryName(sdk.getName())); + if (library != null) { + libraryTableModel.removeLibrary(library); + } + libraryTableModel.commit(); + }), ModalityState.NON_MODAL); } private static void renameLibrary(final Sdk sdk, final String previousName) { - ApplicationManager.getApplication().invokeLater(() -> { - ApplicationManager.getApplication().runWriteAction(() -> { - final LibraryTable.ModifiableModel libraryTableModel = - ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel(); - final Library library = libraryTableModel.getLibraryByName(PythonFacet.getFacetLibraryName(previousName)); - if (library != null) { - final Library.ModifiableModel model = library.getModifiableModel(); - model.setName(PythonFacet.getFacetLibraryName(sdk.getName())); - model.commit(); - } - libraryTableModel.commit(); - }); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { + final LibraryTable.ModifiableModel libraryTableModel = + ModifiableModelsProvider.SERVICE.getInstance().getLibraryTableModifiableModel(); + final Library library = libraryTableModel.getLibraryByName(PythonFacet.getFacetLibraryName(previousName)); + if (library != null) { + final Library.ModifiableModel model = library.getModifiableModel(); + model.setName(PythonFacet.getFacetLibraryName(sdk.getName())); + model.commit(); + } + libraryTableModel.commit(); + }), ModalityState.NON_MODAL); } @NotNull diff --git a/python/python-community-configure/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java b/python/python-community-configure/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java index ce85b6f1b542..d15ae055eaec 100644 --- a/python/python-community-configure/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java +++ b/python/python-community-configure/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java @@ -315,9 +315,7 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable { } private void setSdk(final Sdk item) { - ApplicationManager.getApplication().runWriteAction(() -> { - ProjectRootManager.getInstance(myProject).setProjectSdk(item); - }); + ApplicationManager.getApplication().runWriteAction(() -> ProjectRootManager.getInstance(myProject).setProjectSdk(item)); if (myModule != null) { ModuleRootModificationUtil.setModuleSdk(myModule, item); } diff --git a/python/python-community-configure/src/com/jetbrains/python/configuration/PyContentEntriesModuleConfigurable.java b/python/python-community-configure/src/com/jetbrains/python/configuration/PyContentEntriesModuleConfigurable.java index 8767ffe7f8e4..30719cc18c68 100644 --- a/python/python-community-configure/src/com/jetbrains/python/configuration/PyContentEntriesModuleConfigurable.java +++ b/python/python-community-configure/src/com/jetbrains/python/configuration/PyContentEntriesModuleConfigurable.java @@ -107,9 +107,7 @@ public class PyContentEntriesModuleConfigurable extends SearchableConfigurable.P final boolean editorWasModified = myEditor.isModified(); myEditor.apply(); if (editorWasModified) { - ApplicationManager.getApplication().runWriteAction(() -> { - myModifiableModel.commit(); - }); + ApplicationManager.getApplication().runWriteAction(() -> myModifiableModel.commit()); resetEditor(); } } diff --git a/python/python-rest/src/com/jetbrains/rest/sphinx/RunSphinxQuickStartAction.java b/python/python-rest/src/com/jetbrains/rest/sphinx/RunSphinxQuickStartAction.java index b32deb971a69..d6983fd95759 100644 --- a/python/python-rest/src/com/jetbrains/rest/sphinx/RunSphinxQuickStartAction.java +++ b/python/python-rest/src/com/jetbrains/rest/sphinx/RunSphinxQuickStartAction.java @@ -52,8 +52,6 @@ public class RunSphinxQuickStartAction extends AnAction implements DumbAware { if (module == null) return; final SphinxBaseCommand action = new SphinxBaseCommand(); final Module finalModule = module; - ApplicationManager.getApplication().invokeLater(() -> { - action.execute(finalModule); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> action.execute(finalModule), ModalityState.NON_MODAL); } } diff --git a/python/src/com/jetbrains/python/buildout/BuildoutConfigPanel.java b/python/src/com/jetbrains/python/buildout/BuildoutConfigPanel.java index 9a880acbbf1d..d2b844a848fd 100644 --- a/python/src/com/jetbrains/python/buildout/BuildoutConfigPanel.java +++ b/python/src/com/jetbrains/python/buildout/BuildoutConfigPanel.java @@ -119,9 +119,7 @@ public class BuildoutConfigPanel extends JPanel { public void reset() { final List scriptFiles = BuildoutFacet.getScripts(BuildoutFacet.getInstance(myModule), myModule.getProject().getBaseDir()); - final List scripts = ContainerUtil.map(scriptFiles, file -> { - return file.getPath(); - }); + final List scripts = ContainerUtil.map(scriptFiles, file -> file.getPath()); myScript.getComboBox().setModel(new CollectionComboBoxModel(scripts, myConfiguration.getScriptName())); myScript.getComboBox().getEditor().setItem(myConfiguration.getScriptName()); } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertTripleQuotedStringIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertTripleQuotedStringIntention.java index ae6e61198042..98b9c7c8b1cd 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertTripleQuotedStringIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertTripleQuotedStringIntention.java @@ -181,8 +181,6 @@ public class PyConvertTripleQuotedStringIntention extends BaseIntentionAction { @NotNull private static List extractStringNodesInfo(@NotNull PyStringLiteralExpression expression) { - return ContainerUtil.map(expression.getStringNodes(), node -> { - return new StringNodeInfo(node); - }); + return ContainerUtil.map(expression.getStringNodes(), node -> new StringNodeInfo(node)); } } diff --git a/python/src/com/jetbrains/python/codeInsight/override/PyMethodMember.java b/python/src/com/jetbrains/python/codeInsight/override/PyMethodMember.java index e9490dd57b29..58571e7c1de3 100644 --- a/python/src/com/jetbrains/python/codeInsight/override/PyMethodMember.java +++ b/python/src/com/jetbrains/python/codeInsight/override/PyMethodMember.java @@ -38,9 +38,7 @@ public class PyMethodMember extends PsiElementMemberChooserObject implements Cla if (element instanceof PyFunction) { final TypeEvalContext context = TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()); final List parameters = PyUtil.getParameters((PyFunction)element, context); - return element.getName() + "(" + StringUtil.join(parameters, parameter -> { - return PyUtil.getReadableRepr(parameter, false); - }, ", ") + ")"; + return element.getName() + "(" + StringUtil.join(parameters, parameter -> PyUtil.getReadableRepr(parameter, false), ", ") + ")"; } if (element instanceof PyClass && PyNames.FAKE_OLD_BASE.equals(element.getName())) { return ""; diff --git a/python/src/com/jetbrains/python/debugger/attach/PyLocalAttachDebuggerProvider.java b/python/src/com/jetbrains/python/debugger/attach/PyLocalAttachDebuggerProvider.java index 22e80275c145..706f3d6bb2f0 100644 --- a/python/src/com/jetbrains/python/debugger/attach/PyLocalAttachDebuggerProvider.java +++ b/python/src/com/jetbrains/python/debugger/attach/PyLocalAttachDebuggerProvider.java @@ -61,9 +61,7 @@ public class PyLocalAttachDebuggerProvider implements XLocalAttachDebuggerProvid Lists.newArrayList(new PyLocalAttachDebugger(processInfo.getExecutableCannonicalPath().get())); } else { - result = ContainerUtil.map(PythonSdkType.getAllLocalCPythons(), sdk -> { - return new PyLocalAttachDebugger(sdk); - }); + result = ContainerUtil.map(PythonSdkType.getAllLocalCPythons(), sdk -> new PyLocalAttachDebugger(sdk)); } // most recent python version goes first diff --git a/python/src/com/jetbrains/python/documentation/PythonDocumentationProvider.java b/python/src/com/jetbrains/python/documentation/PythonDocumentationProvider.java index bab50d539039..a82aca736f06 100644 --- a/python/src/com/jetbrains/python/documentation/PythonDocumentationProvider.java +++ b/python/src/com/jetbrains/python/documentation/PythonDocumentationProvider.java @@ -145,9 +145,7 @@ public class PythonDocumentationProvider extends AbstractDocumentationProvider i final List parameters = PyUtil.getParameters(fun, context); final String paramStr = "(" + StringUtil.join(parameters, - parameter -> { - return PyUtil.getReadableRepr(parameter, false); - }, + parameter -> PyUtil.getReadableRepr(parameter, false), ", ") + ")"; cat.addItem(escaper.apply(paramStr)); diff --git a/python/src/com/jetbrains/python/documentation/docstrings/DocStringFormat.java b/python/src/com/jetbrains/python/documentation/docstrings/DocStringFormat.java index 991ddbdaf660..caa5ec15a0a1 100644 --- a/python/src/com/jetbrains/python/documentation/docstrings/DocStringFormat.java +++ b/python/src/com/jetbrains/python/documentation/docstrings/DocStringFormat.java @@ -42,9 +42,7 @@ public enum DocStringFormat { @NotNull private static List getAllNames() { - return Collections.unmodifiableList(ContainerUtil.map(values(), format -> { - return format.getName(); - })); + return Collections.unmodifiableList(ContainerUtil.map(values(), format -> format.getName())); } public static final List ALL_NAMES_BUT_PLAIN = getAllNamesButPlain(); diff --git a/python/src/com/jetbrains/python/documentation/docstrings/SectionBasedDocString.java b/python/src/com/jetbrains/python/documentation/docstrings/SectionBasedDocString.java index e3c563c715b6..9832835c3076 100644 --- a/python/src/com/jetbrains/python/documentation/docstrings/SectionBasedDocString.java +++ b/python/src/com/jetbrains/python/documentation/docstrings/SectionBasedDocString.java @@ -307,9 +307,7 @@ public abstract class SectionBasedDocString extends DocStringLineParser implemen @NotNull @Override public List getParameters() { - return ContainerUtil.map(getParameterSubstrings(), substring -> { - return substring.toString(); - }); + return ContainerUtil.map(getParameterSubstrings(), substring -> substring.toString()); } @NotNull @@ -467,9 +465,7 @@ public abstract class SectionBasedDocString extends DocStringLineParser implemen @NotNull @Override public List getRaisedExceptions() { - return ContainerUtil.mapNotNull(getExceptionFields(), field -> { - return StringUtil.nullize(field.getType()); - }); + return ContainerUtil.mapNotNull(getExceptionFields(), field -> StringUtil.nullize(field.getType())); } @Nullable @@ -621,9 +617,7 @@ public abstract class SectionBasedDocString extends DocStringLineParser implemen @NotNull public List getNames() { - return ContainerUtil.map(myNames, substring -> { - return substring.toString(); - }); + return ContainerUtil.map(myNames, substring -> substring.toString()); } @Nullable diff --git a/python/src/com/jetbrains/python/editor/PythonCopyPasteProcessor.java b/python/src/com/jetbrains/python/editor/PythonCopyPasteProcessor.java index d91ac782450d..f55d49e3cd10 100644 --- a/python/src/com/jetbrains/python/editor/PythonCopyPasteProcessor.java +++ b/python/src/com/jetbrains/python/editor/PythonCopyPasteProcessor.java @@ -95,9 +95,7 @@ public class PythonCopyPasteProcessor implements CopyPastePreProcessor { editor.getSelectionModel().setSelection(lineStartOffset, selectionModel.getSelectionEnd()); if (StringUtil.isEmptyOrSpaces(line)) { - ApplicationManager.getApplication().runWriteAction(() -> { - document.deleteString(lineStartOffset, lineEndOffset); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.deleteString(lineStartOffset, lineEndOffset)); } } diff --git a/python/src/com/jetbrains/python/inspections/PyPackageRequirementsInspection.java b/python/src/com/jetbrains/python/inspections/PyPackageRequirementsInspection.java index 05db484640a7..b83fb7bdd050 100644 --- a/python/src/com/jetbrains/python/inspections/PyPackageRequirementsInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyPackageRequirementsInspection.java @@ -237,9 +237,7 @@ public class PyPackageRequirementsInspection extends PyInspection { @NotNull private static String requirementsToString(@NotNull List requirements) { - return StringUtil.join(requirements, requirement -> { - return String.format("'%s'", requirement.toString()); - }, ", "); + return StringUtil.join(requirements, requirement -> String.format("'%s'", requirement.toString()), ", "); } @Nullable diff --git a/python/src/com/jetbrains/python/inspections/PyTypeCheckerInspection.java b/python/src/com/jetbrains/python/inspections/PyTypeCheckerInspection.java index 8f64185a8481..bdf50a72fc52 100644 --- a/python/src/com/jetbrains/python/inspections/PyTypeCheckerInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyTypeCheckerInspection.java @@ -168,9 +168,7 @@ public class PyTypeCheckerInspection extends PyInspection { else { msg = String.format("Type '%s' doesn't have expected attributes %s", actualName, - StringUtil.join(missingAttributes, s -> { - return String.format("'%s'", s); - }, ", ")); + StringUtil.join(missingAttributes, s -> String.format("'%s'", s), ", ")); } } } diff --git a/python/src/com/jetbrains/python/inspections/quickfix/CompatibilityPrintCallQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/CompatibilityPrintCallQuickFix.java index 5d38258f2ad1..11214e8b5c66 100644 --- a/python/src/com/jetbrains/python/inspections/quickfix/CompatibilityPrintCallQuickFix.java +++ b/python/src/com/jetbrains/python/inspections/quickfix/CompatibilityPrintCallQuickFix.java @@ -53,9 +53,7 @@ public class CompatibilityPrintCallQuickFix implements LocalQuickFix { final PyFile file = (PyFile)expression.getContainingFile(); final PyExpression[] target = PsiTreeUtil.getChildrenOfType(expression, PyExpression.class); if (target != null) { - stringBuilder.append(StringUtil.join(target, o -> { - return o.getText(); - }, ", ")); + stringBuilder.append(StringUtil.join(target, o -> o.getText(), ", ")); } stringBuilder.append(")"); expression.replace(elementGenerator.createFromText(LanguageLevel.forElement(expression), PyExpression.class, diff --git a/python/src/com/jetbrains/python/packaging/PyPackageUtil.java b/python/src/com/jetbrains/python/packaging/PyPackageUtil.java index 5d6f6401a3bc..20cc90cd4ad9 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageUtil.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageUtil.java @@ -149,9 +149,7 @@ public class PyPackageUtil { @NotNull public static String requirementsToString(@NotNull List requirements) { - return StringUtil.join(requirements, requirement -> { - return String.format("'%s'", requirement.toString()); - }, ", "); + return StringUtil.join(requirements, requirement -> String.format("'%s'", requirement.toString()), ", "); } @Nullable diff --git a/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskChooserAction.java b/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskChooserAction.java index a8a88a78ff30..92a30f6c0766 100644 --- a/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskChooserAction.java +++ b/python/src/com/jetbrains/python/packaging/setupPy/SetupTaskChooserAction.java @@ -64,9 +64,7 @@ public class SetupTaskChooserAction extends AnAction { public void elementChosen(Object element) { if (element != null) { final SetupTask task = (SetupTask) element; - ApplicationManager.getApplication().invokeLater(() -> { - runSetupTask(task.getName(), module); - }, ModalityState.NON_MODAL); + ApplicationManager.getApplication().invokeLater(() -> runSetupTask(task.getName(), module), ModalityState.NON_MODAL); } } }, ModalityState.current(), false); diff --git a/python/src/com/jetbrains/python/psi/impl/PyFromImportStatementImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFromImportStatementImpl.java index 0d719b75b1b5..e013ec025f12 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFromImportStatementImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFromImportStatementImpl.java @@ -96,9 +96,7 @@ public class PyFromImportStatementImpl extends PyBaseElementImpl { - return new PyImportElement[count]; - }); + return stub.getChildrenByType(PyElementTypes.IMPORT_ELEMENT, count -> new PyImportElement[count]); } List result = new ArrayList(); final ASTNode importKeyword = getNode().findChildByType(PyTokenTypes.IMPORT_KEYWORD); diff --git a/python/src/com/jetbrains/python/psi/impl/PyImportStatementImpl.java b/python/src/com/jetbrains/python/psi/impl/PyImportStatementImpl.java index e8289a86c90a..d7956e029389 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyImportStatementImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyImportStatementImpl.java @@ -58,9 +58,7 @@ public class PyImportStatementImpl extends PyBaseElementImpl { - return new PyImportElement[count]; - }); + return stub.getChildrenByType(PyElementTypes.IMPORT_ELEMENT, count -> new PyImportElement[count]); } return childrenToPsi(TokenSet.create(PyElementTypes.IMPORT_ELEMENT), new PyImportElement[0]); } diff --git a/python/src/com/jetbrains/python/psi/resolve/CompletionVariantsProcessor.java b/python/src/com/jetbrains/python/psi/resolve/CompletionVariantsProcessor.java index 16a18e1fc860..9cf65340debb 100644 --- a/python/src/com/jetbrains/python/psi/resolve/CompletionVariantsProcessor.java +++ b/python/src/com/jetbrains/python/psi/resolve/CompletionVariantsProcessor.java @@ -70,9 +70,7 @@ public class CompletionVariantsProcessor extends VariantsProcessor { item = item.withInsertHandler(PyFunctionInsertHandler.INSTANCE); final TypeEvalContext context = TypeEvalContext.codeCompletion(project, myContext != null ? myContext.getContainingFile() : null); final List parameters = PyUtil.getParameters((PyFunction)element, context); - final String params = StringUtil.join(parameters, pyParameter -> { - return pyParameter.getName(); - }, ", "); + final String params = StringUtil.join(parameters, pyParameter -> pyParameter.getName(), ", "); item = item.withTailText("(" + params + ")"); } else if (element instanceof PyClass) { diff --git a/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java b/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java index 6d71201c5a02..76e8dac0d10e 100644 --- a/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java +++ b/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java @@ -236,9 +236,7 @@ public class PyReplaceExpressionUtil implements PyElementTypes { final StringBuilder builder = new StringBuilder(); builder.append("{"); final PyKeyValueExpression[] elements = dict.getElements(); - builder.append(StringUtil.join(elements, expression -> { - return expression.getText(); - }, ",")); + builder.append(StringUtil.join(elements, expression -> expression.getText(), ",")); if (elements.length > 0) { builder.append(","); } diff --git a/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java b/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java index b1a622bd9978..1b4cb1a8314f 100644 --- a/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java +++ b/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java @@ -420,9 +420,7 @@ public final class PyClassRefactoringUtil { @NotNull private static List multiResolveExpression(@NotNull PyReferenceExpression expr) { - return ContainerUtil.mapNotNull(expr.getReference().multiResolve(false), result -> { - return result.getElement(); - }); + return ContainerUtil.mapNotNull(expr.getReference().multiResolve(false), result -> result.getElement()); } /** diff --git a/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersDialog.java b/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersDialog.java index a016537a09d4..9d95ab763bcc 100644 --- a/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersDialog.java +++ b/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersDialog.java @@ -259,18 +259,14 @@ public class PyMoveModuleMembersDialog extends RefactoringDialog { @NotNull public List getSelectedTopLevelSymbols() { final Collection selectedMembers = myMemberSelectionTable.getSelectedMemberInfos(); - final List selectedElements = ContainerUtil.map(selectedMembers, info -> { - return info.getMember(); - }); + final List selectedElements = ContainerUtil.map(selectedMembers, info -> info.getMember()); return ContainerUtil.sorted(selectedElements, (e1, e2) -> PyPsiUtils.isBefore(e1, e2) ? -1 : 1); } @NotNull private static List collectModuleMemberInfos(@NotNull PyFile pyFile) { final List moduleMembers = PyMoveModuleMembersHelper.getTopLevelModuleMembers(pyFile); - return ContainerUtil.mapNotNull(moduleMembers, element -> { - return new PyModuleMemberInfo(element); - }); + return ContainerUtil.mapNotNull(moduleMembers, element -> new PyModuleMemberInfo(element)); } @NotNull diff --git a/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersProcessor.java b/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersProcessor.java index 21cd107d44f6..15004bb74ea4 100644 --- a/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersProcessor.java +++ b/python/src/com/jetbrains/python/refactoring/move/PyMoveModuleMembersProcessor.java @@ -89,9 +89,7 @@ public class PyMoveModuleMembersProcessor extends BaseRefactoringProcessor { protected UsageInfo[] findUsages() { final List result = new ArrayList(); for (final PsiNamedElement element : myElements) { - result.addAll(ContainerUtil.map(PyRefactoringUtil.findUsages(element, false), usageInfo -> { - return new MyUsageInfo(usageInfo, element); - })); + result.addAll(ContainerUtil.map(PyRefactoringUtil.findUsages(element, false), usageInfo -> new MyUsageInfo(usageInfo, element))); } return result.toArray(new UsageInfo[result.size()]); } diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkType.java b/python/src/com/jetbrains/python/sdk/PythonSdkType.java index 864a172c976c..f45a1331e6b7 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkType.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkType.java @@ -197,9 +197,7 @@ public final class PythonSdkType extends SdkType { } private static TreeSet createVersionSet() { - return new TreeSet((o1, o2) -> { - return findDigits(o1).compareTo(findDigits(o2)); - }); + return new TreeSet((o1, o2) -> findDigits(o1).compareTo(findDigits(o2))); } private static String findDigits(String s) { diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java index abe2ee703857..7baf341b46de 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java @@ -80,20 +80,18 @@ public class PythonSdkUpdater implements StartupActivity { if (application.isUnitTestMode()) { return; } - EdtExecutorService.getScheduledExecutorInstance().schedule(() -> { - ProgressManager.getInstance().run(new Task.Backgroundable(project, "Updating Python Paths", false) { - @Override - public void run(@NotNull ProgressIndicator indicator) { - final Project project = getProject(); - if (project.isDisposed()) { - return; - } - for (final Sdk sdk : getPythonSdks(project)) { - update(sdk, null, project, null); - } + EdtExecutorService.getScheduledExecutorInstance().schedule(() -> ProgressManager.getInstance().run(new Task.Backgroundable(project, "Updating Python Paths", false) { + @Override + public void run(@NotNull ProgressIndicator indicator) { + final Project project = getProject(); + if (project.isDisposed()) { + return; } - }); - }, INITIAL_ACTIVITY_DELAY, TimeUnit.MILLISECONDS); + for (final Sdk sdk : getPythonSdks(project)) { + update(sdk, null, project, null); + } + } + }), INITIAL_ACTIVITY_DELAY, TimeUnit.MILLISECONDS); } /** diff --git a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java index f70dc3b28b52..a3600e260b3b 100644 --- a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java +++ b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java @@ -356,9 +356,7 @@ public class PySkeletonRefresher { } if ((builtinsUpdated || PySdkUtil.isRemote(mySdk)) && myProject != null) { - ApplicationManager.getApplication().invokeLater(() -> { - DaemonCodeAnalyzer.getInstance(myProject).restart(); - }, myProject.getDisposed()); + ApplicationManager.getApplication().invokeLater(() -> DaemonCodeAnalyzer.getInstance(myProject).restart(), myProject.getDisposed()); } return errorList; diff --git a/python/testSrc/com/jetbrains/commandInterface/commandLine/CommandTestTools.java b/python/testSrc/com/jetbrains/commandInterface/commandLine/CommandTestTools.java index ecf34b3c7041..0f924ae75e75 100644 --- a/python/testSrc/com/jetbrains/commandInterface/commandLine/CommandTestTools.java +++ b/python/testSrc/com/jetbrains/commandInterface/commandLine/CommandTestTools.java @@ -86,9 +86,7 @@ final class CommandTestTools { * Hack to register file type (not registered for some reason?) */ static void initFileType() { - ApplicationManager.getApplication().runWriteAction(() -> { - FileTypeManager.getInstance().associateExtension(CommandLineFileType.INSTANCE, CommandLineFileType.EXTENSION); - }); + ApplicationManager.getApplication().runWriteAction(() -> FileTypeManager.getInstance().associateExtension(CommandLineFileType.INSTANCE, CommandLineFileType.EXTENSION)); } /** diff --git a/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java b/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java index 9c08062a4bbb..c341d111f4f8 100644 --- a/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java +++ b/python/testSrc/com/jetbrains/env/python/console/PyConsoleTask.java @@ -296,9 +296,7 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask { private int myLen = 0; public void start() { - myThread = new Thread(() -> { - doJob(); - }, "py console printer"); + myThread = new Thread(() -> doJob(), "py console printer"); myThread.setDaemon(true); myThread.start(); } diff --git a/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java b/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java index cbf159403320..b2ea2c90175e 100644 --- a/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java +++ b/python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java @@ -354,9 +354,7 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask { private Thread myThread; public void start() { - myThread = new Thread(() -> { - doJob(); - }, "py debugger job"); + myThread = new Thread(() -> doJob(), "py debugger job"); myThread.setDaemon(true); myThread.start(); } diff --git a/python/testSrc/com/jetbrains/python/PyAddImportTest.java b/python/testSrc/com/jetbrains/python/PyAddImportTest.java index 7df6e801626f..8a5e146b15bf 100644 --- a/python/testSrc/com/jetbrains/python/PyAddImportTest.java +++ b/python/testSrc/com/jetbrains/python/PyAddImportTest.java @@ -122,9 +122,7 @@ public class PyAddImportTest extends PyTestCase { private void doAddFromImport(final String path, final String name, final ImportPriority priority) { myFixture.configureByFile(getTestName(true) + ".py"); - WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> { - AddImportHelper.addFromImportStatement(myFixture.getFile(), path, name, null, priority, null); - }); + WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> AddImportHelper.addFromImportStatement(myFixture.getFile(), path, name, null, priority, null)); myFixture.checkResultByFile(getTestName(true) + ".after.py"); } diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index 7e83af7d5e33..82da7cd63185 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -455,9 +455,7 @@ public class PyFormatterTest extends PyTestCase { getCommonCodeStyleSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true; final String testName = "formatter/" + getTestName(true); myFixture.configureByFile(testName + ".py"); - WriteCommandAction.runWriteCommandAction(null, () -> { - myFixture.type("\n("); - }); + WriteCommandAction.runWriteCommandAction(null, () -> myFixture.type("\n(")); myFixture.checkResultByFile(testName + "_after.py"); } diff --git a/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java b/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java index f0b41b38afba..fe5d5bb52967 100644 --- a/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java +++ b/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java @@ -94,9 +94,7 @@ public abstract class PyMultiFileResolveTestCase extends PyResolveTestCase { final PsiFile psiFile = prepareFile(); final PsiReference ref = PyResolveTestCase.findReferenceByMarker(psiFile); if (ref instanceof PsiPolyVariantReference) { - return ContainerUtil.map(((PsiPolyVariantReference)ref).multiResolve(false), result -> { - return result.getElement(); - }); + return ContainerUtil.map(((PsiPolyVariantReference)ref).multiResolve(false), result -> result.getElement()); } return Collections.singletonList(ref.resolve()); } diff --git a/python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java b/python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java index cc70fbf9c954..fc80f8cbfbf5 100644 --- a/python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java +++ b/python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java @@ -107,9 +107,7 @@ public abstract class PyTestCase extends UsefulTestCase { * Reformats currently configured file. */ protected final void reformatFile() { - WriteCommandAction.runWriteCommandAction(null, () -> { - doPerformFormatting(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> doPerformFormatting()); } private void doPerformFormatting() throws IncorrectOperationException { diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java index f76e6dc510c8..c1282b125338 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java @@ -151,9 +151,7 @@ public class PyInlineLocalTest extends PyTestCase { private void checkOperatorPrecedence(@NotNull final String firstLine, @NotNull String resultPrefix) throws Exception { myFixture.configureByFile("/refactoring/inlinelocal/operatorPrecedence/template.py"); - WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> { - myFixture.getEditor().getDocument().insertString(0, firstLine + "\n"); - }); + WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> myFixture.getEditor().getDocument().insertString(0, firstLine + "\n")); performRefactoring(null); myFixture.checkResultByFile("/refactoring/inlinelocal/operatorPrecedence/" + resultPrefix + ".after.py"); FileDocumentManager.getInstance().reloadFromDisk(myFixture.getDocument(myFixture.getFile())); diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java index 4758b43b0599..73d36e376dce 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java @@ -87,9 +87,7 @@ public class PyMoveTest extends PyTestCase { public void testCollectMovableModuleMembers() { myFixture.configureByFile("/refactoring/move/" + getTestName(true) + ".py"); final List members = PyMoveModuleMembersHelper.getTopLevelModuleMembers((PyFile)myFixture.getFile()); - final List names = ContainerUtil.map(members, element -> { - return element.getName(); - }); + final List names = ContainerUtil.map(members, element -> element.getName()); assertSameElements(names, "CONST", "C", "outer_func"); } diff --git a/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java b/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java index 0da1e6fb692f..3f68481677ce 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java @@ -238,9 +238,7 @@ public class PyChangeSignatureTest extends PyTestCase { assertNotNull(function); final List expected = Arrays.asList("a", "b", "*args", "c", "d", "**kwargs"); final List parameters = new PyMethodDescriptor(function).getParameters(); - assertEquals(expected, ContainerUtil.map(parameters, info -> { - return info.getOldName(); - })); + assertEquals(expected, ContainerUtil.map(parameters, info -> info.getOldName())); }); } diff --git a/python/testSrc/com/jetbrains/python/refactoring/classes/PyClassRefactoringTest.java b/python/testSrc/com/jetbrains/python/refactoring/classes/PyClassRefactoringTest.java index 62ae52488342..35c7babd77c3 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/classes/PyClassRefactoringTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/classes/PyClassRefactoringTest.java @@ -108,9 +108,7 @@ public abstract class PyClassRefactoringTest extends PyTestCase { protected void moveViaProcessor(@NotNull Project project, @NotNull final BaseRefactoringProcessor processor) { - CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { - processor.run(); - }), null, null); + CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> processor.run()), null, null); } /** diff --git a/python/testSrc/com/jetbrains/python/sdkTools/PyTestSdkTools.java b/python/testSrc/com/jetbrains/python/sdkTools/PyTestSdkTools.java index db9559f73660..74bf5e4bb95e 100644 --- a/python/testSrc/com/jetbrains/python/sdkTools/PyTestSdkTools.java +++ b/python/testSrc/com/jetbrains/python/sdkTools/PyTestSdkTools.java @@ -93,9 +93,7 @@ public final class PyTestSdkTools { // Associate with module ModuleRootModificationUtil.setModuleSdk(module, sdk); - UsefulTestCase.edt(() -> ApplicationManager.getApplication().runWriteAction(() -> { - ProjectRootManager.getInstance(finalProject).setProjectSdk(sdk); - })); + UsefulTestCase.edt(() -> ApplicationManager.getApplication().runWriteAction(() -> ProjectRootManager.getInstance(finalProject).setProjectSdk(sdk))); } diff --git a/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java b/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java index b9f3553a603b..c6fa374b47f0 100644 --- a/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java +++ b/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java @@ -128,16 +128,14 @@ public final class SpellingPopupActionGroup extends ActionGroup { final Project project = e.getData(LangDataKeys.PROJECT); final Editor editor = e.getData(LangDataKeys.EDITOR); if (psiFile != null && project != null && editor != null) { - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(project, () -> { - try { - intention.invoke(project, editor, psiFile); - } - catch (IncorrectOperationException ex) { - LOGGER.error(ex); - } - }, e.getPresentation().getText(), e.getActionManager().getId(SpellCheckerIntentionAction.this)); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { + try { + intention.invoke(project, editor, psiFile); + } + catch (IncorrectOperationException ex) { + LOGGER.error(ex); + } + }, e.getPresentation().getText(), e.getActionManager().getId(SpellCheckerIntentionAction.this))); } } } diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java index c3f461122cc5..f1ebdea7e8ed 100644 --- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java +++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java @@ -67,9 +67,7 @@ public abstract class NavigationGutterIconRenderer extends GutterIconRenderer } public List getTargetElements() { - return ContainerUtil.mapNotNull(myPointers.getValue(), (NullableFunction)smartPsiElementPointer -> { - return smartPsiElementPointer.getElement(); - }); + return ContainerUtil.mapNotNull(myPointers.getValue(), (NullableFunction)smartPsiElementPointer -> smartPsiElementPointer.getElement()); } public boolean equals(final Object o) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java index f05467113d6d..2ebe3e0055fd 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java @@ -42,10 +42,8 @@ public class DomElementsHighlightingUtil { @Nullable public static ProblemDescriptor createProblemDescriptors(final InspectionManager manager, final DomElementProblemDescriptor problemDescriptor) { final ProblemHighlightType type = getProblemHighlightType(problemDescriptor); - return createProblemDescriptors(problemDescriptor, s -> { - return manager - .createProblemDescriptor(s.second, s.first, problemDescriptor.getDescriptionTemplate(), type, true, problemDescriptor.getFixes()); - }); + return createProblemDescriptors(problemDescriptor, s -> manager + .createProblemDescriptor(s.second, s.first, problemDescriptor.getDescriptionTemplate(), type, true, problemDescriptor.getFixes())); } // TODO: move it to DomElementProblemDescriptorImpl diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java index 30b7b99d2687..bd5fb121d534 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java @@ -834,9 +834,7 @@ public abstract class DomInvocationHandler stubs = myStub.getChildrenByName(xmlName.getLocalName(), xmlName.getNamespaceKey()); - return ContainerUtil.map(stubs, stub -> { - return stub.getOrCreateHandler((DomChildDescriptionImpl)description, myManager).getProxy(); - }); + return ContainerUtil.map(stubs, stub -> stub.getOrCreateHandler((DomChildDescriptionImpl)description, myManager).getProxy()); } else if (description instanceof CustomDomChildrenDescriptionImpl) { List stubs = myStub.getChildrenStubs(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java index 2712dc9a4dff..8233bba5271c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java @@ -130,9 +130,7 @@ public class DynamicGenericInfo extends DomGenericInfoEx { } final List customs = registrar.getCustoms(); - myCustomChildren = customs.isEmpty() ? null : ContainerUtil.map(customs, extension -> { - return new CustomDomChildrenDescriptionImpl(extension); - }); + myCustomChildren = customs.isEmpty() ? null : ContainerUtil.map(customs, extension -> new CustomDomChildrenDescriptionImpl(extension)); } private static ChildrenDescriptionsHolder internChildrenHolder(XmlFile file, ChildrenDescriptionsHolder holder) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java index ffde2c300cff..a409c25fca81 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java @@ -84,9 +84,7 @@ public class DomModelImpl implements DomModel { @NotNull public List> getRoots() { if (myMergedModel == null) { - return ContainerUtil.mapNotNull(myConfigFiles, (NullableFunction>)xmlFile -> { - return DomManager.getDomManager(xmlFile.getProject()).getFileElement(xmlFile, myClass); - }); + return ContainerUtil.mapNotNull(myConfigFiles, (NullableFunction>)xmlFile -> DomManager.getDomManager(xmlFile.getProject()).getFileElement(xmlFile, myClass)); } return myMergedModel instanceof MergedObject ? ((MergedObject) myMergedModel).getImplementations() : Collections.singletonList(myMergedModel); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java index d130b959dbb5..f3bca20d54be 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java @@ -99,9 +99,7 @@ public class ComboControl extends BaseModifiableControl { final ResolvingConverter resolvingConverter = (ResolvingConverter)converter; final Collection variants = resolvingConverter.getVariants(context); final List> all = - new ArrayList>(ContainerUtil.map(variants, s -> { - return Pair.create(ElementPresentationManager.getElementName(s), ElementPresentationManager.getIcon(s)); - })); + new ArrayList>(ContainerUtil.map(variants, s -> Pair.create(ElementPresentationManager.getElementName(s), ElementPresentationManager.getIcon(s)))); all.addAll(ContainerUtil.map(resolvingConverter.getAdditionalVariants(context), new Function() { @Override public Object fun(final Object s) { diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java index 7b5144d0ab46..87cb32dbfa48 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java @@ -406,9 +406,7 @@ public class DomChildrenTest extends DomTestCase { public void testChildrenValidAfterUndefine() throws Throwable { final MyElement element = createElement(""); final MyElement child = element.getChild(); - ApplicationManager.getApplication().runWriteAction(() -> { - element.undefine(); - }); + ApplicationManager.getApplication().runWriteAction(() -> element.undefine()); assertTrue(element.isValid()); assertFalse(child.isValid()); @@ -490,9 +488,7 @@ public class DomChildrenTest extends DomTestCase { } private List getFixedPath(final DomElement element) { - return ContainerUtil.map2List(DomUtil.getFixedPath(element), s -> { - return s.getName(); - }); + return ContainerUtil.map2List(DomUtil.getFixedPath(element), s -> s.getName()); } public void testElementsWithoutXmlGetItLater() throws Throwable { diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java index d49c52220a5f..f11878ee5ecb 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java @@ -122,9 +122,7 @@ public class IncrementalUpdateEventsTest extends DomTestCase { private void deleteTag(final int index) { - WriteCommandAction.runWriteCommandAction(null, () -> { - myElement.getXmlTag().getSubTags()[index].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> myElement.getXmlTag().getSubTags()[index].delete()); } private MyElement createElement(final String xml) { diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java index da3036bbb12b..cfc0427e6c58 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java @@ -373,9 +373,7 @@ public class TreeIncrementalUpdateTest extends DomTestCase { final XmlTag tag = element.getXmlTag(); final XmlTag childTag = tag.getSubTags()[0]; - WriteCommandAction.runWriteCommandAction(null, () -> { - childTag.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> childTag.delete()); putExpected(new DomEvent(element, false)); assertResultsAndClear(); diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java index 28dacbd4c2e9..c22e9f0634e1 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java @@ -369,12 +369,10 @@ public class FetchExtResourceAction extends BaseExtResourceAction implements Wat result.contentType != null && result.contentType.contains(HTML_MIME) && new String(result.bytes).contains(" { - Messages.showMessageDialog(project, - XmlBundle.message("invalid.url.no.xml.file.at.location", resourceUrl), - XmlBundle.message("invalid.url.title"), - Messages.getErrorIcon()); - }, indicator.getModalityState()); + ApplicationManager.getApplication().invokeLater(() -> Messages.showMessageDialog(project, + XmlBundle.message("invalid.url.no.xml.file.at.location", resourceUrl), + XmlBundle.message("invalid.url.title"), + Messages.getErrorIcon()), indicator.getModalityState()); return false; } return true; @@ -494,12 +492,10 @@ public class FetchExtResourceAction extends BaseExtResourceAction implements Wat } catch (MalformedURLException e) { if (!ApplicationManager.getApplication().isUnitTestMode()) { - ApplicationManager.getApplication().invokeLater(() -> { - Messages.showMessageDialog(project, - XmlBundle.message("invalid.url.message", dtdUrl), - XmlBundle.message("invalid.url.title"), - Messages.getErrorIcon()); - }, indicator.getModalityState()); + ApplicationManager.getApplication().invokeLater(() -> Messages.showMessageDialog(project, + XmlBundle.message("invalid.url.message", dtdUrl), + XmlBundle.message("invalid.url.title"), + Messages.getErrorIcon()), indicator.getModalityState()); } } diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IgnoreExtResourceAction.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IgnoreExtResourceAction.java index 6fe2d2e799d6..88d3df92e855 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IgnoreExtResourceAction.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IgnoreExtResourceAction.java @@ -33,8 +33,6 @@ public class IgnoreExtResourceAction extends BaseExtResourceAction { @Override protected void doInvoke(@NotNull final PsiFile file, final int offset, @NotNull final String uri, final Editor editor) throws IncorrectOperationException { - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManagerEx.getInstanceEx().addIgnoredResource(uri); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManagerEx.getInstanceEx().addIgnoredResource(uri)); } } diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java index 60c12ddd28b3..bd9563d404a6 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java @@ -110,9 +110,7 @@ public class EmmetPreviewUtil { if (vFile != null) { vFile.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE); } - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().runUndoTransparentAction(() -> CodeStyleManager.getInstance(file.getProject()).reformat(copy)); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().runUndoTransparentAction(() -> CodeStyleManager.getInstance(file.getProject()).reformat(copy))); return copy.getText(); } diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java index afee4d44836f..886f84e70f00 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java @@ -316,32 +316,30 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase { public static void doWrap(@NotNull final String abbreviation, @NotNull final CustomTemplateCallback callback) { final ZenCodingGenerator defaultGenerator = findApplicableDefaultGenerator(callback.getContext(), true); assert defaultGenerator != null; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(callback.getProject(), () -> callback.getEditor().getCaretModel().runForEachCaret(new CaretAction() { - @Override - public void perform(Caret caret) { - String selectedText = callback.getEditor().getSelectionModel().getSelectedText(); - if (selectedText != null) { - String selection = selectedText.trim(); - ZenCodingNode node = parse(abbreviation, callback, defaultGenerator, selection); - assert node != null; - PsiElement context = callback.getContext(); - ZenCodingGenerator generator = findApplicableGenerator(node, context, true); - List filters = getFilters(node, context); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(callback.getProject(), () -> callback.getEditor().getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + String selectedText = callback.getEditor().getSelectionModel().getSelectedText(); + if (selectedText != null) { + String selection = selectedText.trim(); + ZenCodingNode node = parse(abbreviation, callback, defaultGenerator, selection); + assert node != null; + PsiElement context = callback.getContext(); + ZenCodingGenerator generator = findApplicableGenerator(node, context, true); + List filters = getFilters(node, context); - EditorModificationUtil.deleteSelectedText(callback.getEditor()); - PsiDocumentManager.getInstance(callback.getProject()).commitAllDocuments(); + EditorModificationUtil.deleteSelectedText(callback.getEditor()); + PsiDocumentManager.getInstance(callback.getProject()).commitAllDocuments(); - try { - expand(node, generator, filters, selection, callback, true, Registry.intValue("emmet.segments.limit")); - } - catch (EmmetException e) { - CommonRefactoringUtil.showErrorHint(callback.getProject(), callback.getEditor(), e.getMessage(), "Emmet error", ""); - } + try { + expand(node, generator, filters, selection, callback, true, Registry.intValue("emmet.segments.limit")); + } + catch (EmmetException e) { + CommonRefactoringUtil.showErrorHint(callback.getProject(), callback.getEditor(), e.getMessage(), "Emmet error", ""); } } - }), CodeInsightBundle.message("insert.code.template.command"), null); - }); + } + }), CodeInsightBundle.message("insert.code.template.command"), null)); } @Override diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java index 37e14608ebdf..74d8fd92ed64 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java @@ -70,9 +70,7 @@ public class BemEmmetFilter extends ZenCodingFilter { String modifierSeparator = emmetOptions.getBemModifierSeparator(); String shortElementPrefix = emmetOptions.getBemShortElementPrefix(); - List classNames = ContainerUtil.map(HtmlUtil.splitClassNames(classValue), (s) -> { - return normalizeClassName(s, elementSeparator, shortElementPrefix); - }); + List classNames = ContainerUtil.map(HtmlUtil.splitClassNames(classValue), (s) -> normalizeClassName(s, elementSeparator, shortElementPrefix)); BEM_STATE.set(node, new BemState(suggestBlockName(classNames), null, null)); Set newClassNames = ContainerUtil.newLinkedHashSet(); diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/TrimZenCodingFilter.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/TrimZenCodingFilter.java index 0bb4dd1e07e3..cd6497d8608a 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/TrimZenCodingFilter.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/TrimZenCodingFilter.java @@ -66,9 +66,7 @@ public class TrimZenCodingFilter extends ZenCodingFilter { final XmlTagValue tagValue = tag.getValue(); final Matcher matcher = PATTERN.matcher(tagValue.getText()); if (matcher.matches()) { - ApplicationManager.getApplication().runWriteAction(() -> { - tagValue.setText(matcher.replaceAll("")); - }); + ApplicationManager.getApplication().runWriteAction(() -> tagValue.setText(matcher.replaceAll(""))); } } tag.acceptChildren(this); diff --git a/xml/impl/src/com/intellij/javaee/EditLocationDialog.java b/xml/impl/src/com/intellij/javaee/EditLocationDialog.java index 3cbecefdfa46..a2fa41623e33 100644 --- a/xml/impl/src/com/intellij/javaee/EditLocationDialog.java +++ b/xml/impl/src/com/intellij/javaee/EditLocationDialog.java @@ -98,9 +98,7 @@ public class EditLocationDialog extends DialogWrapper { @Override public void actionPerformed(ActionEvent ignored) { FileChooserDescriptor descriptor = getChooserDescriptor(); - FileChooser.chooseFile(descriptor, myProject, null, file -> { - myTfPath.setText(file.getPath().replace('/', File.separatorChar)); - }); + FileChooser.chooseFile(descriptor, myProject, null, file -> myTfPath.setText(file.getPath().replace('/', File.separatorChar))); } }); } diff --git a/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java b/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java index 1ba5a3ed442d..16364e624a98 100644 --- a/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java +++ b/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java @@ -130,9 +130,7 @@ public class EscapeEntitiesAction extends BaseCodeInsightAction implements CodeI String oldText = document.getText(new TextRange(start, end)); final String newText = escape((XmlFile)file, oldText, start); if (!oldText.equals(newText)) { - ApplicationManager.getApplication().runWriteAction(() -> { - document.replaceString(start, end, newText); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.replaceString(start, end, newText)); } } } diff --git a/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java b/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java index 10f13fde122c..1cce4b40d6c4 100644 --- a/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java +++ b/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java @@ -54,9 +54,7 @@ public class StdErrorReporter extends ErrorReporter { public void startProcessing() { final Runnable task = () -> { try { - ApplicationManager.getApplication().runReadAction(() -> { - StdErrorReporter.super.startProcessing(); - }); + ApplicationManager.getApplication().runReadAction(() -> StdErrorReporter.super.startProcessing()); SwingUtilities.invokeLater( () -> { diff --git a/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java b/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java index bc69a9a73862..3bada7489489 100644 --- a/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java +++ b/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java @@ -65,9 +65,7 @@ public class XmlEnumeratedValueReferenceProvider extends P } else if (unquotedValue.equals(enumerationDescriptor.getDefaultValue())) { // todo case insensitive return ContainerUtil.map2Array(enumerationDescriptor.getValueReferences((XmlElement)element, unquotedValue), PsiReference.class, - reference -> { - return PsiDelegateReference.createSoft(reference, true); - }); + reference -> PsiDelegateReference.createSoft(reference, true)); } } return PsiReference.EMPTY_ARRAY; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java index 9a3eed91e35f..dd2fbdb9d10c 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java @@ -101,9 +101,7 @@ public class RncCompletionData extends CompletionData { @Override public Object[] get(PsiElement context, CompletionContext completionContext) { - return ContainerUtil.map2Array(doGetKeywords(context), LookupElement.class, (Function)s -> { - return TailTypeDecorator.withTail(LookupElementBuilder.create(s).bold(), TailType.SPACE); - }); + return ContainerUtil.map2Array(doGetKeywords(context), LookupElement.class, (Function)s -> TailTypeDecorator.withTail(LookupElementBuilder.create(s).bold(), TailType.SPACE)); } private String[] doGetKeywords(PsiElement context) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java index 4caceeac3c54..019f38fa5021 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java @@ -151,9 +151,7 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { } public Collection getDeclarations() { - return ContainerUtil.map2List(myDeclarations, locator -> { - return myElementDescriptor.getDeclaration(locator); - }); + return ContainerUtil.map2List(myDeclarations, locator -> myElementDescriptor.getDeclaration(locator)); } @Override diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java index 5be2ea90fc30..8d1fb2ba61aa 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java @@ -62,9 +62,7 @@ public class RelaxIncludeIndex { private static boolean processRelatedFiles(PsiFile file, VirtualFile[] files, PsiElementProcessor processor) { Project project = file.getProject(); final PsiManager psiManager = PsiManager.getInstance(project); - final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, (NullableFunction)file1 -> { - return psiManager.findFile(file1); - }); + final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, (NullableFunction)file1 -> psiManager.findFile(file1)); for (final PsiFile psiFile : psiFiles) { if (!processFile(psiFile, processor)) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/FileReferenceUtil.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/FileReferenceUtil.java index ffa0e9323830..98fb75c8962a 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/FileReferenceUtil.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/FileReferenceUtil.java @@ -43,9 +43,7 @@ public class FileReferenceUtil { public static PsiReference[] restrict(FileReferenceSet set, final Condition cond, final Boolean soft) { final FileReference[] references = set.getAllReferences(); - return ContainerUtil.map2Array(references, PsiReference.class, (NotNullFunction)fileReference -> { - return new MyFileReference(fileReference, cond, soft); - }); + return ContainerUtil.map2Array(references, PsiReference.class, (NotNullFunction)fileReference -> new MyFileReference(fileReference, cond, soft)); } public static Condition byType(FileType instance) { diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java index d7f8e672630b..6415f1d9ca40 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java @@ -122,9 +122,7 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide public abstract String getTestDataPath(); protected void init() { - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("urn:test:undefined"); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("urn:test:undefined")); } @Override diff --git a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java index f05c2d3df339..f9b255862dc8 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java @@ -69,9 +69,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase { final Listener listener = addPomListener(); final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlText xmlText = tagFromText.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, () -> { - xmlText.insertText("bb", 2); - }); + WriteCommandAction.runWriteCommandAction(null, () -> xmlText.insertText("bb", 2)); assertEquals("(text changed to 'aabba' was: 'aaa')\n", listener.getEventString()); } @@ -115,9 +113,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase { public void test5() throws Exception{ final Listener listener = addPomListener(); final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); - WriteCommandAction.runWriteCommandAction(null, () -> { - tagFromText.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> tagFromText.delete()); assertEquals("(Xml document changed)\n", listener.getEventString()); } @@ -170,9 +166,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(text); final XmlAttribute attribute = tag.getAttribute("name", null); assert attribute != null; - WriteCommandAction.runWriteCommandAction(null, () -> { - attribute.setValue("new"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> attribute.setValue("new")); assertEquals(attribute.getValue(), "new"); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlReparseTest.java b/xml/tests/src/com/intellij/codeInsight/XmlReparseTest.java index 92b47923bba7..588399a6e0ea 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlReparseTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlReparseTest.java @@ -171,9 +171,7 @@ public class XmlReparseTest extends AbstractReparseTestCase { private static void removeGarbage(Document document) { int i = document.getText().indexOf(marker); if (i==-1) return; - ApplicationManager.getApplication().runWriteAction(() -> { - document.replaceString(i, i + marker.length(), ""); - }); + ApplicationManager.getApplication().runWriteAction(() -> document.replaceString(i, i + marker.length(), "")); removeGarbage(document); } diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java b/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java index 5115d70dc5c3..74bbf2d6e16a 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java @@ -97,9 +97,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testDeleteTag() throws Throwable { XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText(" "); final XmlTag bTag = aTag.findFirstSubTag("b"); - WriteCommandAction.runWriteCommandAction(null, () -> { - bTag.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> bTag.delete()); assertEquals(0, aTag.getSubTags().length); } @@ -126,9 +124,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { } public void testWhitespaceInsideTag() throws Exception { - WriteCommandAction.runWriteCommandAction(null, () -> { - XmlElementFactory.getInstance(getProject()).createTagFromText("

").getValue().setText("\n"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> XmlElementFactory.getInstance(getProject()).createTagFromText("

").getValue().setText("\n")); } public void testSetAttribute_ForXhtml() throws Exception { @@ -214,18 +210,14 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit1() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, () -> { - xmlText.removeText(0, 3); - }); + WriteCommandAction.runWriteCommandAction(null, () -> xmlText.removeText(0, 3)); assertEquals("", rootTag.getText()); } public void testTextEdit2() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("a<a"); - WriteCommandAction.runWriteCommandAction(null, () -> { - rootTag.getValue().getTextElements()[0].removeText(0, 3); - }); + WriteCommandAction.runWriteCommandAction(null, () -> rootTag.getValue().getTextElements()[0].removeText(0, 3)); assertEquals("", rootTag.getText()); } @@ -233,9 +225,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit3() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("a<a"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, () -> { - xmlText.removeText(1, 2); - }); + WriteCommandAction.runWriteCommandAction(null, () -> xmlText.removeText(1, 2)); assertEquals(1, xmlText.getChildren().length); assertEquals("aa", rootTag.getText()); @@ -244,9 +234,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit4() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, () -> { - xmlText.removeText(1, 2); - }); + WriteCommandAction.runWriteCommandAction(null, () -> xmlText.removeText(1, 2)); assertEquals(1, xmlText.getChildren().length); assertEquals("aa", rootTag.getText()); @@ -278,18 +266,14 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit6() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("a1c"); final XmlTag xmlTag = rootTag.findFirstSubTag("b"); - WriteCommandAction.runWriteCommandAction(null, () -> { - xmlTag.delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> xmlTag.delete()); assertEquals("ac", rootTag.getText()); } public void testBrace() throws Exception { final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText(""); - WriteCommandAction.runWriteCommandAction(null, () -> { - tagFromText.getValue().setText("<"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> tagFromText.getValue().setText("<")); assertEquals("<", tagFromText.getValue().getTextElements()[0].getValue()); } @@ -327,46 +311,42 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlTag root = file.getDocument().getRootTag(); final XmlTag tag = root.findFirstSubTag("b"); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - final int offset = tag.getTextOffset(); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + final int offset = tag.getTextOffset(); - Document document = PsiDocumentManager.getInstance(getProject()).getDocument(root.getContainingFile()); - RangeMarker marker = document.createRangeMarker(offset - 3, offset); - tag.delete(); + Document document = PsiDocumentManager.getInstance(getProject()).getDocument(root.getContainingFile()); + RangeMarker marker = document.createRangeMarker(offset - 3, offset); + tag.delete(); - assertEquals(4, marker.getStartOffset()); - assertEquals(7, marker.getEndOffset()); - }, "", null); - }); + assertEquals(4, marker.getStartOffset()); + assertEquals(7, marker.getEndOffset()); + }, "", null)); } // this one fails, the difference is that we do some manipulations before: move "234" before the tag public void testRangeMarker2() throws IOException, IncorrectOperationException { final XmlTag root = createTag("file.xhtml", "1234567"); final XmlTag tag = root.findFirstSubTag("b"); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - Document document = PsiDocumentManager.getInstance(getProject()).getDocument(root.getContainingFile()); - XmlTagChild child = tag.getValue().getChildren()[0]; - assertTrue(child instanceof XmlText && child.getText().equals("234")); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + Document document = PsiDocumentManager.getInstance(getProject()).getDocument(root.getContainingFile()); + XmlTagChild child = tag.getValue().getChildren()[0]; + assertTrue(child instanceof XmlText && child.getText().equals("234")); - try { - tag.getParent().addBefore(child, tag); + try { + tag.getParent().addBefore(child, tag); - assertEquals(7, tag.getTextOffset()); - RangeMarker marker = document.createRangeMarker(4, 7); - tag.delete(); + assertEquals(7, tag.getTextOffset()); + RangeMarker marker = document.createRangeMarker(4, 7); + tag.delete(); - assertEquals(4, marker.getStartOffset()); - assertEquals(7, marker.getEndOffset()); + assertEquals(4, marker.getStartOffset()); + assertEquals(7, marker.getEndOffset()); - } - catch (IncorrectOperationException e) { - } - }, "", null); - }); + } + catch (IncorrectOperationException e) { + } + }, "", null)); } // the previous test relveals one problem with text merge, "234" in fact is not merged with "1" @@ -460,9 +440,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.xml", "\n \n"); final XmlTag tagB = file.getDocument().getRootTag(); - ApplicationManager.getApplication().runWriteAction(() -> { - tagB.getSubTags()[0].delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> tagB.getSubTags()[0].delete()); assertEquals("\n ", tagB.getText()); } @@ -471,9 +449,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()) .createFileFromText("test.xml", "\n \n \n hasgdgasjdgasdg asgdjhasgd\n \n"); final XmlTag tagB = file.getDocument().getRootTag(); - WriteCommandAction.runWriteCommandAction(null, () -> { - tagB.getSubTags()[0].getSubTags()[0].delete(); - }); + WriteCommandAction.runWriteCommandAction(null, () -> tagB.getSubTags()[0].getSubTags()[0].delete()); assertEquals("\n \n \n", tagB.getText()); } @@ -485,14 +461,12 @@ public class XmlTagTest extends LightCodeInsightTestCase { RangeMarker rangeMarker = document.createRangeMarker(5, 5); final XmlText text = (XmlText) tag.getValue().getChildren()[0]; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - try{ - text.removeText(2, 3); - } - catch(IncorrectOperationException ioe){} - }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + try{ + text.removeText(2, 3); + } + catch(IncorrectOperationException ioe){} + }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); assertEquals(5, rangeMarker.getStartOffset()); assertEquals(5, rangeMarker.getEndOffset()); @@ -500,9 +474,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testXHTMLTextInsert() throws Exception { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("xyz"); - ApplicationManager.getApplication().runWriteAction(() -> { - tag.getValue().getTextElements()[0].insertText("<", 1); - }); + ApplicationManager.getApplication().runWriteAction(() -> tag.getValue().getTextElements()[0].insertText("<", 1)); assertEquals("x<yz", tag.getText()); } @@ -667,9 +639,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testWhitespacesInEmptyXHTMLTag() throws Exception{ final XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText(" "); - ApplicationManager.getApplication().runWriteAction(() -> { - tag.findFirstSubTag("b").delete(); - }); + ApplicationManager.getApplication().runWriteAction(() -> tag.findFirstSubTag("b").delete()); assertEquals(" ", tag.getText()); } @@ -679,16 +649,14 @@ public class XmlTagTest extends LightCodeInsightTestCase { XmlTag tag = file.getDocument().getRootTag(); final XmlText xmlText = tag.getValue().getTextElements()[0]; - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - try { - xmlText.insertText("z", 1); - } - catch (IncorrectOperationException e) { - throw new RuntimeException(e); - } - }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION); - }); + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + try { + xmlText.insertText("z", 1); + } + catch (IncorrectOperationException e) { + throw new RuntimeException(e); + } + }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); assertEquals("xz y", tag.getText()); } @@ -790,9 +758,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { } public void testStrangeCharactesInText() throws Throwable { - ApplicationManager.getApplication().runWriteAction(() -> { - XmlElementFactory.getInstance(getProject()).createTagFromText("").getValue().setText("@#$%@$%$${${''}"); - }); + ApplicationManager.getApplication().runWriteAction(() -> XmlElementFactory.getInstance(getProject()).createTagFromText("").getValue().setText("@#$%@$%$${${''}")); } public void testPsiToDocumentSynchronizationFailed() throws Throwable { @@ -801,26 +767,24 @@ public class XmlTagTest extends LightCodeInsightTestCase { tempFile.createNewFile(); FileUtil.writeToFile(tempFile, text); - ApplicationManager.getApplication().runWriteAction(() -> { - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - VirtualFileManager.getInstance().syncRefresh(); - XmlFile file ;//createTemporaryFile("wpd.xml", text)); - try { - file = (XmlFile)getPsiManager().findFile(VfsUtil.findFileByURL(tempFile.toURL())); - } - catch (MalformedURLException e) { - throw new RuntimeException(e); - } + ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { + VirtualFileManager.getInstance().syncRefresh(); + XmlFile file ;//createTemporaryFile("wpd.xml", text)); + try { + file = (XmlFile)getPsiManager().findFile(VfsUtil.findFileByURL(tempFile.toURL())); + } + catch (MalformedURLException e) { + throw new RuntimeException(e); + } - final XmlTag methodTag = file.getDocument().getRootTag().findFirstSubTag("methods"); - try { - methodTag.add(XmlElementFactory.getInstance(getProject()).createTagFromText("")); - } - catch (IncorrectOperationException e) { - throw new RuntimeException(e); - } - }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION); - }); + final XmlTag methodTag = file.getDocument().getRootTag().findFirstSubTag("methods"); + try { + methodTag.add(XmlElementFactory.getInstance(getProject()).createTagFromText("")); + } + catch (IncorrectOperationException e) { + throw new RuntimeException(e); + } + }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); } public void testXmlFormattingException() throws Throwable { diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java b/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java index aefcd7382640..8e2ec91c0017 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java @@ -61,9 +61,7 @@ public class XmlTagWriteTest extends LightCodeInsightTestCase{ final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("\n0123456"); final XmlText text = (XmlText) tag.getValue().getChildren()[0]; String textS = text.getText(); - ApplicationManager.getApplication().runWriteAction(() -> { - text.insertText("lala", 2); - }); + ApplicationManager.getApplication().runWriteAction(() -> text.insertText("lala", 2)); XmlText text2 = (XmlText)tag.getValue().getChildren()[0]; assertEquals(textS.substring(0, 2) + "lala" + textS.substring(2), text2.getText()); diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java index 88096e2338d3..1c4a7368e622 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java @@ -45,11 +45,7 @@ public abstract class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTest protected void type(String toType) { for (int i = 0; i < toType.length(); i++) { final char c = toType.charAt(i); - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - ApplicationManager.getApplication().runWriteAction(() -> { - myFixture.type(c); - }); - }, "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument()); + CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> myFixture.type(c)), "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument()); } } @@ -62,12 +58,10 @@ public abstract class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTest final String toType, final String result) { myFixture.configureByText(fileType, text); - CommandProcessor.getInstance().executeCommand(getProject(), () -> { - ApplicationManager.getApplication().runWriteAction(() -> { - myFixture.completeBasic(); - if (toType != null) myFixture.type(toType); - }); - }, "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument()); + CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { + myFixture.completeBasic(); + if (toType != null) myFixture.type(toType); + }), "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument()); myFixture.checkResult(result); } } diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java index c5ac3a6516f4..820d29d64331 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java @@ -398,9 +398,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { try { doDoTest(true,true); - WriteCommandAction.runWriteCommandAction(null, () -> { - myEditor.getDocument().insertString(myEditor.getDocument().getCharsSequence().toString().indexOf("?>") + 2, "\n"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> myEditor.getDocument().insertString(myEditor.getDocument().getCharsSequence().toString().indexOf("?>") + 2, "\n")); doDoTest(true,true); } @@ -580,15 +578,11 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { public void testExternalValidatorOnValidXmlWithNamespacesNotSetup2() throws Exception { final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx(); try { - WriteCommandAction.runWriteCommandAction(null, () -> { - instanceEx.addIgnoredResource(""); - }); + WriteCommandAction.runWriteCommandAction(null, () -> instanceEx.addIgnoredResource("")); doTest(getFullRelativeTestName(".xml"), true, false); } finally { - WriteCommandAction.runWriteCommandAction(null, () -> { - instanceEx.removeIgnoredResource(""); - }); + WriteCommandAction.runWriteCommandAction(null, () -> instanceEx.removeIgnoredResource("")); } } @@ -1058,14 +1052,10 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { } public void testIgnoredNamespaceHighlighting() throws Exception { - WriteCommandAction.runWriteCommandAction(null, () -> { - ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("http://ignored/uri"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("http://ignored/uri")); doTest(); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManagerEx.getInstanceEx().removeIgnoredResource("http://ignored/uri"); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManagerEx.getInstanceEx().removeIgnoredResource("http://ignored/uri")); } public void testNonEnumeratedValuesHighlighting() throws Exception { @@ -1230,9 +1220,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { doDoTest(true, false); final String text = myEditor.getDocument().getText(); - WriteCommandAction.runWriteCommandAction(null, () -> { - myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength()); - }); + WriteCommandAction.runWriteCommandAction(null, () -> myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength())); AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_COMMENT_BLOCK); action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext())); @@ -1399,9 +1387,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { final Editor schemaEditor = allEditors[0] == myEditor ? allEditors[1]:allEditors[0]; final String text = schemaEditor.getDocument().getText(); final String newText = text.replaceAll("xsd", "xs"); - WriteCommandAction.runWriteCommandAction(null, () -> { - schemaEditor.getDocument().replaceString(0, text.length(), newText); - }); + WriteCommandAction.runWriteCommandAction(null, () -> schemaEditor.getDocument().replaceString(0, text.length(), newText)); doDoTest(true, false); } @@ -1566,17 +1552,13 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { Collection infos = filterInfos(doHighlighting()); assertEquals(2, infos.size()); - WriteCommandAction.runWriteCommandAction(null, () -> { - EditorModificationUtil.deleteSelectedText(myEditor); - }); + WriteCommandAction.runWriteCommandAction(null, () -> EditorModificationUtil.deleteSelectedText(myEditor)); infos = filterInfos(doHighlighting()); assertEquals(11, infos.size()); - WriteCommandAction.runWriteCommandAction(null, () -> { - EditorModificationUtil.insertStringAtCaret(myEditor, "<"); - }); + WriteCommandAction.runWriteCommandAction(null, () -> EditorModificationUtil.insertStringAtCaret(myEditor, "<")); new CodeCompletionHandlerBase(CompletionType.BASIC).invokeCompletion(myProject, myEditor); infos = filterInfos(doHighlighting()); @@ -1642,9 +1624,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { BASE_PATH +testName +"-inc.xml", BASE_PATH +testName +"TestSchema.xsd" ); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("oxf:/apps/somefile.xml"); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("oxf:/apps/somefile.xml")); doDoTest(true, false, true); diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/RealFetchTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/RealFetchTest.java index 9bce852ad9dc..4af8a8a799ea 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/RealFetchTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/RealFetchTest.java @@ -40,18 +40,14 @@ public class RealFetchTest extends LightPlatformCodeInsightFixtureTestCase { assertNotNull(intention); intention.invoke(getProject(), myFixture.getEditor(), myFixture.getFile()); assertNotSame(url, ExternalResourceManager.getInstance().getResourceLocation(url, getProject())); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().removeResource(url); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().removeResource(url)); } public void testOverwriteFetchDtd() throws Exception { final String url = "http://helpserver.labs.intellij.net/help/images.dtd"; VirtualFile virtualFile = myFixture.getTempDirFixture().createFile("images.dtd", ""); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().addResource(url, virtualFile.getPath()); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource(url, virtualFile.getPath())); myFixture.configureByText(XmlFileType.INSTANCE, "http://helpserver.labs.intellij.net/help/images.dtd\"> "); myFixture.testHighlighting(); @@ -60,8 +56,6 @@ public class RealFetchTest extends LightPlatformCodeInsightFixtureTestCase { intention.invoke(getProject(), myFixture.getEditor(), myFixture.getFile()); List infos = myFixture.doHighlighting(); assertEmpty(infos); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().removeResource(url); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().removeResource(url)); } } diff --git a/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java b/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java index 62179c839e9d..129ea7bde810 100644 --- a/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java +++ b/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java @@ -108,9 +108,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase { public void testPropValue() throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject("Person.html"); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", virtualFile.getPath()); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", virtualFile.getPath())); doTestInHtml("

", "name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address" ); @@ -118,9 +116,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase { public void testPropValueSchemaOrgFormat() throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject("Product.html"); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().addResource("http://schema.org/Product", virtualFile.getPath()); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://schema.org/Product", virtualFile.getPath())); doTestInHtml("
\">
", "additionalType", "aggregateRating", @@ -157,9 +153,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase { public void testPropValueSchemaOrgFormatWithLinks() throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject("Rating.html"); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().addResource("http://schema.org/Rating", virtualFile.getPath()); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://schema.org/Rating", virtualFile.getPath())); doTestInHtml("
\">
", "alternateName", "bestRating", @@ -191,9 +185,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase { public void testPropValueFromRef() throws Throwable { final VirtualFile virtualFile = myFixture.copyFileToProject("Person.html"); - ApplicationManager.getApplication().runWriteAction(() -> { - ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", virtualFile.getPath()); - }); + ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", virtualFile.getPath())); doTestInHtml("" + "
" + "
\">
" + diff --git a/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestBase.java b/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestBase.java index fd30ff10bba9..b0744325d1b6 100644 --- a/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestBase.java +++ b/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestBase.java @@ -14,17 +14,11 @@ public abstract class XmlFormatterTestBase extends XmlFormatterTestCase { String text = loadFile(name + ".xml", null); final XmlFileImpl file = (XmlFileImpl)createFile(name + ".xml", text); myTextRange = new TextRange(10000, 10001); - CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { - performFormatting(file); - }), "", ""); + CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", ""); myTextRange = new TextRange(1000000, 1000001); - CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { - performFormatting(file); - }), "", ""); + CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", ""); myTextRange = new TextRange(0, text.length()); - CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { - performFormatting(file); - }), "", ""); + CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", ""); } } diff --git a/xml/tests/src/com/intellij/xml/index/XmlSchemaIndexTest.java b/xml/tests/src/com/intellij/xml/index/XmlSchemaIndexTest.java index 260bd1dbace7..2352da946420 100644 --- a/xml/tests/src/com/intellij/xml/index/XmlSchemaIndexTest.java +++ b/xml/tests/src/com/intellij/xml/index/XmlSchemaIndexTest.java @@ -73,9 +73,7 @@ public class XmlSchemaIndexTest extends LightCodeInsightFixtureTestCase { assertEquals(new ArrayList(files1).toString(), 2, files1.size()); - List names = new ArrayList(ContainerUtil.map(files1, virtualFile -> { - return virtualFile.getName(); - })); + List names = new ArrayList(ContainerUtil.map(files1, virtualFile -> virtualFile.getName())); Collections.sort(names); assertEquals(Arrays.asList("web-app_2_5.xsd", "web-app_3_0.xsd"), names); } diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java b/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java index ef5fd1c4ddf0..30d7f71c6925 100644 --- a/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java @@ -273,15 +273,11 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx imp @TestOnly public static void addTestResource(final String url, final String location, Disposable parentDisposable) { final ExternalResourceManagerExImpl instance = (ExternalResourceManagerExImpl)getInstance(); - ApplicationManager.getApplication().runWriteAction(() -> { - instance.addResource(url, location); - }); + ApplicationManager.getApplication().runWriteAction(() -> instance.addResource(url, location)); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { - ApplicationManager.getApplication().runWriteAction(() -> { - instance.removeResource(url); - }); + ApplicationManager.getApplication().runWriteAction(() -> instance.removeResource(url)); } }); } @@ -624,16 +620,12 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx imp @TestOnly public static void registerResourceTemporarily(final String url, final String location, Disposable disposable) { - ApplicationManager.getApplication().runWriteAction(() -> { - getInstance().addResource(url, location); - }); + ApplicationManager.getApplication().runWriteAction(() -> getInstance().addResource(url, location)); Disposer.register(disposable, new Disposable() { @Override public void dispose() { - ApplicationManager.getApplication().runWriteAction(() -> { - getInstance().removeResource(url); - }); + ApplicationManager.getApplication().runWriteAction(() -> getInstance().removeResource(url)); } }); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementsGroupImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementsGroupImpl.java index 3d0e90ff6686..813dfadda2a7 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementsGroupImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementsGroupImpl.java @@ -36,9 +36,7 @@ public class XmlElementsGroupImpl implements XmlElementsGroup { @NotNull @Override protected List compute() { - return ContainerUtil.map(myParticle.getSubParticles(), xmlContentParticle -> { - return new XmlElementsGroupImpl(xmlContentParticle, XmlElementsGroupImpl.this); - }); + return ContainerUtil.map(myParticle.getSubParticles(), xmlContentParticle -> new XmlElementsGroupImpl(xmlContentParticle, XmlElementsGroupImpl.this)); } }; diff --git a/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java index fe1f94f414c0..10317ef2b44f 100644 --- a/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java +++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java @@ -45,9 +45,7 @@ class HtmlTagTreeElement extends PsiTreeElementBase implements LocationP final XmlTag tag = getElement(); if (tag == null || !tag.isValid()) return Collections.emptyList(); - return ContainerUtil.map2List(tag.getSubTags(), subTag -> { - return new HtmlTagTreeElement(subTag); - }); + return ContainerUtil.map2List(tag.getSubTags(), subTag -> new HtmlTagTreeElement(subTag)); } @Override