Merge remote-tracking branch 'origin/master'
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Thu, 29 Sep 2016 14:13:44 +0000 (16:13 +0200)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Thu, 29 Sep 2016 14:13:44 +0000 (16:13 +0200)
561 files changed:
images/src/org/intellij/images/editor/impl/ImageEditorUI.java
java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java
java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java
java/execution/impl/src/com/intellij/execution/testframework/AbstractPatternBasedConfigurationProducer.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphBuilder.java [deleted file]
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/LambdaHighlightingUtil.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/ModuleHighlightUtil.java
java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/BlockMarkerCommentsInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/PossibleHeapPollutionVarargsInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/RedundantLambdaCodeBlockInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/RemoveAnnotationQuickFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/TrivialMethodReferenceInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/compiler/RemoveElementQuickFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaOptionalSupport.java
java/java-analysis-impl/src/com/intellij/codeInspection/java18api/Java8CollectionsApiInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/localCanBeFinal/LocalCanBeFinal.java
java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/nullable/ChangeNullableDefaultsFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/redundantCast/RedundantCastInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/streamMigration/MigrateToStreamFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/streamMigration/ReplaceWithCollectFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/streamMigration/ReplaceWithFindFirstFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/streamMigration/ReplaceWithMatchFix.java
java/java-analysis-impl/src/com/intellij/codeInspection/streamMigration/StreamApiMigrationInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/unnecessaryModuleDependency/UnnecessaryModuleDependencyInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/unneededThrows/RedundantThrows.java
java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
java/java-impl/src/com/intellij/application/options/editor/ExcludeTable.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateStaticMethodQuickFix.java
java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/CreateFieldOrPropertyFix.java
java/java-impl/src/com/intellij/codeInspection/CollectionAddAllCanBeReplacedWithConstructorInspection.java
java/java-impl/src/com/intellij/codeInspection/DefaultAnnotationParamInspection.java
java/java-impl/src/com/intellij/codeInspection/RemoveInitializerFix.java
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedParametersInspection.java
java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/DefaultFileTemplateUsageInspection.java
java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/ReplaceWithFileTemplateFix.java
java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java
java/java-impl/src/com/intellij/codeInspection/equalsAndHashcode/EqualsAndHashcode.java
java/java-impl/src/com/intellij/codeInspection/java18StreamApi/StaticPseudoFunctionalStyleMethodInspection.java
java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocReferenceInspection.java
java/java-impl/src/com/intellij/codeInspection/lambda/RedundantLambdaParameterTypeInspection.java
java/java-impl/src/com/intellij/codeInspection/magicConstant/MagicConstantInspection.java
java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantArrayForVarargsCallInspection.java
java/java-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java
java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
java/java-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/BaseConvertToLocalQuickFix.java
java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
java/java-indexing-impl/src/com/intellij/psi/impl/java/ReferenceChainLink.java
java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java
java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
java/java-psi-impl/src/messages/JavaErrorMessages.properties
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/ChainStartingWithConstructor.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignment.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentBoolean.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentBooleanInverted.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentExtraCode.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentNonTrivial.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentNonTrivialUnassigned.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentTryCatch.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentTryCatch2.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterArrayFilterCollect.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterArrayListVariableType.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCastExpected.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayList.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListAndFilter.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListCollection.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListComment.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListLambda.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectBoxed.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectHashSet.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectInterrupted.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectInterruptedInLoop.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectInterruptedUpdated.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectInterruptedUsed.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectLinkedHashSet.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectToObj.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterContinueNested.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterContinueNestedElse.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFilterFlatMapCollectionFilterMapCollect.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFilterFlatMapMapFilterCollect.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFilterMapFlatMapArrayCollect.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFindFirstAssignment.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFindFirstAssignmentCast.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFindFirstAssignmentInterrupted.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFindFirstAssignmentUsedInSameDeclaration.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFindFirstAssignmentWithLabel.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFlatten2DArray.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterFlatten2DArrayPrimitive.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterSumInterruptedUnused.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterSumInterruptedUsed.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeAnyMatchAssignmentExtraCode.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeAnyMatchAssignmentNonTrivial.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeAnyMatchAssignmentNonTrivialUnassigned.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeAnyMatchAssignmentTryCatch.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeAnyMatchAssignmentTryCatch2.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectInterrupted.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectInterruptedInLoop.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectInterruptedUpdated.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectInterruptedUsed.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeFindFirstAssignmentInterrupted.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeFindFirstAssignmentUsedInSameDeclaration.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeSumInterruptedUnused.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeSumInterruptedUsed.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/javadocIG/doubleLt.html [new file with mode: 0644]
java/java-tests/testData/codeInsight/javadocIG/doubleLt.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/daemon/ModuleHighlightingTest.kt
java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.java
java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
java/java-tests/testSrc/com/intellij/psi/search/UpdateCacheTest.java
java/java-tests/testSrc/com/intellij/roots/libraries/LibraryTest.java
java/java-tests/testSrc/com/intellij/testFramework/fixtures/MultiModuleJava9ProjectDescriptor.kt
java/testFramework/src/com/siyeh/ig/LightInspectionTestCase.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/inspections/MigrateAssertToMatcherAssertInspection.java
json/src/com/intellij/json/codeinsight/JsonStandardComplianceInspection.java
platform/analysis-impl/src/com/intellij/codeStyle/InconsistentLineSeparatorsInspection.java
platform/built-in-server/client/node-rpc-client/node-rpc-client.iml
platform/configuration-store-impl/src/DirectoryBasedStorage.kt
platform/configuration-store-impl/src/SchemeManagerImpl.kt
platform/configuration-store-impl/src/schemeLoader.kt
platform/core-impl/src/com/intellij/codeInsight/documentation/PlatformDocumentationUtil.java
platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java
platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorColorsScheme.java
platform/editor-ui-api/src/com/intellij/openapi/editor/colors/EditorSchemeAttributeDescriptor.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ProgressExecutionMode.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java
platform/icons/src/debugger/explosion.png [new file with mode: 0644]
platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java
platform/lang-impl/src/com/intellij/codeInsight/CodeInsightUtilBase.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java
platform/lang-impl/src/com/intellij/codeInspection/LossyEncodingInspection.java
platform/lang-impl/src/com/intellij/codeInspection/ProblematicWhitespaceInspection.java
platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java
platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineDescriptorResolveResult.java
platform/lang-impl/src/com/intellij/ide/todo/configurable/PatternDialog.java
platform/platform-api/src/com/intellij/openapi/actionSystem/MouseShortcut.java
platform/platform-api/src/com/intellij/openapi/ui/JBPopupMenu.java
platform/platform-api/src/com/intellij/openapi/ui/Messages.java
platform/platform-api/src/com/intellij/ui/PortField.java
platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItem.java
platform/platform-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DelegateColorScheme.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
platform/platform-impl/src/com/intellij/openapi/project/ex/ProjectManagerEx.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
platform/platform-impl/src/com/intellij/ui/SlideComponent.java
platform/platform-impl/src/com/intellij/util/containers/util.kt
platform/platform-impl/src/com/intellij/util/ui/table/JBListTable.java
platform/platform-impl/src/com/intellij/util/ui/table/MouseSuppressor.java [deleted file]
platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java
platform/platform-tests/testSrc/com/intellij/openapi/application/impl/LaterInvocatorTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java
platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java
platform/platform-tests/testSrc/com/intellij/openapi/project/impl/ProjectOpeningTest.java [new file with mode: 0644]
platform/projectModel-api/src/com/intellij/openapi/project/ProjectManager.java
platform/projectModel-impl/src/com/intellij/configurationStore/scheme-impl.kt
platform/projectModel-impl/src/com/intellij/openapi/options/SchemeManager.java
platform/testFramework/src/com/intellij/editor/EditorColorSchemeTestCase.java
platform/util/src/com/intellij/openapi/util/IconLoader.java
platform/util/src/com/intellij/util/EnvironmentUtil.java
platform/util/src/com/intellij/util/ui/MouseEventAdapter.java
platform/util/src/com/intellij/util/ui/MouseEventHandler.java
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/CommitPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/DelegatingFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/abstraction/OverlyStrongTypeCastInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/assignment/AssignmentUsedAsConditionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bitwise/PointlessBitwiseExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/ClassNewInstanceInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryUpdateCalledVisitor.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/EmptyInitializerInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/InnerClassReferencedViaSubclassInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/MathRandomCastToIntInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/NewStringBufferWithCharArgumentInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/NonShortCircuitBooleanInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/StaticCallOnSubclassInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/StaticFieldReferenceOnSubclassInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/ClassInitializerInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/ClassMayBeInterfaceInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/InterfaceMayBeAnnotatedFunctionalInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/cloneable/CloneableImplementsCloneInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/BooleanExpressionMayBeConditionalInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/ConfusingElseInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/ConstantConditionalExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/ConstantIfStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/DoubleNegationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/ForLoopReplaceableByWhileInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfMayBeConditionalInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/LoopWithImplicitTerminationConditionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/NegatedConditionalExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/NegatedConditionalInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/NegatedEqualityExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/NegatedIfElseInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/PointlessBooleanExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/SimplifiableBooleanExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/SimplifiableConditionalExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/TrivialIfInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/UnnecessaryConditionalExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/UnnecessaryLabelOnBreakStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/UnnecessaryLabelOnContinueStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/EmptyCatchBlockInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/EmptyFinallyBlockInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/NullThrownInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/finalization/FinalizeNotProtectedInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/AddSerialVersionUIDFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/AddThisQualifierFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/ConvertToVarargsMethodFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/DeleteImportFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/EqualityToEqualsFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/ExtractParameterAsLocalVariableFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/MakeInitializerExplicitFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/NormalizeDeclarationFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/imports/StaticImportInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/inheritance/AbstractMethodOverridesAbstractMethodInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/inheritance/MissingOverrideAnnotationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/inheritance/RedundantMethodOverrideInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/inheritance/TypeParameterExtendsFinalClassInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/initialization/DoubleBraceInitializationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/j2me/MultiplyOrDivideByPowerOfTwoInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/j2me/SimplifiableIfStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/j2me/SingleCharacterStartsWithInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javabeans/ClassWithoutConstructorInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/DanglingJavadocInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/HtmlTagCanBeJavadocTagInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/MissingDeprecatedAnnotationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/UnnecessaryInheritDocInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/jdk/AutoBoxingInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/jdk/AutoUnboxingInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/jdk/ForeachStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/jdk/VarargParameterInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/AssertEqualsCalledOnArrayInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/AssertEqualsMayBeAssertSameInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/MisorderedAssertEqualsArgumentsInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/MultipleExceptionsDeclaredOnTestMethodInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/SimplifiableJUnitAssertionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/TestMethodWithoutAssertionInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/UseOfObsoleteAssertInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/LogStatementGuardedByLogConditionInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/StringConcatenationArgumentToLogCallInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/memory/InnerClassMayBeStaticInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/BigDecimalLegacyMethodInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/EqualsReplaceableByObjectsCallInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IndexOfReplaceableByContainsInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/StringBufferReplaceableByStringBuilderInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/TryFinallyCanBeTryWithResourcesInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/TryWithIdenticalCatchesInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/UnnecessaryBoxingInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/UnnecessaryUnboxingInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/BigDecimalEqualsInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/CharUsedInArithmeticContextInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/ComparisonToNaNInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/ConfusingFloatingPointLiteralInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/ConstantMathCallInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/ConvertOctalLiteralToDecimalFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/LongLiteralsEndingWithLowercaseLInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/NonReproducibleMathCallInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/PointlessArithmeticExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/RemoveLeadingZeroFix.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/SuspiciousLiteralUnderscoreInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/UnaryPlusInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/UnnecessaryExplicitNumericCastInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/UnnecessaryUnaryMinusInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/BooleanConstructorInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/BoxingBoxedValueInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/ConstantStringInternInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/InstantiatingObjectToGetClassObjectInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/KeySetIterationMayUseEntrySetInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/LengthOneStringInIndexOfInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/LengthOneStringsInConcatenationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/ManualArrayCopyInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/ManualArrayToCollectionCopyInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/RandomDoubleForRandomIntegerInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/RedundantStringFormatCallInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/StringBufferToStringInConcatenationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/StringConcatenationInsideStringBufferAppendInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/StringToStringInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/SubstringZeroInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/TailRecursionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/redundancy/UnusedLabelInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/resources/AutoCloseableResourceInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/serialization/NonSerializableWithSerialVersionUIDFieldInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/serialization/SerialVersionUIDNotStaticFinalInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/serialization/TransientFieldInNonSerializableClassInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/CStyleArrayDeclarationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/CallToStringConcatCanBeReplacedByOperatorInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ConstantOnLHSOfComparisonInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ConstantOnRHSOfComparisonInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/EqualsCalledOnEnumConstantInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ExtendsObjectInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ImplicitCallToSuperInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ListIndexOfReplaceableByContainsInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/LiteralAsArgToStringEqualsInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/MissortedModifiersInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/RedundantFieldInitializationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/RedundantImplementsInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/SizeReplaceableByIsEmptyInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/TypeParameterExtendsObjectInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnclearBinaryExpressionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessarilyQualifiedInnerClassAccessInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticUsageInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticallyImportedElementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryBlockStatementInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryConstructorInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryParenthesesInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryQualifierForThisInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessarySemicolonInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessarySuperConstructorInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessarySuperQualifierInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryThisInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/ConditionSignalInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/MethodMayBeSynchronizedInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/ObjectNotifyInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/SynchronizedMethodInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/ThreadRunInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/visibility/AmbiguousFieldAccessInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/visibility/AmbiguousMethodCallInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/visibility/LocalVariableHidingMemberVariableInspectionBase.java
plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/StaticMethodOnlyUsedInOneClassInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/asserttoif/AssertionCanBeIfInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/asserttoif/IfCanBeAssertionInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ProtectedMemberInFinalClassInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/PublicConstructorInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassWithoutPrivateConstructorInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/ReuseOfLocalVariableInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TooBroadCatchInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/UnnecessaryInitCauseInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/exceptions/MultiCatchCanBeSplitInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/exceptions/TryStatementWithMultipleResourcesInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/ExtractMethodFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineCallFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineVariableFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/IntroduceConstantFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/MoveClassFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/ReplaceInheritanceWithDelegationFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/SuppressForTestsScopeFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/inheritance/RefusedBequestInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/initialization/NonThreadSafeLazyInitializationInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/MissingPackageInfoInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/javadoc/PackageDotHtmlMayBePackageInfoInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/migration/EnumerationCanBeIterationInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/migration/ForCanBeForeachInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/migration/WhileCanBeForeachInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/naming/MethodNameSameAsClassNameInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/performance/DynamicRegexReplaceableByCompiledPatternInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/performance/ToArrayCallWithZeroLengthArrayArgumentInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/serialization/ExternalizableWithoutPublicNoArgConstructorInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/DiamondCanBeReplacedWithExplicitTypeArgumentsInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/LambdaBodyCanBeCodeBlockInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/LambdaCanBeReplacedWithAnonymousInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/MethodRefCanBeReplacedWithLambdaInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/UnqualifiedInnerClassAccessInspection.java
plugins/InspectionGadgets/src/inspectionDescriptions/EqualsReplaceableByObjectsCall.html
plugins/InspectionGadgets/src/inspectionDescriptions/LocalVariableHidingMemberVariable.html
plugins/InspectionGadgets/test/com/siyeh/igfixes/migration/equals_replaceable_by_objects_call/StaticField.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/migration/equals_replaceable_by_objects_call/StaticField.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/migration/equals_replaceable_by_objects_call/StaticField2.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/migration/equals_replaceable_by_objects_call/StaticField2.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/ForAtoB.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/ForAtoB.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusN.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusN.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusOne.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusOne.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusOneAtoB.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusOneAtoB.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusTwo.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusTwo.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusTwoAtoB.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MinusTwoAtoB.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Multiply.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Multiply.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MultiplyLE.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/MultiplyLE.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusN.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusN.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusOne.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusOne.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusOneAtoB.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusOneAtoB.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusTwo.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusTwo.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusTwoAtoB.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/PlusTwoAtoB.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Shift.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Shift.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/ShiftLE.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/ShiftLE.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/SimpleFor.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/SimpleFor.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/SimpleForeach.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/SimpleForeach.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/TempVarFor.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/TempVarFor.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Unary.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Unary.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Unary2.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/Unary2.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/UnaryLE.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/performance/replace_with_add_all/UnaryLE.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/migration/equals_replaceable_by_objects_call/EqualsReplaceableByObjectsCall.java
plugins/InspectionGadgets/test/com/siyeh/igtest/migration/equals_replaceable_by_objects_call/EqualsReplaceableByObjectsCallCheckNull.java
plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/suspicious_literal_underscore/SuspiciousLiteralUnderscore.java
plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/local_variable_hiding_member_variable/LocalVariableHidingMemberVariable.java
plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/local_variable_hiding_member_variable/LocalVariableHidingMemberVariable2.java [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/migration/EqualsReplaceableByObjectsCallFixTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/ManualArrayToCollectionCopyFixTest.java [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/LocalVariableHidingMemberVariableInspectionTest.java
plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/PatternValidator.java
plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/util/AnnotateFix.java
plugins/devkit/src/inspections/PluginXmlDomInspection.java
plugins/devkit/src/inspections/quickfix/AddWithTagFix.java
plugins/devkit/src/inspections/quickfix/CreateConstructorFix.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/inspections/SecondUnsafeCallQuickFix.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/GrPackageInspection.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/GrUnusedIncDecInspection.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/style/GrUnnecessarySemicolonInspection.java
plugins/java-i18n/src/com/intellij/codeInspection/SuspiciousLocalesLanguagesInspection.java
plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java
plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java
plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/codeInsight/inspections/JavaFxUnusedImportsInspection.java
plugins/junit/src/com/intellij/execution/junit/TestClassFilter.java
plugins/junit/src/com/intellij/execution/junit/TestPackage.java
plugins/junit/test/com/intellij/execution/junit/JUnitRerunFailedTestsTest.java
plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java
plugins/junit5_rt/src/com/intellij/junit5/JUnit5TestExecutionListener.java
plugins/junit5_rt_tests/test/com/intellij/junit5/JUnit5EventsTest.java
plugins/junit_rt/src/com/intellij/junit4/JUnit4TestRunnerUtil.java
plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/PropertiesInspectionSuppressor.java
plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/TrailingSpacesInPropertyInspection.java
plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unsorted/AlphaUnsortedPropertiesFileInspection.java
plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyLocalFix.java
plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspection.java
plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java
plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalSystemSettingsProvider.java
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertAnnotationInspection.java
plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertJavadocInspection.java
plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertOldAnnotationInspection.java
plugins/testng/src/com/theoryinpractice/testng/inspection/JUnitConvertTool.java
plugins/testng/src/com/theoryinpractice/testng/inspection/UndeclaredTestInspection.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/quickfix/DownloadResourceFix.java
python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyInterpreterInspection.java
python/openapi/src/com/jetbrains/python/templateLanguages/ConfigureTemplateDirectoriesAction.java
python/psi-api/src/com/jetbrains/python/PyNames.java
python/src/com/jetbrains/python/codeInsight/imports/ImportCandidateHolder.java
python/src/com/jetbrains/python/codeInsight/imports/OptimizeImportsQuickFix.java
python/src/com/jetbrains/python/inspections/PyChainedComparisonsInspection.java
python/src/com/jetbrains/python/inspections/PyInterpreterInspection.java
python/src/com/jetbrains/python/inspections/PyMethodParametersInspection.java
python/src/com/jetbrains/python/inspections/PyPackageRequirementsInspection.java
python/src/com/jetbrains/python/inspections/PyPep8NamingInspection.java
python/src/com/jetbrains/python/inspections/PyUnusedLocalInspectionVisitor.java
python/src/com/jetbrains/python/inspections/quickfix/AddCallSuperQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/AddEncodingQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/AddGlobalQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/AugmentedAssignmentQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ChainedComparisonsQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ComparisonWithNoneQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/CompatibilityPrintCallQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ConvertDocstringQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/DictCreationQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ListCreationQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/MoveFromFutureImportQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyAddExceptionSuperClassQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyAddImportFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyAddPropertyForFieldQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyAddSpecifierToFormatQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyChangeBaseClassQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyChangeSignatureQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyConvertToNewStyleQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyCreatePropertyQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyDefaultArgumentQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionFromMethodQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyMakeMethodStaticQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyMakePublicQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyMoveAttributeToInitQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyMoveExceptQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveArgumentQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveAssignmentQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveCallQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveDictKeyQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveParameterQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveStatementQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRemoveUnderscoresInNumericLiteralsQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRenameArgumentQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRenameElementQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyRenameUnresolvedRefQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyReplaceTupleWithListQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyUpdatePropertySignatureQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/PyWrapInExceptionQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/RedundantParenthesesQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReformatFix.java
python/src/com/jetbrains/python/inspections/quickfix/RemoveArgumentEqualDefaultQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/RemoveDecoratorQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/RemoveTrailingBlankLinesFix.java
python/src/com/jetbrains/python/inspections/quickfix/RemoveTrailingLQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/RemoveTrailingSemicolonQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/RemoveUnnecessaryBackslashQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceBackquoteExpressionQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceExceptPartQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceFunctionWithSetLiteralQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceListComprehensionsQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceNotEqOperatorQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceOctalNumericLiteralQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/ReplaceRaiseStatementQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/StatementEffectFunctionCallQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/StatementEffectIntroduceVariableQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/TransformClassicClassQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefAddFutureImportQuickFix.java
python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefCreateFunctionQuickFix.java
python/testData/inspections/PyMethodParametersInspectionInitSubclass/test.py [new file with mode: 0644]
python/testData/quickFixes/AddImportQuickFixTest/canonicalNamesFromHigherLevelPackage/main_after.py
python/testSrc/com/jetbrains/python/PythonInspectionsTest.java
python/testSrc/com/jetbrains/python/intentions/PyAnnotateTypesIntentionTest.java
python/testSrc/com/jetbrains/python/quickFixes/AddImportQuickFixTest.java
spellchecker/src/com/intellij/spellchecker/quickfixes/ChangeTo.java
spellchecker/src/com/intellij/spellchecker/quickfixes/RenameTo.java
xml/dom-tests/tests/com/intellij/util/xml/DomVirtualFileEventsTest.java
xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/CreateNSDeclarationIntentionFix.java
xml/impl/src/com/intellij/xml/util/AddDtdDeclarationFix.java
xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java
xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/RemoveExtraClosingTagIntentionAction.java
xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/SwitchToHtml5Action.java
xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongRootElementInspection.java
xml/xml-analysis-impl/src/com/intellij/xml/util/CheckEmptyTagInspection.java
xml/xml-analysis-impl/src/com/intellij/xml/util/CollapseTagIntention.java
xml/xml-analysis-impl/src/com/intellij/xml/util/XmlDeclareIdInCommentAction.java

index 62948cb6227993ca730a7c2ef7a082cdad1498eb..0e5e290be79939c9b539b10219a244e0e9a061c9 100644 (file)
@@ -330,9 +330,11 @@ final class ImageEditorUI extends JPanel implements DataProvider, CopyProvider,
       EditorOptions editorOptions = options.getEditorOptions();
       ZoomOptions zoomOptions = editorOptions.getZoomOptions();
       if (zoomOptions.isWheelZooming() && e.isControlDown()) {
-        if (e.getWheelRotation() < 0) {
+        int rotation = e.getWheelRotation();
+        if (rotation < 0) {
           zoomModel.zoomOut();
-        } else {
+        }
+        else if (rotation > 0) {
           zoomModel.zoomIn();
         }
         e.consume();
index 0d46f2fba155cfb74bf2e6830a95d4e3cae265a5..f504c0f67655eb560f697cdb58c594126e401858 100644 (file)
@@ -52,8 +52,9 @@ import org.jetbrains.org.objectweb.asm.MethodVisitor;
 import org.jetbrains.org.objectweb.asm.Opcodes;
 
 import java.util.Collections;
+import java.util.Deque;
+import java.util.LinkedList;
 import java.util.List;
-import java.util.Stack;
 
 /**
  * User: Alexander Podkhalyuzin
@@ -144,14 +145,14 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
       final Ref<TextRange> textRange = new Ref<>(lineRange);
 
       final PsiElementVisitor methodCollector = new JavaRecursiveElementVisitor() {
-        final Stack<PsiMethod> myContextStack = new Stack<>();
-        final Stack<String> myParamNameStack = new Stack<>();
+        final Deque<PsiMethod> myContextStack = new LinkedList<>();
+        final Deque<String> myParamNameStack =  new LinkedList<>();
         private int myNextLambdaExpressionOrdinal = 0;
         private boolean myInsideLambda = false;
 
         @Nullable
         private String getCurrentParamName() {
-          return myParamNameStack.isEmpty() ? null : myParamNameStack.peek();
+          return myParamNameStack.peekFirst();
         }
 
         @Override
@@ -257,7 +258,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
         }
 
         public void visitExpressionList(PsiExpressionList expressionList) {
-          final PsiMethod psiMethod = myContextStack.isEmpty()? null : myContextStack.peek();
+          PsiMethod psiMethod = myContextStack.peekFirst();
           if (psiMethod != null) {
             final String methodName = psiMethod.getName();
             final PsiExpression[] expressions = expressionList.getExpressions();
index 2880847a8adfe15ff9c7b83c49d2753d81c3e3d1..dfb00467a1cf8c360acfce7fab4c43eb183ed0fa 100644 (file)
@@ -360,15 +360,13 @@ public class LocalVariablesUtil {
     private final MultiMap<Integer, String> myNames;
     private int myCurrentSlotIndex;
     private final PsiElement myElement;
-    private final Stack<Integer> myIndexStack;
+    private final Deque<Integer> myIndexStack = new LinkedList<>();
     private boolean myReached = false;
 
     public LocalVariableNameFinder(int startSlot, MultiMap<Integer, String> names, PsiElement element) {
       myNames = names;
       myCurrentSlotIndex = startSlot;
       myElement = element;
-      myIndexStack = new Stack<>();
-
     }
 
     private boolean shouldVisit(PsiElement scope) {
index 189f80bb6ed1dec8d4ee8c1115df0d509b5b662a..514a82daa105f199c3dc3383bfe9298cd78d31b9 100644 (file)
@@ -165,11 +165,12 @@ public abstract class AbstractPatternBasedConfigurationProducer<T extends Module
     }
     else {
       final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
+      PsiElement element = null;
       if (editor != null) {
+        final PsiFile editorFile = CommonDataKeys.PSI_FILE.getData(dataContext);
         final List<Caret> allCarets = editor.getCaretModel().getAllCarets();
-        if (allCarets.size() > 1) {
-          final PsiFile editorFile = CommonDataKeys.PSI_FILE.getData(dataContext);
-          if (editorFile != null) {
+        if (editorFile != null) {
+          if (allCarets.size() > 1) {
             final Set<PsiMethod> methods = new LinkedHashSet<>();
             for (Caret caret : allCarets) {
               ContainerUtil.addIfNotNull(methods, PsiTreeUtil.getParentOfType(editorFile.findElementAt(caret.getOffset()), PsiMethod.class));
@@ -178,9 +179,16 @@ public abstract class AbstractPatternBasedConfigurationProducer<T extends Module
               return collectTestMembers(methods.toArray(PsiElement.EMPTY_ARRAY), checkAbstract, checkIsTest, processor, classes);
             }
           }
+          else {
+            element = editorFile.findElementAt(editor.getCaretModel().getOffset());
+          }
         }
       }
-      final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
+
+      if (element == null) {
+        element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
+      }
+
       final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
       if (files != null) {
         Project project = CommonDataKeys.PROJECT.getData(dataContext);
index 47096aa11132a5c98d894a7e3a326488efd9e16a..448c427c445c9463bad6e211d6cd15bd51959436 100644 (file)
@@ -65,6 +65,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
   private JavaSdkVersion myJavaSdkVersion;
 
   @SuppressWarnings("StatefulEp") private PsiFile myFile;
+  @SuppressWarnings("StatefulEp") private PsiJavaModule myJavaModule;
 
   // map codeBlock->List of PsiReferenceExpression of uninitialized final variables
   private final Map<PsiElement, Collection<PsiReferenceExpression>> myUninitializedVarProblems = new THashMap<>();
@@ -155,13 +156,9 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
 
   @Override
   public boolean analyze(@NotNull PsiFile file, boolean updateWholeFile, @NotNull HighlightInfoHolder holder, @NotNull Runnable highlight) {
-    myFile = file;
-    myHolder = Holder.CHECK_ELEMENT_LEVEL ? new CheckLevelHighlightInfoHolder(file, holder) : holder;
-
     boolean success = true;
     try {
-      myLanguageLevel = PsiUtil.getLanguageLevel(file);
-      myJavaSdkVersion = notNull(JavaVersionService.getInstance().getJavaSdkVersion(file), JavaSdkVersion.fromLanguageLevel(myLanguageLevel));
+      prepare(Holder.CHECK_ELEMENT_LEVEL ? new CheckLevelHighlightInfoHolder(file, holder) : holder, file);
       if (updateWholeFile) {
         ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
         if (progress == null) throw new IllegalStateException("Must be run under progress");
@@ -193,6 +190,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
       myReassignedParameters.clear();
 
       myRefCountHolder = null;
+      myJavaModule = null;
       myFile = null;
       myHolder = null;
       myDuplicateMethods.clear();
@@ -202,6 +200,18 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
     return success;
   }
 
+  protected void prepareToRunAsInspection(@NotNull HighlightInfoHolder holder) {
+    prepare(holder, holder.getContextFile());
+  }
+
+  private void prepare(HighlightInfoHolder holder, PsiFile file) {
+    myHolder = holder;
+    myFile = file;
+    myLanguageLevel = PsiUtil.getLanguageLevel(file);
+    myJavaSdkVersion = notNull(JavaVersionService.getInstance().getJavaSdkVersion(file), JavaSdkVersion.fromLanguageLevel(myLanguageLevel));
+    myJavaModule = myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_9) ? ModuleHighlightUtil.getModuleDescriptor(file) : null;
+  }
+
   @Override
   public void visitElement(PsiElement element) {
     if (myRefCountHolder != null && myFile instanceof ServerPageFile) {
@@ -1030,8 +1040,14 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
 
   @Override
   public void visitReferenceElement(PsiJavaCodeReferenceElement ref) {
-    JavaResolveResult resolveResult = doVisitReferenceElement(ref);
-    if (resolveResult != null && !myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkRawOnParameterizedType(ref, resolveResult.getElement()));
+    JavaResolveResult result = doVisitReferenceElement(ref);
+    if (result != null) {
+      PsiElement resolved = result.getElement();
+      if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkRawOnParameterizedType(ref, resolved));
+      if (!myHolder.hasErrorResults() && resolved != null && myJavaModule != null) {
+        myHolder.add(ModuleHighlightUtil.checkPackageAccessibility(ref, resolved, myJavaModule));
+      }
+    }
   }
 
   private JavaResolveResult doVisitReferenceElement(@NotNull PsiJavaCodeReferenceElement ref) {
@@ -1688,14 +1704,4 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
   private HighlightInfo checkFeature(@NotNull PsiElement element, @NotNull Feature feature) {
     return HighlightUtil.checkFeature(element, feature, myLanguageLevel, myFile);
   }
-
-  protected void prepareToRunAsInspection(@NotNull HighlightInfoHolder holder) {
-    PsiFile file = holder.getContextFile();
-    JavaSdkVersion sdkVersion = JavaVersionService.getInstance().getJavaSdkVersion(file);
-
-    myHolder = holder;
-    myFile = file;
-    myLanguageLevel = PsiUtil.getLanguageLevel(file);
-    myJavaSdkVersion = sdkVersion != null ? sdkVersion : JavaSdkVersion.fromLanguageLevel(myLanguageLevel);
-  }
 }
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphBuilder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphBuilder.java
deleted file mode 100644 (file)
index 3a1441b..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2000-2016 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.codeInsight.daemon.impl.analysis;
-
-import com.intellij.openapi.application.ReadAction;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.search.FilenameIndex;
-import com.intellij.psi.util.CachedValueProvider.Result;
-import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.MultiMap;
-import com.intellij.util.graph.DFSTBuilder;
-import com.intellij.util.graph.Graph;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE;
-import static com.intellij.psi.SyntaxTraverser.psiTraverser;
-import static com.intellij.psi.util.PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT;
-
-public class JavaModuleGraphBuilder {
-  private JavaModuleGraphBuilder() { }
-
-  @Nullable
-  public static Graph<PsiJavaModule> getOrBuild(@NotNull Project project) {
-    return CachedValuesManager.getManager(project).getCachedValue(project, () -> {
-      Graph<PsiJavaModule> graph = ReadAction.compute(() -> build(project));
-      return Result.create(graph, OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
-    });
-  }
-
-  @Nullable
-  public static Collection<PsiJavaModule> findCycle(@NotNull Graph<PsiJavaModule> graph, @NotNull PsiJavaModule module) {
-    return ((JavaModuleGraph)graph).myCycles.stream().filter(set -> set.contains(module)).findFirst().orElse(null);
-  }
-
-  // Discovers relationships between Java modules in the project.
-  // Library/JDK modules are excluded - in assumption there can't be any lib -> src dependencies.
-  private static Graph<PsiJavaModule> build(Project project) {
-    Set<PsiJavaModule> projectModules = ContainerUtil.newHashSet();
-    for (Module module : ModuleManager.getInstance(project).getModules()) {
-      Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(project, MODULE_INFO_FILE, module.getModuleScope(false));
-      if (files.size() > 1) return null;  // aborts the process when there are incorrect modules in the project
-      VirtualFile vFile = ContainerUtil.getFirstItem(files);
-      if (vFile != null) {
-        PsiFile psiFile = PsiManager.getInstance(project).findFile(vFile);
-        if (psiFile instanceof PsiJavaFile) {
-          PsiJavaModule moduleDeclaration = ((PsiJavaFile)psiFile).getModuleDeclaration();
-          if (moduleDeclaration != null) {
-            projectModules.add(moduleDeclaration);
-          }
-        }
-      }
-    }
-
-    MultiMap<PsiJavaModule, PsiJavaModule> relations = MultiMap.create();
-    for (PsiJavaModule moduleDeclaration : projectModules) {
-      for (PsiRequiresStatement statement : psiTraverser().children(moduleDeclaration).filter(PsiRequiresStatement.class)) {
-        PsiJavaModule dependency = resolveDependency(statement);
-        if (dependency != null && projectModules.contains(dependency)) {
-          relations.putValue(moduleDeclaration, dependency);
-        }
-      }
-    }
-    return new JavaModuleGraph(relations);
-  }
-
-  private static PsiJavaModule resolveDependency(PsiRequiresStatement statement) {
-    PsiJavaModuleReferenceElement refElement = statement.getReferenceElement();
-    if (refElement != null) {
-      PsiPolyVariantReference ref = refElement.getReference();
-      if (ref != null) {
-        ResolveResult[] results = ref.multiResolve(true);
-        if (results.length == 1) {
-          PsiElement target = results[0].getElement();
-          if (target instanceof PsiJavaModule) {
-            return (PsiJavaModule)target;
-          }
-        }
-      }
-    }
-
-    return null;
-  }
-
-  private static class JavaModuleGraph implements Graph<PsiJavaModule> {
-    private final MultiMap<PsiJavaModule, PsiJavaModule> myMap;
-    private final List<Set<PsiJavaModule>> myCycles;
-
-    public JavaModuleGraph(MultiMap<PsiJavaModule, PsiJavaModule> map) {
-      myMap = map;
-
-      DFSTBuilder<PsiJavaModule> builder = new DFSTBuilder<>(this);
-      myCycles = builder.getComponents().stream()
-        .map(ContainerUtil::newLinkedHashSet)
-        .collect(Collectors.toList());
-    }
-
-    @Override
-    public Collection<PsiJavaModule> getNodes() {
-      return myMap.keySet();
-    }
-
-    @Override
-    public Iterator<PsiJavaModule> getIn(PsiJavaModule n) {
-      return ContainerUtil.emptyIterator();
-    }
-
-    @Override
-    public Iterator<PsiJavaModule> getOut(PsiJavaModule n) {
-      return myMap.get(n).iterator();
-    }
-  }
-}
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java
new file mode 100644 (file)
index 0000000..48400b4
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2000-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.daemon.impl.analysis;
+
+import com.intellij.openapi.application.ReadAction;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.search.FilenameIndex;
+import com.intellij.psi.util.CachedValueProvider.Result;
+import com.intellij.psi.util.CachedValuesManager;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.MultiMap;
+import com.intellij.util.graph.DFSTBuilder;
+import com.intellij.util.graph.Graph;
+import com.intellij.util.graph.GraphGenerator;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE;
+import static com.intellij.psi.SyntaxTraverser.psiTraverser;
+import static com.intellij.psi.util.PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT;
+
+public class JavaModuleGraphUtil {
+  private JavaModuleGraphUtil() { }
+
+  @Nullable
+  public static Collection<PsiJavaModule> findCycle(@NotNull PsiJavaModule module) {
+    Project project = module.getProject();
+    List<Set<PsiJavaModule>> cycles = CachedValuesManager.getManager(project).getCachedValue(project, () ->
+      Result.create(ReadAction.compute(() -> findCycles(project)), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT));
+    return ContainerUtil.find(cycles, set -> set.contains(module));
+  }
+
+  public static boolean reads(@NotNull PsiJavaModule source, @NotNull PsiJavaModule destination) {
+    Project project = source.getProject();
+    RequiresGraph graph = CachedValuesManager.getManager(project).getCachedValue(project, () ->
+      Result.create(ReadAction.compute(() -> buildRequiresGraph(project)), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT));
+    return graph.reads(source, destination);
+  }
+
+  // Looks for cycles between Java modules in the project sources.
+  // Library/JDK modules are excluded - in assumption there can't be any lib -> src dependencies.
+  // Module references are resolved "globally" (i.e., without taking project dependencies into account).
+  private static List<Set<PsiJavaModule>> findCycles(Project project) {
+    Set<PsiJavaModule> projectModules = ContainerUtil.newHashSet();
+    for (Module module : ModuleManager.getInstance(project).getModules()) {
+      Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(project, MODULE_INFO_FILE, module.getModuleScope(false));
+      if (files.size() > 1) return Collections.emptyList();  // aborts the process when there are incorrect modules in the project
+      Optional.ofNullable(ContainerUtil.getFirstItem(files))
+        .map(PsiManager.getInstance(project)::findFile)
+        .map(f -> f instanceof PsiJavaFile ? ((PsiJavaFile)f).getModuleDeclaration() : null)
+        .ifPresent(projectModules::add);
+    }
+
+    if (!projectModules.isEmpty()) {
+      MultiMap<PsiJavaModule, PsiJavaModule> relations = MultiMap.create();
+      for (PsiJavaModule module : projectModules) {
+        for (PsiRequiresStatement statement : psiTraverser().children(module).filter(PsiRequiresStatement.class)) {
+          Optional.ofNullable(statement.getReferenceElement())
+            .map(PsiJavaModuleReferenceElement::getReference)
+            .map(ref -> ref.multiResolve(true))
+            .map(a -> a.length == 1 ? a[0].getElement() : null)
+            .map(e -> e instanceof PsiJavaModule ? (PsiJavaModule)e : null)
+            .filter(projectModules::contains)
+            .ifPresent(dependency -> relations.putValue(module, dependency));
+        }
+      }
+
+      if (!relations.isEmpty()) {
+        Graph<PsiJavaModule> graph = new SourceSemiGraph(relations);
+        DFSTBuilder<PsiJavaModule> builder = new DFSTBuilder<>(graph);
+        Collection<Collection<PsiJavaModule>> components = builder.getComponents();
+        if (!components.isEmpty()) {
+          return components.stream().map(ContainerUtil::newLinkedHashSet).collect(Collectors.toList());
+        }
+      }
+    }
+
+    return Collections.emptyList();
+  }
+
+  // Starting from source modules, collects all module dependencies in the project.
+  // The resulting graph is used for tracing readability.
+  private static RequiresGraph buildRequiresGraph(Project project) {
+    MultiMap<PsiJavaModule, PsiJavaModule> relations = MultiMap.create();
+    Set<String> publicEdges = ContainerUtil.newTroveSet();
+    for (Module module : ModuleManager.getInstance(project).getModules()) {
+      Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(project, MODULE_INFO_FILE, module.getModuleScope(false));
+      Optional.ofNullable(ContainerUtil.getFirstItem(files))
+        .map(PsiManager.getInstance(project)::findFile)
+        .map(f -> f instanceof PsiJavaFile ? ((PsiJavaFile)f).getModuleDeclaration() : null)
+        .ifPresent(m -> visit(m, relations, publicEdges));
+    }
+
+    GraphGenerator<PsiJavaModule> graph = GraphGenerator.create(new RequiresSemiGraph(relations));
+    return new RequiresGraph(graph, publicEdges);
+  }
+
+  private static void visit(PsiJavaModule module, MultiMap<PsiJavaModule, PsiJavaModule> relations, Set<String> publicEdges) {
+    if (!relations.containsKey(module)) {
+      relations.putValues(module, Collections.emptyList());
+      for (PsiRequiresStatement statement : psiTraverser().children(module).filter(PsiRequiresStatement.class)) {
+        Optional.ofNullable(statement.getReferenceElement())
+          .map(PsiJavaModuleReferenceElement::getReference)
+          .map(PsiReference::resolve)
+          .map(e -> e instanceof PsiJavaModule ? (PsiJavaModule)e : null)
+          .ifPresent(dependency -> {
+            relations.putValue(module, dependency);
+            if (isPublic(statement)) publicEdges.add(RequiresGraph.key(dependency, module));
+            visit(dependency, relations, publicEdges);
+          });
+      }
+    }
+  }
+
+  private static boolean isPublic(PsiRequiresStatement statement) {
+    for (PsiElement child = statement.getFirstChild(); child != null; child = child.getNextSibling()) {
+      if (PsiUtil.isJavaToken(child, JavaTokenType.PUBLIC_KEYWORD)) return true;
+      if (child instanceof PsiJavaModuleReferenceElement) break;
+    }
+    return false;
+  }
+
+  private static class RequiresGraph {
+    private final Graph<PsiJavaModule> myGraph;
+    private final Set<String> myPublicEdges;
+
+    public RequiresGraph(Graph<PsiJavaModule> graph, Set<String> publicEdges) {
+      myGraph = graph;
+      myPublicEdges = publicEdges;
+    }
+
+    public boolean reads(PsiJavaModule source, PsiJavaModule destination) {
+      Iterator<PsiJavaModule> directReaders = myGraph.getOut(destination);
+      while (directReaders.hasNext()) {
+        PsiJavaModule next = directReaders.next();
+        if (source.equals(next) || myPublicEdges.contains(key(destination, next)) && reads(source, next)) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    public static String key(PsiJavaModule module, PsiJavaModule exporter) {
+      return module.getModuleName() + '/' + exporter.getModuleName();
+    }
+  }
+
+  //<editor-fold desc="Helpers.">
+  private static class SourceSemiGraph implements Graph<PsiJavaModule> {
+    private final MultiMap<PsiJavaModule, PsiJavaModule> myMap;
+
+    public SourceSemiGraph(MultiMap<PsiJavaModule, PsiJavaModule> map) {
+      myMap = map;
+    }
+
+    @Override
+    public Collection<PsiJavaModule> getNodes() {
+      return myMap.keySet();
+    }
+
+    @Override
+    public Iterator<PsiJavaModule> getIn(PsiJavaModule n) {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Iterator<PsiJavaModule> getOut(PsiJavaModule n) {
+      return myMap.get(n).iterator();
+    }
+  }
+
+  private static class RequiresSemiGraph implements GraphGenerator.SemiGraph<PsiJavaModule> {
+    private final MultiMap<PsiJavaModule, PsiJavaModule> myMap;
+
+    public RequiresSemiGraph(MultiMap<PsiJavaModule, PsiJavaModule> map) {
+      myMap = map;
+    }
+
+    @Override
+    public Collection<PsiJavaModule> getNodes() {
+      return myMap.keySet();
+    }
+
+    @Override
+    public Iterator<PsiJavaModule> getIn(PsiJavaModule n) {
+      return myMap.get(n).iterator();
+    }
+  }
+  //</editor-fold>
+}
\ No newline at end of file
index c20953f75a174f00a73a971e705e7ab947bce312..95a692f567965575fde7865ab274f1c4ca95d2e5 100644 (file)
@@ -113,11 +113,8 @@ public class LambdaHighlightingUtil {
     final PsiClass aClass = resolveResult.getElement();
     if (aClass != null) {
       if (aClass instanceof PsiTypeParameter) return null; //should be logged as cyclic inference
-      final List<HierarchicalMethodSignature> signatures = LambdaUtil.findFunctionCandidates(aClass);
-      if (signatures != null && signatures.size() == 1) {
-        final MethodSignature functionalMethod = signatures.get(0);
-        if (functionalMethod.getTypeParameters().length > 0) return "Target method is generic";
-      }
+      MethodSignature functionalMethod = LambdaUtil.getFunction(aClass);
+      if (functionalMethod != null && functionalMethod.getTypeParameters().length > 0) return "Target method is generic";
       if (checkReturnTypeApplicable(resolveResult, aClass)) {
         return "No instance of type " + functionalInterfaceType.getPresentableText() + " exists so that lambda expression can be type-checked";
       }
index f8100e070e4f512f44f5a6fb26d62057192f0977..480c5b0af92020dd84c776eeccf615fe59fae14a 100644 (file)
@@ -37,7 +37,6 @@ import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.JBIterable;
-import com.intellij.util.graph.Graph;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.PropertyKey;
@@ -55,6 +54,34 @@ import static com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE;
 import static com.intellij.psi.SyntaxTraverser.psiTraverser;
 
 public class ModuleHighlightUtil {
+  @Nullable
+  static PsiJavaModule getModuleDescriptor(@NotNull PsiElement element) {
+    VirtualFile file = Optional.of(element)
+      .map(e -> e instanceof PsiFileSystemItem ? (PsiFileSystemItem)e : e.getContainingFile())
+      .map(PsiFileSystemItem::getVirtualFile)
+      .orElse(null);
+    if (file == null) return null;
+
+    Project project = element.getProject();
+    ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(project);
+    if (element instanceof PsiCompiledElement) {
+      return Optional.ofNullable(index.getClassRootForFile(file))
+        .map(r -> r.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE))
+        .map(PsiManager.getInstance(project)::findFile)
+        .map(f -> f instanceof PsiJavaFile ? ((PsiJavaFile)f).getModuleDeclaration() : null)
+        .orElse(null);
+    }
+    else {
+      Module module = index.getModuleForFile(file);
+      return Optional.ofNullable(module)
+        .map(m -> FilenameIndex.getVirtualFilesByName(project, MODULE_INFO_FILE, m.getModuleScope(false)))
+        .map(c -> c.size () == 1 ? c.iterator().next() : null)
+        .map(PsiManager.getInstance(project)::findFile)
+        .map(f -> f instanceof PsiJavaFile ? ((PsiJavaFile)f).getModuleDeclaration() : null)
+        .orElse(null);
+    }
+  }
+
   @Nullable
   static HighlightInfo checkFileName(@NotNull PsiJavaModule element, @NotNull PsiFile file) {
     if (!MODULE_INFO_FILE.equals(file.getName())) {
@@ -198,15 +225,12 @@ public class ModuleHighlightUtil {
         return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refElement).description(message).create();
       }
       else {
-        Graph<PsiJavaModule> graph = JavaModuleGraphBuilder.getOrBuild(target.getProject());
-        if (graph != null) {
-          Collection<PsiJavaModule> cycle = JavaModuleGraphBuilder.findCycle(graph, (PsiJavaModule)target);
-          if (cycle != null && cycle.contains(container)) {
-            Stream<String> stream = cycle.stream().map(PsiJavaModule::getModuleName);
-            if (ApplicationManager.getApplication().isUnitTestMode()) stream = stream.sorted();
-            String message = JavaErrorMessages.message("module.cyclic.dependence", stream.collect(Collectors.joining(", ")));
-            return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refElement).description(message).create();
-          }
+        Collection<PsiJavaModule> cycle = JavaModuleGraphUtil.findCycle((PsiJavaModule)target);
+        if (cycle != null && cycle.contains(container)) {
+          Stream<String> stream = cycle.stream().map(PsiJavaModule::getModuleName);
+          if (ApplicationManager.getApplication().isUnitTestMode()) stream = stream.sorted();
+          String message = JavaErrorMessages.message("module.cyclic.dependence", stream.collect(Collectors.joining(", ")));
+          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refElement).description(message).create();
         }
       }
     }
@@ -311,6 +335,70 @@ public class ModuleHighlightUtil {
     return null;
   }
 
+  @Nullable
+  static HighlightInfo checkPackageAccessibility(@NotNull PsiJavaCodeReferenceElement ref,
+                                                 @NotNull PsiElement target,
+                                                 @NotNull PsiJavaModule refModule) {
+    Module module = ModuleUtilCore.findModuleForPsiElement(ref);
+    if (module != null) {
+      if (target instanceof PsiClass && !(target instanceof PsiCompiledElement) && module != ModuleUtilCore.findModuleForPsiElement(target)) {
+        PsiElement targetFile = target.getParent();
+        if (targetFile instanceof PsiClassOwner) {
+          PsiJavaModule targetModule = getModuleDescriptor(target);
+          String packageName = ((PsiClassOwner)targetFile).getPackageName();
+          return checkPackageAccessibility(ref, refModule, targetModule, packageName);
+        }
+      }
+      else if (target instanceof PsiPackage) {
+        PsiElement refImport = ref.getParent();
+        if (refImport instanceof PsiImportStatementBase && ((PsiImportStatementBase)refImport).isOnDemand()) {
+          PsiDirectory[] dirs = ((PsiPackage)target).getDirectories(module.getModuleWithDependenciesAndLibrariesScope(false));
+          if (dirs.length == 1 && ModuleUtilCore.findModuleForPsiElement(dirs[0]) != module) {
+            PsiJavaModule targetModule = getModuleDescriptor(dirs[0]);
+            String packageName = ((PsiPackage)target).getQualifiedName();
+            return checkPackageAccessibility(ref, refModule, targetModule, packageName);
+          }
+        }
+      }
+    }
+
+    return null;
+  }
+
+  private static HighlightInfo checkPackageAccessibility(PsiJavaCodeReferenceElement ref,
+                                                         PsiJavaModule refModule,
+                                                         PsiJavaModule targetModule,
+                                                         String packageName) {
+    if (targetModule == null) {
+      String message = JavaErrorMessages.message("module.package.on.classpath");
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(ref).description(message).create();
+    }
+
+    String refModuleName = refModule.getModuleName();
+    String requiredName = targetModule.getModuleName();
+    if (!(targetModule instanceof PsiCompiledElement) && !isExported(targetModule, packageName)) {
+      String message = JavaErrorMessages.message("module.package.not.exported", requiredName, packageName, refModuleName);
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(ref).description(message).create();
+    }
+
+    if (!(PsiJavaModule.JAVA_BASE.equals(requiredName) || JavaModuleGraphUtil.reads(refModule, targetModule))) {
+      String message = JavaErrorMessages.message("module.not.in.requirements", refModuleName, requiredName);
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(ref).description(message).create();
+    }
+
+    return null;
+  }
+
+  private static boolean isExported(PsiJavaModule module, String packageName) {
+    for (PsiExportsStatement statement : psiTraverser().children(module).filter(PsiExportsStatement.class)) {
+      String exportedName = Optional.ofNullable(statement.getPackageReference()).map(ModuleHighlightUtil::refText).orElse("");
+      if (packageName.equals(exportedName)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private static HighlightInfo moduleResolveError(PsiJavaModuleReferenceElement refElement, PsiPolyVariantReference ref) {
     boolean missing = ref.multiResolve(true).length == 0;
     String message = JavaErrorMessages.message(missing ? "module.not.found" : "module.not.on.path", refElement.getReferenceText());
index eaecb9b92551d1d7b8fc9f48d6444c481f73109b..0300a2e1f30cc9e6d5d7752faddb7308c7c71e3a 100644 (file)
@@ -359,16 +359,10 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
   }
 
   private static class ReplaceWithLambdaFix implements LocalQuickFix, HighPriorityAction {
-    @NotNull
-    @Override
-    public String getName() {
-      return "Replace with lambda";
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return "Replace with lambda";
     }
 
     @Override
index f74912d75516b5e4acf6dc1203e645d69ac1c408..d0a5790a98825cad9b97fa0f6a2529cacfdcc8bd 100644 (file)
@@ -112,19 +112,13 @@ public class AnonymousCanBeMethodReferenceInspection extends BaseJavaBatchLocalI
   }
 
   private static class ReplaceWithMethodRefFix implements LocalQuickFix {
-      @NotNull
-      @Override
-      public String getName() {
-        return "Replace with method reference";
-      }
-
       @NotNull
       @Override
       public String getFamilyName() {
-        return getName();
+        return "Replace with method reference";
       }
 
-      @Override
+    @Override
       public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
         final PsiElement element = descriptor.getPsiElement();
         if (element instanceof PsiNewExpression) {
index f2d8f77267a7be9ca33f2d7d87d3f71b7c088d85..1d85c083d89e91a5b3a407a5e528584643d6c70d 100644 (file)
@@ -91,12 +91,6 @@ public class BlockMarkerCommentsInspection extends BaseJavaBatchLocalInspectionT
         }
         if (MARKER_PATTERN.accepts(element)) {
           holder.registerProblem(element, "Redundant block marker", new LocalQuickFix() {
-            @NotNull
-            @Override
-            public String getName() {
-              return getFamilyName();
-            }
-
             @NotNull
             @Override
             public String getFamilyName() {
index 100cc979e235db6e77537fb724505c83dac87c76..000e9d7887f4a046ba464d405eb205ad8596cfb1 100644 (file)
@@ -82,16 +82,10 @@ public class ExplicitTypeCanBeDiamondInspection extends BaseJavaBatchLocalInspec
   }
 
   private static class ReplaceWithDiamondFix implements LocalQuickFix, HighPriorityAction {
-    @NotNull
-    @Override
-    public String getName() {
-      return "Replace with <>";
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return "Replace with <>";
     }
 
     @Override
index ef9890c0e6545f92a32d90356a743f6290818684..c86d71191de25755ec2ad436704e5f149d6929d1 100644 (file)
@@ -587,16 +587,10 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
   }
 
   private static class ReplaceWithMethodRefFix implements LocalQuickFix {
-    @NotNull
-    @Override
-    public String getName() {
-      return "Replace lambda with method reference";
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return "Replace lambda with method reference";
     }
 
     @Override
index eb136dc4136f80a252e6e9e10556f0ee5b948c4d..cd8d9f319325dd9cd6ffaa37fb428a91b39b0ebe 100644 (file)
@@ -92,16 +92,10 @@ public class PossibleHeapPollutionVarargsInspection extends BaseJavaBatchLocalIn
   }
 
   private static class AnnotateAsSafeVarargsQuickFix implements LocalQuickFix {
-    @NotNull
-    @Override
-    public String getName() {
-      return "Annotate as @SafeVarargs";
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return "Annotate as @SafeVarargs";
     }
 
     @Override
@@ -117,16 +111,10 @@ public class PossibleHeapPollutionVarargsInspection extends BaseJavaBatchLocalIn
   }
 
   private static class MakeFinalAndAnnotateQuickFix implements LocalQuickFix {
-    @NotNull
-    @Override
-    public String getName() {
-      return "Make final and annotate as @SafeVarargs";
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return "Make final and annotate as @SafeVarargs";
     }
 
     @Override
index a05dd88c4700b42eec394e270df0070a02e89466..71425f84396e91eb4027cbcf83288ad4bb3b1880 100644 (file)
@@ -124,16 +124,10 @@ public class RedundantLambdaCodeBlockInspection extends BaseJavaBatchLocalInspec
   }
 
   private static class ReplaceWithExprFix implements LocalQuickFix, HighPriorityAction {
-    @NotNull
-    @Override
-    public String getName() {
-      return "Replace with expression lambda";
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return "Replace with expression lambda";
     }
 
     @Override
index 9899198be6aacfb0e82d61f2348523209b00245e..be605fa364cbd0b14482021b856a93afa75315eb 100644 (file)
@@ -40,7 +40,7 @@ public class RemoveAnnotationQuickFix implements LocalQuickFix {
 
   @Override
   @NotNull
-  public String getName() {
+  public String getFamilyName() {
     return CodeInsightBundle.message("remove.annotation");
   }
 
@@ -58,10 +58,4 @@ public class RemoveAnnotationQuickFix implements LocalQuickFix {
       ExternalAnnotationsManager.getInstance(project).deannotate(myListOwner, myAnnotation.getQualifiedName());
     }
   }
-
-  @Override
-  @NotNull
-  public String getFamilyName() {
-    return getName();
-  }
 }
\ No newline at end of file
index 5978a899105b040a796d835d7193a07aea2080fd..40edc3d4eacaa1f65bbfbce2d3679959505e02aa 100644 (file)
@@ -53,13 +53,6 @@ public class TrivialMethodReferenceInspection extends BaseJavaBatchLocalInspecti
   }
 
   private static class ReplaceMethodRefWithQualifierFix implements LocalQuickFix {
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @Nls
     @NotNull
     @Override
index 9ca3844e0987753a2b1d0e0b4ae6cb247ae64fbe..3b874fdfdc71e6b46ed8a5951df4a18ae0ec070c 100644 (file)
@@ -269,16 +269,10 @@ public class CanBeFinalInspection extends GlobalJavaBatchInspectionTool {
       myManager = manager;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return QUICK_FIX_NAME;
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
+      return QUICK_FIX_NAME;
     }
 
     @Override
index 15ea06538dbd1f294953ed338fff93acb5b7cc1a..29886f09a6b2a8ba591960edb9271ffe677abe8f 100644 (file)
@@ -29,12 +29,6 @@ public class RemoveElementQuickFix implements LocalQuickFix {
     myName = name;
   }
 
-  @NotNull
-  @Override
-  public String getName() {
-    return myName;
-  }
-
   @NotNull
   @Override
   public String getFamilyName() {
index 548e0dea874af3a530286f975abe71b5e5701247..d0b186572877d9143570e0f7e6cbf2a8b9e5c9f9 100644 (file)
@@ -833,7 +833,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
   private static class RedundantInstanceofFix implements LocalQuickFix {
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.data.flow.redundant.instanceof.quickfix");
     }
 
@@ -852,12 +852,6 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
         }
       }
     }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
   }
 
 
@@ -901,7 +895,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
     }
 
     Collection<PsiCall> getAlwaysFailingCalls() {
-      return StreamEx.of(myFailingCalls.keySet()).filter(this::isAlwaysFailing).map(MethodCallInstruction::getCallExpression).toList();
+      return StreamEx.ofKeys(myFailingCalls, v -> v).map(MethodCallInstruction::getCallExpression).toList();
     }
 
     @Override
@@ -911,7 +905,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
       DfaInstructionState[] states = super.visitMethodCall(instruction, runner, memState);
       if (hasNonTrivialFailingContracts(instruction)) {
         boolean allFail = Arrays.stream(states).allMatch(s -> s.getMemoryState().peek() == runner.getFactory().getConstFactory().getContractFail());
-        myFailingCalls.put(instruction, allFail && isAlwaysFailing(instruction));
+        myFailingCalls.merge(instruction, allFail, Boolean::logicalAnd);
       }
       return states;
     }
@@ -926,10 +920,6 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
              Arrays.stream(contract.arguments).anyMatch(v -> v != MethodContract.ValueConstraint.ANY_VALUE);
     }
 
-    private boolean isAlwaysFailing(MethodCallInstruction instruction) {
-      return !Boolean.FALSE.equals(myFailingCalls.get(instruction));
-    }
-
     @Override
     protected boolean checkNotNullable(DfaMemoryState state, DfaValue value, NullabilityProblem problem, PsiElement anchor) {
       boolean ok = super.checkNotNullable(state, value, problem, anchor);
index 6ce8055fd0aeadf2bf6e2535defd8d9a6546c154..866e6a6161c0b51825a2573f613ddbbd5ebf1b70 100644 (file)
@@ -100,13 +100,6 @@ public class DfaOptionalSupport {
       myClearArguments = clearArguments;
     }
 
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
index c94794c36ecdc8dc3288511664b89a023e33690f..c200adb7bd91b5ac2d700ce6cc0425a4520bc10a 100644 (file)
@@ -484,13 +484,6 @@ public class Java8CollectionsApiInspection extends BaseJavaBatchLocalInspectionT
   }
 
   private static class ReplaceWithListSortFix implements LocalQuickFix {
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @Nls
     @NotNull
     @Override
@@ -584,13 +577,6 @@ public class Java8CollectionsApiInspection extends BaseJavaBatchLocalInspectionT
   }
 
   private static class ReplaceWithRemoveIfQuickFix implements LocalQuickFix {
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @Nls
     @NotNull
     @Override
index a4d2ea70c7c1850c592f16747cf50be090f384a7..0a8c02246af9d77d522d48d7642cbaa99abc1f7c 100644 (file)
@@ -325,7 +325,7 @@ public class LocalCanBeFinal extends BaseJavaBatchLocalInspectionTool {
   private static class AcceptSuggested implements LocalQuickFix {
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.can.be.final.accept.quickfix");
     }
 
@@ -344,12 +344,6 @@ public class LocalCanBeFinal extends BaseJavaBatchLocalInspectionTool {
         LOG.error(e);
       }
     }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
   }
 
   @Override
index 896f1061f6e19898f235d38f3769ec5d2dd63969..01d79e175996ca3dfd3e87001fc99ecbca378841 100644 (file)
@@ -167,7 +167,7 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
   private static class MyQuickFixAction implements LocalQuickFix {
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.redundant.type.remove.quickfix");
     }
 
@@ -186,12 +186,6 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
         LOG.error(e);
       }
     }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
   }
 
   //separate quickfix is needed to invalidate initial method reference
@@ -199,7 +193,7 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
   private static class MyMethodReferenceFixAction implements LocalQuickFix {
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.redundant.type.remove.quickfix");
     }
 
@@ -212,11 +206,5 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
         expression.replace(createMethodReference(expression, typeElement));
       }
     }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
   }
 }
index aa3f0d087de8a39fdd64bd56f6c987bb2f92d888..237f227c4aa3aee648fc986a30374192233c4af9 100644 (file)
@@ -43,16 +43,10 @@ class ChangeNullableDefaultsFix implements LocalQuickFix {
     myNullableName = nullable;
   }
 
-  @NotNull
-  @Override
-  public String getName() {
-    return "Make \"" + (myNotNullName != null ? myNotNullName : myNullableName) + "\" default annotation";
-  }
-
   @NotNull
   @Override
   public String getFamilyName() {
-    return getName();
+    return "Make \"" + (myNotNullName != null ? myNotNullName : myNullableName) + "\" default annotation";
   }
 
   @Override
index fadb67ca50ca57e886282eced8c8613adb232429..c4b07295251053844e63526a95203266d5281d5e 100644 (file)
@@ -133,7 +133,7 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
   private static class AcceptSuggested implements LocalQuickFix {
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.redundant.cast.remove.quickfix");
     }
 
@@ -146,12 +146,6 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
         RedundantCastUtil.removeCast(cast);
       }
     }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
   }
 
   @Override
index 4dd254602a3ee17db8c33ed2a72aee13f37c5882..c4b333a19542bc1b130ec338d17e3a36774b36ab 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.FileModificationService;
 import com.intellij.codeInspection.LambdaCanBeMethodReferenceInspection;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.InitializerUsageStatus;
 import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.Operation;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
@@ -72,14 +73,13 @@ abstract class MigrateToStreamFix implements LocalQuickFix {
                                          PsiType expressionType) {
     PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
     restoreComments(foreachStatement, foreachStatement.getBody());
-    if (StreamApiMigrationInspection.isDeclarationJustBefore(var, foreachStatement)) {
+    InitializerUsageStatus status = StreamApiMigrationInspection.getInitializerUsageStatus(var, foreachStatement);
+    if (status != InitializerUsageStatus.UNKNOWN) {
       PsiExpression initializer = var.getInitializer();
       if (ExpressionUtils.isZero(initializer)) {
         PsiType type = var.getType();
         String replacement = (type.equals(expressionType) ? "" : "(" + type.getCanonicalText() + ") ") + builder;
-        initializer.replace(elementFactory.createExpressionFromText(replacement, foreachStatement));
-        removeLoop(foreachStatement);
-        simplifyAndFormat(project, var);
+        replaceInitializer(foreachStatement, var, initializer, replacement, status);
         return;
       }
     }
@@ -88,6 +88,27 @@ abstract class MigrateToStreamFix implements LocalQuickFix {
     simplifyAndFormat(project, result);
   }
 
+  static void replaceInitializer(PsiForeachStatement foreachStatement,
+                                 PsiVariable var,
+                                 PsiExpression initializer,
+                                 String replacement,
+                                 InitializerUsageStatus status) {
+    Project project = foreachStatement.getProject();
+    PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
+    if(status == InitializerUsageStatus.DECLARED_JUST_BEFORE) {
+      initializer.replace(elementFactory.createExpressionFromText(replacement, foreachStatement));
+      removeLoop(foreachStatement);
+      simplifyAndFormat(project, var);
+    } else {
+      if(status == InitializerUsageStatus.AT_WANTED_PLACE_ONLY) {
+        initializer.delete();
+      }
+      PsiElement result =
+        foreachStatement.replace(elementFactory.createStatementFromText(var.getName() + " = " + replacement + ";", foreachStatement));
+      simplifyAndFormat(project, result);
+    }
+  }
+
   static void simplifyAndFormat(@NotNull Project project, PsiElement result) {
     if (result == null) return;
     LambdaCanBeMethodReferenceInspection.replaceAllLambdasWithMethodReferences(result);
index ba04d8dc5f903f7336e626d279126e1ec0c6de6a..e092bdb21f79ff4e67397a3b05bc1843b86c78ec 100644 (file)
@@ -16,7 +16,9 @@
 package com.intellij.codeInspection.streamMigration;
 
 import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.InitializerUsageStatus;
 import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.Operation;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
@@ -32,6 +34,8 @@ import java.util.List;
  * @author Tagir Valeev
  */
 class ReplaceWithCollectFix extends MigrateToStreamFix {
+  private static final Logger LOG = Logger.getInstance(ReplaceWithCollectFix.class);
+
   final String myMethodName;
 
   protected ReplaceWithCollectFix(String methodName) {
@@ -87,16 +91,18 @@ class ReplaceWithCollectFix extends MigrateToStreamFix {
     final StringBuilder builder = generateStream(iteratedValue, operations);
 
     final PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression();
-    final PsiExpression initializer = StreamApiMigrationInspection
-      .extractReplaceableCollectionInitializer(qualifierExpression, foreachStatement);
-    if (initializer != null) {
-      String callText = builder.append(".collect(java.util.stream.Collectors.")
-        .append(createInitializerReplacementText(qualifierExpression.getType(), initializer))
-        .append(")").toString();
-      PsiElement result = initializer.replace(elementFactory.createExpressionFromText(callText, null));
-      simplifyAndFormat(project, result);
-      removeLoop(foreachStatement);
-      return;
+    final PsiLocalVariable variable = StreamApiMigrationInspection.extractCollectionVariable(qualifierExpression);
+    if (variable != null) {
+      InitializerUsageStatus status = StreamApiMigrationInspection.getInitializerUsageStatus(variable, foreachStatement);
+      if(status != InitializerUsageStatus.UNKNOWN) {
+        PsiExpression initializer = variable.getInitializer();
+        LOG.assertTrue(initializer != null);
+        String callText = builder.append(".collect(java.util.stream.Collectors.")
+          .append(createInitializerReplacementText(qualifierExpression.getType(), initializer))
+          .append(")").toString();
+        replaceInitializer(foreachStatement, variable, initializer, callText, status);
+        return;
+      }
     }
     final String qualifierText = qualifierExpression != null ? qualifierExpression.getText() + "." : "";
 
index 0579ba2557b1b20df3c43165e06b7b445911450d..6eb0e9c86301e0969dff20253ae70c31a40f741d 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.codeInspection.streamMigration;
 
 import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.InitializerUsageStatus;
 import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.Operation;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
@@ -76,13 +77,12 @@ class ReplaceWithFindFirstFix extends MigrateToStreamFix {
       PsiExpression value = assignment.getRExpression();
       if (value == null) return;
       restoreComments(foreachStatement, body);
-      if (StreamApiMigrationInspection.isDeclarationJustBefore(var, foreachStatement)) {
+      InitializerUsageStatus status = StreamApiMigrationInspection.getInitializerUsageStatus(var, foreachStatement);
+      if (status != InitializerUsageStatus.UNKNOWN) {
         PsiExpression initializer = var.getInitializer();
         if (initializer != null) {
-          PsiElement result =
-            initializer.replace(elementFactory.createExpressionFromText(generateOptionalUnwrap(stream, tb, value, initializer), initializer));
-          removeLoop(foreachStatement);
-          simplifyAndFormat(project, result);
+          String replacementText = generateOptionalUnwrap(stream, tb, value, initializer);
+          replaceInitializer(foreachStatement, var, initializer, replacementText, status);
           return;
         }
       }
index 0488e0e14cfd74da9548237b3d4677a260309406..5435eee33752814bfd34041dcfce020aa09dfcb2 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.codeInspection.streamMigration;
 
 import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.InitializerUsageStatus;
 import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.Operation;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
@@ -93,7 +94,8 @@ class ReplaceWithMatchFix extends MigrateToStreamFix {
           // for(....) if(...) {flag = true; break;}
           PsiVariable var = (PsiVariable)maybeVar;
           PsiExpression initializer = var.getInitializer();
-          if(initializer != null && StreamApiMigrationInspection.isDeclarationJustBefore(var, foreachStatement)) {
+          InitializerUsageStatus status = StreamApiMigrationInspection.getInitializerUsageStatus(var, foreachStatement);
+          if(initializer != null && status != InitializerUsageStatus.UNKNOWN) {
             String replacement;
             if(ExpressionUtils.isLiteral(initializer, Boolean.FALSE) &&
                ExpressionUtils.isLiteral(rValue, Boolean.TRUE)) {
@@ -104,9 +106,7 @@ class ReplaceWithMatchFix extends MigrateToStreamFix {
             } else {
               replacement = streamText + "?" + rValue.getText() + ":" + initializer.getText();
             }
-            PsiElement result = initializer.replace(elementFactory.createExpressionFromText(replacement, initializer));
-            removeLoop(foreachStatement);
-            simplifyAndFormat(project, result);
+            replaceInitializer(foreachStatement, var, initializer, replacement, status);
             return;
           }
         }
index aad571a9b6fa1c838444550bd575ba5d8178d2df..1e3bb608c47b97fea471d3d971d84dc499738253 100644 (file)
@@ -49,6 +49,8 @@ import org.jetbrains.annotations.Nullable;
 import javax.swing.*;
 import java.util.*;
 
+import static com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.InitializerUsageStatus.*;
+
 /**
  * User: anna
  */
@@ -377,19 +379,17 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
     return consumerClass != null ? psiFacade.getElementFactory().createType(consumerClass, variable.getType()) : null;
   }
 
-  @Contract("null, _ -> null")
-  static PsiExpression extractReplaceableCollectionInitializer(PsiExpression qualifierExpression, PsiStatement foreachStatement) {
+  @Contract("null -> null")
+  static PsiLocalVariable extractCollectionVariable(PsiExpression qualifierExpression) {
     if (qualifierExpression instanceof PsiReferenceExpression) {
       final PsiElement resolve = ((PsiReferenceExpression)qualifierExpression).resolve();
       if (resolve instanceof PsiLocalVariable) {
         PsiLocalVariable var = (PsiLocalVariable)resolve;
-        if (isDeclarationJustBefore(var, foreachStatement)) {
-          final PsiExpression initializer = var.getInitializer();
-          if (initializer instanceof PsiNewExpression) {
-            final PsiExpressionList argumentList = ((PsiNewExpression)initializer).getArgumentList();
-            if (argumentList != null && argumentList.getExpressions().length == 0) {
-              return initializer;
-            }
+        final PsiExpression initializer = var.getInitializer();
+        if (initializer instanceof PsiNewExpression) {
+          final PsiExpressionList argumentList = ((PsiNewExpression)initializer).getArgumentList();
+          if (argumentList != null && argumentList.getExpressions().length == 0) {
+            return var;
           }
         }
       }
@@ -397,6 +397,40 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
     return null;
   }
 
+  enum InitializerUsageStatus {
+    // Variable is declared just before the wanted place
+    DECLARED_JUST_BEFORE,
+    // All initial value usages go through wanted place and at wanted place the variable value is guaranteed to be the initial value
+    AT_WANTED_PLACE_ONLY,
+    // At wanted place the variable value is guaranteed to be the initial value, but this initial value might be used somewhere else
+    AT_WANTED_PLACE,
+    // It's not guaranteed that the variable value at wanted place is initial value
+    UNKNOWN
+  }
+
+  static InitializerUsageStatus getInitializerUsageStatus(PsiVariable var, PsiStatement nextStatement) {
+    if(var.getInitializer() == null) return UNKNOWN;
+    if(isDeclarationJustBefore(var, nextStatement)) return DECLARED_JUST_BEFORE;
+    PsiElement declaration = var.getParent();
+    // Check if variable is not referenced in the same declaration like "int a = 0, b = a;"
+    if(!PsiTreeUtil.processElements(declaration, e -> !(e instanceof PsiReferenceExpression) ||
+                                                  ((PsiReferenceExpression)e).resolve() != var)) return UNKNOWN;
+    PsiElement block = PsiUtil.getVariableCodeBlock(var, null);
+    if(block == null) return UNKNOWN;
+    final ControlFlow controlFlow;
+    try {
+      controlFlow = ControlFlowFactory.getInstance(nextStatement.getProject())
+        .getControlFlow(block, LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance());
+    }
+    catch (AnalysisCanceledException ignored) {
+      return UNKNOWN;
+    }
+    int start = controlFlow.getEndOffset(declaration);
+    int stop = controlFlow.getStartOffset(nextStatement);
+    if(ControlFlowUtil.isVariableReferencedBetween(controlFlow, start, stop, var)) return UNKNOWN;
+    return ControlFlowUtil.isValueUsedWithoutVisitingStop(controlFlow, start, stop, var) ? AT_WANTED_PLACE : AT_WANTED_PLACE_ONLY;
+  }
+
   static boolean isDeclarationJustBefore(PsiVariable var, PsiStatement nextStatement) {
     PsiElement declaration = var.getParent();
     PsiElement nextStatementParent = nextStatement.getParent();
@@ -482,8 +516,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
             methodName = "addAll";
           } else {
             PsiMethodCallExpression methodCallExpression = tb.getSingleMethodCall();
-            if(methodCallExpression != null && extractReplaceableCollectionInitializer(
-              methodCallExpression.getMethodExpression().getQualifierExpression(), statement) != null) {
+            if(canCollect(statement, methodCallExpression)) {
               methodName = "collect";
             } else {
               if (!SUGGEST_FOREACH) return;
@@ -535,13 +568,19 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
       }
     }
 
-    void handleSingleReturn(PsiForeachStatement statement,
-                            TerminalBlock tb,
-                            List<Operation> operations) {
+    boolean canCollect(PsiForeachStatement statement, PsiMethodCallExpression methodCallExpression) {
+      if(methodCallExpression == null) return false;
+      PsiLocalVariable variable = extractCollectionVariable(methodCallExpression.getMethodExpression().getQualifierExpression());
+      if(variable == null) return false;
+      return getInitializerUsageStatus(variable, statement) != UNKNOWN;
+    }
+
+    void handleSingleReturn(PsiForeachStatement statement, TerminalBlock tb, List<Operation> operations) {
       PsiReturnStatement returnStatement = (PsiReturnStatement)tb.getSingleStatement();
       PsiExpression value = returnStatement.getReturnValue();
       PsiReturnStatement nextReturnStatement = getNextReturnStatement(statement);
-      if(nextReturnStatement != null && (ExpressionUtils.isLiteral(value, Boolean.TRUE) || ExpressionUtils.isLiteral(value, Boolean.FALSE))) {
+      if (nextReturnStatement != null &&
+          (ExpressionUtils.isLiteral(value, Boolean.TRUE) || ExpressionUtils.isLiteral(value, Boolean.FALSE))) {
         boolean foundResult = (boolean)((PsiLiteralExpression)value).getValue();
         if(ExpressionUtils.isLiteral(nextReturnStatement.getReturnValue(), !foundResult)) {
           String methodName;
index fa63230009c9b18c44a942836480f1b2d896cddb..f2198709ad8e9a7e952ede6b7f945ade47460c57 100644 (file)
@@ -156,16 +156,10 @@ public class UnnecessaryModuleDependencyInspection extends GlobalInspectionTool
       myDependency = dependency;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return "Remove dependency";
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
+      return "Remove dependency";
     }
 
     @Override
index be7c4c43d3af8695c605891fd3b52a687cc3f3de..4cb330bb8315df5addf6ef7db08e8fb9556dd4d7 100644 (file)
@@ -201,7 +201,7 @@ public class RedundantThrows extends GlobalJavaBatchInspectionTool {
 
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.redundant.throws.remove.quickfix");
     }
 
@@ -225,12 +225,6 @@ public class RedundantThrows extends GlobalJavaBatchInspectionTool {
       }
     }
 
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
-
     private void removeExcessiveThrows(@Nullable RefMethod refMethod, @Nullable final PsiModifierListOwner element, final CommonProblemDescriptor[] problems) {
       try {
         @Nullable final PsiMethod psiMethod;
index 55ab95f5c3a7aef213e71ef2beadbeae11ed1010..6147a0d7ea5b9a22e1cab06335936bfaf07092d3 100644 (file)
@@ -131,16 +131,10 @@ public class UnusedLibrariesInspection extends GlobalInspectionTool {
       myFiles = files;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return myFiles == null ? InspectionsBundle.message("detach.library.quickfix.name") : InspectionsBundle.message("detach.library.roots.quickfix.name");
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
+      return myFiles == null ? InspectionsBundle.message("detach.library.quickfix.name") : InspectionsBundle.message("detach.library.roots.quickfix.name");
     }
 
     @Override
index 28702654c80d88d3fbb8597e22dd6413bc27b8ee..4cd827d635d1d080dddd63a40f73f5400b398309 100644 (file)
@@ -47,7 +47,7 @@ import java.util.List;
 import java.util.regex.Pattern;
 
 class ExcludeTable extends ListTableWithButtons<ExcludeTable.Item> {
-  private static final Pattern ourPackagePattern = Pattern.compile("(\\w+\\.)*\\w+");
+  private static final Pattern ourPackagePattern = Pattern.compile("([\\w*]+\\.)*[\\w*]+");
   private static final ColumnInfo<Item, String> NAME_COLUMN = new ColumnInfo<Item, String>("Class/package/member qualified name mask") {
     @Nullable
     @Override
index 09b57555cd23cb10b00a72e38f9db45f451a282a..065527c5564232eceb979dd263dcf7219b880556 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.codeInsight.template.impl.TemplateImpl;
 import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
 import com.intellij.codeInsight.template.impl.TemplateState;
 import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.event.DocumentAdapter;
@@ -288,7 +289,8 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
         TextRange endRange = templateState.getVariableRange(template.getVariableNameAt(template.getVariableCount() - 1));
         if (startRange == null || endRange == null) return;
 
-        editor.getDocument().deleteString(startRange.getStartOffset(), endRange.getEndOffset());
+        WriteCommandAction.runWriteCommandAction(editor.getProject(), () ->
+          editor.getDocument().deleteString(startRange.getStartOffset(), endRange.getEndOffset()));
       }
     });
   }
index cdaa2aad68ff1c5bdddb3f063ccc4982ad08edfc..cb81d23a378de25cffb63c31720909ba00c678ea 100644 (file)
@@ -33,12 +33,6 @@ public class CreateStaticMethodQuickFix implements LocalQuickFix {
   }
 
 
-  @NotNull
-  @Override
-  public String getName() {
-    return QuickFixBundle.message("create.method.from.usage.family");
-  }
-
   @NotNull
   @Override
   public String getFamilyName() {
index 07f31972f482ad2f2abecd10f28d060186285006..b6fec5cbe2946fe208b21f7c87e51c96998ee391 100644 (file)
@@ -70,12 +70,6 @@ public class CreateFieldOrPropertyFix implements IntentionAction, LocalQuickFix
     return QuickFixBundle.message(myMemberType == PropertyMemberType.FIELD ? "create.field.text":"create.property.text", myName);
   }
 
-  @Override
-  @NotNull
-  public String getName() {
-    return getText();
-  }
-
   @Override
   @NotNull
   public String getFamilyName() {
index 283bc4f050abcff9417d699114bd7a57982774b3..27c4e6958bf55b6b160b40507e01bafa9970ed0d 100644 (file)
@@ -239,13 +239,6 @@ public class CollectionAddAllCanBeReplacedWithConstructorInspection extends Base
       myAssignmentExpression = smartPointerManager.createSmartPsiElementPointer(assignmentExpression);
     }
 
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
index 5fa4f4285051a2dd9736f5602f7fa88d153ada0c..1f8caf6565ed9251fa2ef4220a11611ac987c96d 100644 (file)
@@ -42,18 +42,11 @@ public class DefaultAnnotationParamInspection extends BaseJavaBatchLocalInspecti
         if (defaultValue == null) return;
         if (areEqual(value, defaultValue)) {
           holder.registerProblem(value, "Redundant default parameter value assignment", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new LocalQuickFix() {
-            @Nls
-            @NotNull
-            @Override
-            public String getName() {
-              return "Remove redundant parameter";
-            }
-
             @Nls
             @NotNull
             @Override
             public String getFamilyName() {
-              return getName();
+              return "Remove redundant parameter";
             }
 
             @Override
index 3a5da370be6746105caa6154ef35694801fc738d..6ffd46aca6df5a53bd8eb8a44f03585a373b7b07 100644 (file)
@@ -36,7 +36,7 @@ public class RemoveInitializerFix implements LocalQuickFix {
 
   @Override
   @NotNull
-  public String getName() {
+  public String getFamilyName() {
     return InspectionsBundle.message("inspection.unused.assignment.remove.quickfix");
   }
 
@@ -91,10 +91,4 @@ public class RemoveInitializerFix implements LocalQuickFix {
       LOG.error(e);
     }
   }
-  
-  @Override
-  @NotNull
-  public String getFamilyName() {
-    return getName();
-  }
 }
index f06ba2a958cfeb410840bde6304cbc5e817c2594..53340a90d5b63beecdbedd4230dd941d1a25b75e 100644 (file)
@@ -210,16 +210,10 @@ class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
       return myHint;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return InspectionsBundle.message("inspection.unused.parameter.delete.quickfix");
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
+      return InspectionsBundle.message("inspection.unused.parameter.delete.quickfix");
     }
 
     @Override
index e0927704d563b07163d28d2e60dc1574795220c1..58cbd1d85fc45b3f51729a4ef08c109e65a26c13 100644 (file)
@@ -84,16 +84,10 @@ public class DefaultFileTemplateUsageInspection extends BaseJavaLocalInspectionT
       myReplaceTemplateFix = replaceTemplateFix;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return InspectionsBundle.message("default.file.template.edit.template");
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
+      return InspectionsBundle.message("default.file.template.edit.template");
     }
 
     @Override
index d13986e35a1afb0c545a642a6b70c634c965cc5c..99ded0b3b8339158d2f93700eb121decbcc90926 100644 (file)
@@ -23,15 +23,9 @@ import org.jetbrains.annotations.NotNull;
  * @author cdr
  */
 public abstract class ReplaceWithFileTemplateFix implements LocalQuickFix {
-  @Override
-  @NotNull
-  public String getName() {
-    return InspectionsBundle.message("default.file.template.replace.with.actual.file.template");
-  }
-
   @Override
   @NotNull
   public String getFamilyName() {
-    return getName();
+    return InspectionsBundle.message("default.file.template.replace.with.actual.file.template");
   }
 }
index 6a108d6ed4a5b96a76e4a61e0bf5079fda58f5c9..fbb22e5dca2c96b267a7b586fd0cd1fe2cc2e38f 100644 (file)
@@ -307,12 +307,6 @@ public class EmptyMethodInspection extends GlobalJavaBatchInspectionTool {
       myHint = hint;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return QUICK_FIX_NAME;
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
@@ -352,7 +346,7 @@ public class EmptyMethodInspection extends GlobalJavaBatchInspectionTool {
 
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return QUICK_FIX_NAME;
     }
 
@@ -361,12 +355,6 @@ public class EmptyMethodInspection extends GlobalJavaBatchInspectionTool {
        applyFix(project, new ProblemDescriptor[]{descriptor}, new ArrayList<>(), null);
     }
 
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
-
     private void deleteHierarchy(RefMethod refMethod, List<PsiElement> result) {
       Collection<RefMethod> derivedMethods = refMethod.getDerivedMethods();
       RefMethod[] refMethods = derivedMethods.toArray(new RefMethod[derivedMethods.size()]);
index 3887640051c4cde85c1058c13a65d68a1de2a42c..c315401c6ceb6c7a19262b04929de4967930da0e 100644 (file)
@@ -47,18 +47,12 @@ public class EqualsAndHashcode extends EqualsAndHashcodeBase {
 
     @NotNull
     @Override
-    public String getName() {
+    public String getFamilyName() {
       return myHasEquals
              ? InspectionsBundle.message("inspection.equals.hashcode.generate.hashcode.quickfix")
              : InspectionsBundle.message("inspection.equals.hashcode.generate.equals.quickfix");
     }
 
-    @NotNull
-    @Override
-    public String getFamilyName() {
-      return getName();
-    }
-
     @Override
     public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
       final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
index e08c66fa943b317c9036cf4cbeffb97595523618..8fce942f902370d8cd068e20cd92e5071f39382f 100644 (file)
@@ -114,13 +114,6 @@ public class StaticPseudoFunctionalStyleMethodInspection extends BaseJavaBatchLo
       myHandler = handler;
     }
 
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @NotNull
     @Override
     public String getFamilyName() {
index 816a191b3a6b860ac0d372752c3b1c7a837d1be0..e9b2536eac18dd55dad22cbd09772914cd47e77f 100644 (file)
@@ -69,16 +69,10 @@ public class JavaDocReferenceInspection extends JavaDocReferenceInspectionBase {
       myUnboundParams = unboundParams;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return "Change to ...";
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
+      return "Change to ...";
     }
 
     @Override
@@ -114,12 +108,6 @@ public class JavaDocReferenceInspection extends JavaDocReferenceInspectionBase {
       this.originalClasses = originalClasses;
     }
 
-    @Override
-    @NotNull
-    public String getName() {
-      return QuickFixBundle.message("add.qualifier");
-    }
-
     @Override
     @NotNull
     public String getFamilyName() {
index b925e8ff80836f3b043f9d7eda9fb568919da012..28b4bf9fb5109fc8fa2b105cc023dddee7409a0a 100644 (file)
@@ -129,13 +129,6 @@ public class RedundantLambdaParameterTypeInspection extends BaseJavaBatchLocalIn
   }
 
   private static class LambdaParametersFix implements LocalQuickFix {
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return getFamilyName();
-    }
-
     @Nls
     @NotNull
     @Override
index 2d84ba4350a0486a318f0323003bfa14fb4ecf55..6cc93d4cd16537a9bec10780965adfa1f8bb2f13 100644 (file)
@@ -203,16 +203,10 @@ public class MagicConstantInspection extends BaseJavaLocalInspectionTool {
     String text = "No IDEA annotations attached to the JDK " + finalJdk.getName() + (path == null ? "" : " (" + FileUtil.toSystemDependentName(path) + ")")
                   +", some issues will not be found";
     holder.registerProblem(file, text, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new LocalQuickFix() {
-      @NotNull
-      @Override
-      public String getName() {
-        return "Attach annotations";
-      }
-
       @NotNull
       @Override
       public String getFamilyName() {
-        return getName();
+        return "Attach annotations";
       }
 
       @Override
index ad340fb68355178422d3f5969a2f7ac368fabc1c..d7ab946a7ed737f3e0a7854d35e54657599f9585 100644 (file)
@@ -54,12 +54,6 @@ public class RedundantArrayForVarargsCallInspection extends GenericsInspectionTo
     @Override
     @NotNull
     public String getFamilyName() {
-      return getName();
-    }
-
-    @Override
-    @NotNull
-    public String getName() {
       return InspectionsBundle.message("inspection.redundant.array.creation.quickfix");
     }
   }
index 69c88c46a6d4b029081764d6f9af4ab48f6d1703..26af65fb83bdc60bfcd243d6dcaa5c054c8fcd93 100644 (file)
@@ -45,18 +45,11 @@ public class SillyAssignmentInspection extends SillyAssignmentInspectionBase {
 
   private static class RemoveSillyAssignmentFix implements LocalQuickFix {
 
-    @Nls
-    @NotNull
-    @Override
-    public String getName() {
-      return InspectionsBundle.message("assignment.to.itself.quickfix.name");
-    }
-
     @Nls
     @NotNull
     @Override
     public String getFamilyName() {
-      return getName();
+      return InspectionsBundle.message("assignment.to.itself.quickfix.name");
     }
 
     @Override
index f0b92e20c6661c0123885991a64397b8928c2781..f295d2361d9cc820103768df72811a221d6e23dc 100644 (file)
@@ -154,7 +154,7 @@ public class UnusedReturnValue extends GlobalJavaBatchInspectionTool{
 
     @Override
     @NotNull
-    public String getName() {
+    public String getFamilyName() {
       return InspectionsBundle.message("inspection.unused.return.value.make.void.quickfix");
     }
 
@@ -179,12 +179,6 @@ public class UnusedReturnValue extends GlobalJavaBatchInspectionTool{
       return false;
     }
 
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
-
     private static void makeMethodHierarchyVoid(Project project, @NotNull PsiMethod psiMethod) {
       replaceReturnStatements(psiMethod);
       for (final PsiMethod oMethod : OverridingMethodsSearch.search(psiMethod)) {
index c993cc143b6e1aac2fbd9f1f79dc83caee596a2e..69a70e61654644c1393ff4ccae9d2c4abe3d2b16 100644 (file)
@@ -50,7 +50,7 @@ public abstract class BaseConvertToLocalQuickFix<V extends PsiVariable> implemen
 
   @Override
   @NotNull
-  public final String getName() {
+  public final String getFamilyName() {
     return InspectionsBundle.message("inspection.convert.to.local.quickfix");
   }
 
@@ -225,12 +225,6 @@ public abstract class BaseConvertToLocalQuickFix<V extends PsiVariable> implemen
     }
   }
 
-  @Override
-  @NotNull
-  public String getFamilyName() {
-    return getName();
-  }
-
   @Nullable
   private static PsiElement getAnchorElement(PsiCodeBlock anchorBlock, @NotNull PsiElement firstElement) {
     PsiElement element = firstElement;
index e8687987042c746ea75f57a3b3ecd440184167a2..a88239d002fac491144913319b2a00aab67ba499 100644 (file)
@@ -549,13 +549,24 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
 
   @Nullable
   public static String generateExternalJavadoc(@NotNull final PsiElement element) {
+    List<String> docURLs = getExternalJavaDocUrl(element);
+    return generateExternalJavadoc(element, docURLs);
+  }
+
+  @Nullable
+  public static String generateExternalJavadoc(@NotNull final PsiElement element, @Nullable List<String> docURLs) {
     final JavaDocInfoGenerator javaDocInfoGenerator = JavaDocInfoGeneratorFactory.create(element.getProject(), element);
-    return generateExternalJavadoc(element, javaDocInfoGenerator);
+    return generateExternalJavadoc(javaDocInfoGenerator, docURLs);
   }
 
   @Nullable
   public static String generateExternalJavadoc(@NotNull final PsiElement element, @NotNull JavaDocInfoGenerator generator) {
     final List<String> docURLs = getExternalJavaDocUrl(element);
+    return generateExternalJavadoc(generator, docURLs);
+  }
+
+  @Nullable
+  private static String generateExternalJavadoc(@NotNull JavaDocInfoGenerator generator, @Nullable List<String> docURLs) {
     return JavaDocExternalFilter.filterInternalDocInfo(generator.generateDocInfo(docURLs));
   }
 
index c3e0295e3e0388ed88c9db7e41056247c2ca7f3a..15ccb80fa2b081296638acb89e3ec1c2a5f5c887 100644 (file)
@@ -101,12 +101,17 @@ public class ReferenceChainLink {
       PsiPackage pkg = JavaPsiFacade.getInstance(project).findPackage(referenceName);
       if (pkg != null && pkg.getDirectories(scope).length > 0) return null;
 
-      if (!cache.processFieldsWithName(referenceName, processor, scope, null) ||
-          !cache.processClassesWithName(referenceName, processor, scope, null)) {
+      if (!cache.processFieldsWithName(referenceName, processor, scope, null)) {
         markExpensive(project);
         return null;
       }
     }
+
+    if (!cache.processClassesWithName(referenceName, processor, scope, null)) {
+      markExpensive(project);
+      return null;
+    }
+
     return candidates;
   }
 
index 38ece57ff05e80c905f7f3852f6af766b0ee8abf..a60752e623601b83f825f38679a0c367d800a19f 100644 (file)
@@ -24,10 +24,7 @@ import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
 import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.util.*;
-import com.intellij.util.Consumer;
-import com.intellij.util.Function;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Producer;
+import com.intellij.util.*;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.Contract;
@@ -122,8 +119,7 @@ public class LambdaUtil {
   public static boolean isFunctionalClass(PsiClass aClass) {
     if (aClass != null) {
       if (aClass instanceof PsiTypeParameter) return false;
-      final List<HierarchicalMethodSignature> signatures = findFunctionCandidates(aClass);
-      return signatures != null && signatures.size() == 1;
+      return getFunction(aClass) != null;
     }
     return false;
   }
@@ -152,15 +148,69 @@ public class LambdaUtil {
 
   @Contract("null -> null")
   @Nullable
-  public static MethodSignature getFunction(PsiClass psiClass) {
-    if (psiClass == null) return null;
-    final List<HierarchicalMethodSignature> functions = findFunctionCandidates(psiClass);
-    if (functions != null && functions.size() == 1) {
-      return functions.get(0);
+  public static MethodSignature getFunction(final PsiClass psiClass) {
+    if (isPlainInterface(psiClass)) {
+      return CachedValuesManager.getCachedValue(psiClass, new CachedValueProvider<MethodSignature>() {
+        @Nullable
+        @Override
+        public Result<MethodSignature> compute() {
+          return Result.create(calcFunction(psiClass), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
+        }
+      });
     }
     return null;
   }
 
+  private static boolean isPlainInterface(PsiClass psiClass) {
+    return psiClass != null && psiClass.isInterface() && !psiClass.isAnnotationType();
+  }
+
+  @Nullable
+  private static MethodSignature calcFunction(@NotNull PsiClass psiClass) {
+    if (hasManyOwnAbstractMethods(psiClass) || hasManyInheritedAbstractMethods(psiClass)) return null;
+
+    final List<HierarchicalMethodSignature> functions = findFunctionCandidates(psiClass);
+    return functions != null && functions.size() == 1 ? functions.get(0) : null;
+  }
+
+  private static boolean hasManyOwnAbstractMethods(@NotNull PsiClass psiClass) {
+    int abstractCount = 0;
+    for (PsiMethod method : psiClass.getMethods()) {
+      if (isDefinitelyAbstractInterfaceMethod(method) && ++abstractCount > 1) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private static boolean isDefinitelyAbstractInterfaceMethod(PsiMethod method) {
+    return method.hasModifierProperty(PsiModifier.ABSTRACT) && !isPublicObjectMethod(method.getName());
+  }
+
+  private static boolean isPublicObjectMethod(String methodName) {
+    return "equals".equals(methodName) || "hashCode".equals(methodName) || "toString".equals(methodName);
+  }
+
+  private static boolean hasManyInheritedAbstractMethods(@NotNull PsiClass psiClass) {
+    final Set<String> abstractNames = ContainerUtil.newHashSet();
+    final Set<String> defaultNames = ContainerUtil.newHashSet();
+    InheritanceUtil.processSupers(psiClass, true, new Processor<PsiClass>() {
+      @Override
+      public boolean process(PsiClass psiClass) {
+        for (PsiMethod method : psiClass.getMethods()) {
+          if (isDefinitelyAbstractInterfaceMethod(method)) {
+            abstractNames.add(method.getName());
+          }
+          else if (method.hasModifierProperty(PsiModifier.DEFAULT)) {
+            defaultNames.add(method.getName());
+          }
+        }
+        return true;
+      }
+    });
+    abstractNames.removeAll(defaultNames);
+    return abstractNames.size() > 1;
+  }
 
   private static boolean overridesPublicObjectMethod(HierarchicalMethodSignature psiMethod) {
     final List<HierarchicalMethodSignature> signatures = psiMethod.getSuperSignatures();
@@ -219,20 +269,9 @@ public class LambdaUtil {
 
   @Contract("null -> null")
   @Nullable
-  public static List<HierarchicalMethodSignature> findFunctionCandidates(final PsiClass psiClass) {
-    if (psiClass != null && psiClass.isInterface() && !psiClass.isAnnotationType()) {
-      return CachedValuesManager.getCachedValue(psiClass, new CachedValueProvider<List<HierarchicalMethodSignature>>() {
-        @Nullable
-        @Override
-        public Result<List<HierarchicalMethodSignature>> compute() {
-          return Result.create(calcFunctionCandidates(psiClass), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
-        }
-      });
-    }
-    return null;
-  }
+  public static List<HierarchicalMethodSignature> findFunctionCandidates(@Nullable final PsiClass psiClass) {
+    if (!isPlainInterface(psiClass)) return null;
 
-  private static List<HierarchicalMethodSignature> calcFunctionCandidates(PsiClass psiClass) {
     final List<HierarchicalMethodSignature> methods = new ArrayList<HierarchicalMethodSignature>();
     final Map<MethodSignature, Set<PsiMethod>> overrideEquivalents = PsiSuperMethodUtil.collectOverrideEquivalents(psiClass);
     final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
index 11f3f622b2056d9e34f252f5d975622ffb3f7dcd..7063b26b5e74442db4c03fac30a89ef8798991d0 100644 (file)
@@ -26,6 +26,7 @@ public interface PsiJavaModule extends NavigatablePsiElement, PsiNamedElement, P
   String MODULE_INFO_CLASS = "module-info";
   String MODULE_INFO_FILE = MODULE_INFO_CLASS + ".java";
   String MODULE_INFO_CLS_FILE = MODULE_INFO_CLASS + ".class";
+  String JAVA_BASE = "java.base";
 
   @NotNull PsiJavaModuleReferenceElement getNameElement();
   @NotNull String getModuleName();
index 4b08e3e094a6167afc9c35589742a5cfe14815a5..ddab945cff0f1fda71eddd2e5de68acacd9eb20c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import com.intellij.util.containers.IntArrayList;
 import com.intellij.util.containers.IntStack;
 import gnu.trove.THashMap;
 import gnu.trove.THashSet;
+import gnu.trove.TIntArrayList;
 import gnu.trove.TIntHashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -1284,6 +1285,112 @@ public class ControlFlowUtil {
     return visitor.getResult().booleanValue();
   }
 
+  /**
+   * Returns true if the value the variable has at start is later referenced without going through stop instruction
+   *
+   * @param flow ControlFlow to analyze
+   * @param start the point at which variable value is created
+   * @param stop the stop-point
+   * @param variable the variable to examine
+   * @return true if the value the variable has at start is later referenced without going through stop instruction
+   */
+  public static boolean isValueUsedWithoutVisitingStop(final ControlFlow flow, final int start, final int stop, final PsiVariable variable) {
+    if(start == stop) return false;
+
+    class MyVisitor extends InstructionClientVisitor<Boolean> {
+      // true if value the variable has at given offset maybe referenced without going through stop instruction
+      final boolean[] maybeReferenced = new boolean[flow.getSize() + 1];
+
+      @Override
+      public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
+        if (offset == stop) {
+          maybeReferenced[offset] = false;
+          return;
+        }
+        if(instruction instanceof WriteVariableInstruction && ((WriteVariableInstruction)instruction).variable == variable) {
+          maybeReferenced[offset] = false;
+          return;
+        }
+        if (maybeReferenced[offset]) return;
+        if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
+
+        boolean nextState = maybeReferenced[nextOffset];
+        maybeReferenced[offset] =
+          nextState || (instruction instanceof ReadVariableInstruction && ((ReadVariableInstruction)instruction).variable == variable);
+      }
+
+      @Override
+      public Boolean getResult() {
+        return maybeReferenced[start];
+      }
+    }
+    MyVisitor visitor = new MyVisitor();
+    depthFirstSearch(flow, visitor, start, flow.getSize());
+    return visitor.getResult().booleanValue();
+  }
+
+  /**
+   * Checks whether variable can be referenced between start and stop points. Back-edges are also considered, so the actual place
+   * where it referenced might be outside of (start, stop) interval.
+   *
+   * @param flow ControlFlow to analyze
+   * @param start start point
+   * @param stop stop point
+   * @param variable variable to analyze
+   * @return true if variable can be referenced between start and stop points
+   */
+  public static boolean isVariableReferencedBetween(final ControlFlow flow,
+                                                    final int start,
+                                                    final int stop,
+                                                    final PsiVariable variable) {
+    if(start == stop) return false;
+
+    // DFS visits instructions mainly in backward direction while here visiting in forward direction
+    // greatly reduces number of iterations. So first we just collect edges, then reverse their order.
+    // contains (from, to) pairs representing control flow arcs
+    final TIntArrayList list = new TIntArrayList();
+    depthFirstSearch(flow, new InstructionClientVisitor<Void>() {
+      @Override
+      public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
+        list.add(offset);
+        list.add(nextOffset);
+      }
+
+      @Override
+      public Void getResult() {
+        return null;
+      }
+    }, start, flow.getSize());
+    BitSet violated = new BitSet();
+    List<Instruction> instructions = flow.getInstructions();
+    boolean changed = true;
+    while(changed) {
+      changed = false;
+      for(int i=list.size()-2; i>=0; i-=2) {
+        int from = list.get(i);
+        int to = list.get(i+1);
+        if(from == stop) continue;
+        if(violated.get(from)) {
+          if(!violated.get(to)) {
+            if(to == stop) return true;
+            violated.set(to);
+            changed = true;
+          }
+          continue;
+        }
+        Instruction instruction = instructions.get(from);
+        if((instruction instanceof ReadVariableInstruction && ((ReadVariableInstruction)instruction).variable == variable) ||
+           (instruction instanceof WriteVariableInstruction && ((WriteVariableInstruction)instruction).variable == variable)) {
+          violated.set(from);
+          violated.set(to);
+          if(to == stop) return true;
+          changed = true;
+        }
+      }
+    }
+    return false;
+  }
+
   /**
    * @return min offset after sourceOffset which is definitely reachable from all references
    */
index 8fc2d0f4d0525f77897fdfc16b0072fe311d5a9d..cae0654cb54f4ae220272628c9f841f9c8f35537 100644 (file)
@@ -411,6 +411,9 @@ module.service.abstract=The service implementation is an abstract class: {0}
 module.service.no.ctor=The service implementation does not have a default constructor: {0}
 module.service.hidden.ctor=The default constructor of the service implementation is not public: {0}
 module.service.unused=Service interface provided but not exported or used
+module.package.not.exported=The module ''{0}'' does not export the package ''{1}'' to the module ''{2}''
+module.package.on.classpath=A named module cannot access packages of an unnamed one
+module.not.in.requirements=The module ''{0}'' does not have the module ''{1}'' in requirements
 
 feature.generics=Generics
 feature.annotations=Annotations
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/ChainStartingWithConstructor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/ChainStartingWithConstructor.java
new file mode 100644 (file)
index 0000000..d9394ca
--- /dev/null
@@ -0,0 +1,17 @@
+class A {
+
+  void foo() {
+    new IterHelper<>().loopMap((k, val) -> {
+      //do something
+    });
+  }
+}
+
+final class IterHelper<K, V> {
+  public void loopMap(final MapIterCallback<K, V> callback) {
+    //do something
+  }
+  public static interface MapIterCallback<K, V> {
+    abstract void eval(K k, V v);
+  }
+}
\ No newline at end of file
index cfdbf01b641b8d9b51cb225a0f4f0f94845cd47c..d701eac44dabfd62a1a785016298e3047e81b6ea 100644 (file)
@@ -4,6 +4,6 @@ import java.util.List;
 
 public class Main {
   public void testAssignment(List<String> data) {
-    String found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty()) ? "yes" : "no";
+      String found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty()) ? "yes" : "no";
   }
 }
\ No newline at end of file
index fc0e5b198bc79744ef52026121850b866e9d2388..17bfaefa2008c1e08bcbc8a7611d2e185f8515eb 100644 (file)
@@ -4,6 +4,6 @@ import java.util.List;
 
 public class Main {
   public void testAssignment(List<String> data) {
-    boolean found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
+      boolean found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
   }
 }
\ No newline at end of file
index 24ba822d245822f717a15b7dd305ca1d36fce5f5..9c0ba70e710e371f6519e1ea118df929bdcdcfdf 100644 (file)
@@ -4,6 +4,6 @@ import java.util.List;
 
 public class Main {
   public void testAssignment(List<String> data) {
-    boolean found = !data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
+      boolean found = !data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
   }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentExtraCode.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentExtraCode.java
new file mode 100644 (file)
index 0000000..9a35e4e
--- /dev/null
@@ -0,0 +1,14 @@
+// "Replace with anyMatch()" "true"
+
+import java.util.List;
+
+public class Main {
+  public void testAssignment(List<String> data) {
+    boolean found;
+    if (data.size() > 10) {
+      System.out.println("Big data");
+    }
+      found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
+    System.out.println(found);
+  }
+}
\ No newline at end of file
index 5d7e8f1d4dec4e7959f7ba373deb6266f5a70c3a..c62a206e83acdf96c432115a78cacd8e7783f0a6 100644 (file)
@@ -4,13 +4,12 @@ import java.util.List;
 
 public class Main {
   public void testAssignment(List<String> data) {
-    boolean found = false;
+    boolean found;
     if(Math.random() > 0.5) {
       found = true;
     } else {
-        if (data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty())) {
-            found = true;
-        }
+        found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
     }
+    System.out.println(found);
   }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentNonTrivialUnassigned.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentNonTrivialUnassigned.java
new file mode 100644 (file)
index 0000000..f947070
--- /dev/null
@@ -0,0 +1,15 @@
+// "Replace with anyMatch()" "true"
+
+import java.util.List;
+
+public class Main {
+  public void testAssignment(List<String> data) {
+    boolean found = false;
+    if(Math.random() > 0.5) {
+      System.out.println("oops");
+    } else {
+        found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
+    }
+    System.out.println(found);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentTryCatch.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentTryCatch.java
new file mode 100644 (file)
index 0000000..c49e906
--- /dev/null
@@ -0,0 +1,16 @@
+// "Replace with anyMatch()" "true"
+
+import java.util.List;
+
+public class Main {
+  public void testAssignment(List<String> data) {
+    boolean found;
+    try {
+        found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
+      System.out.println(found);
+    }
+    catch(Exception ex) {
+      ex.printStackTrace();
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentTryCatch2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterAnyMatchAssignmentTryCatch2.java
new file mode 100644 (file)
index 0000000..3a1d5dc
--- /dev/null
@@ -0,0 +1,16 @@
+// "Replace with anyMatch()" "true"
+
+import java.util.List;
+
+public class Main {
+  public void testAssignment(List<String> data) {
+    boolean found = false;
+    try {
+        found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
+    }
+    catch(Exception ex) {
+      ex.printStackTrace();
+    }
+    System.out.println(found);
+  }
+}
\ No newline at end of file
index 883fd73268226a5c0118019b0a91c10dd5ff0d80..3b3a7b9983a99daf976a58533b51633e705fd0b8 100644 (file)
@@ -6,6 +6,6 @@ import java.util.stream.Collectors;
 
 public class Main {
   public void test(Integer[] arr) {
-    List<Integer> result = Arrays.stream(arr).filter(x -> x > 5).collect(Collectors.toList());
+      List<Integer> result = Arrays.stream(arr).filter(x -> x > 5).collect(Collectors.toList());
   }
 }
\ No newline at end of file
index 6d59beba0bfe0613abe9e400205554a249950749..3767a91d06186379f8a5dae4915540d915f1c7df 100644 (file)
@@ -4,7 +4,7 @@ import java.util.stream.Collectors;
 
 class A {
   public static void main(List<String> args) {
-    ArrayList<String> uniqNames = args.stream().map(name -> name.substring(1)).collect(Collectors.toCollection(ArrayList::new));
+      ArrayList<String> uniqNames = args.stream().map(name -> name.substring(1)).collect(Collectors.toCollection(ArrayList::new));
       uniqNames.forEach(System.out::println);
   }
 
index b0f1807d07fe3ec85258a1ae5a59d610965e761d..cbf887b561044353926bf4d79532b38e8a78df5c 100644 (file)
@@ -5,7 +5,7 @@ import java.util.stream.Collectors;
 
 class Test {
   public static <T> List<TokenFilter<T>> fromString(final T src, Function<T, List<String>> extractor) {
-    final List<TokenFilter<T>> result = extractor.apply(src).stream().map((Function<String, TokenFilter<T>>) TokenFilter::new).collect(Collectors.toList());
+      final List<TokenFilter<T>> result = extractor.apply(src).stream().map((Function<String, TokenFilter<T>>) TokenFilter::new).collect(Collectors.toList());
       return result;
   }
   
index aef9e753f71660de687f159c6432bf1c439cb02c..134b51e185702d1c73e689d64ea0ae05b87e8ee3 100644 (file)
@@ -10,6 +10,6 @@ public class Collect {
   }
 
   void collectNames(List<Person> persons){
-    List<String> names = persons.stream().map(Person::getName).collect(Collectors.toList());
+      List<String> names = persons.stream().map(Person::getName).collect(Collectors.toList());
   }
 }