Merge branch 'master' into uta/rainbow
authorAlexey Utkin <alexey.utkin@jetbrains.com>
Wed, 24 Aug 2016 10:06:19 +0000 (13:06 +0300)
committerAlexey Utkin <alexey.utkin@jetbrains.com>
Wed, 24 Aug 2016 10:06:19 +0000 (13:06 +0300)
507 files changed:
.idea/libraries/bouncy_castle.xml [deleted file]
.idea/libraries/bouncy_castle_provider.xml [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
build/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy
build/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy
build/groovy/org/jetbrains/intellij/build/impl/BaseLayout.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/BaseLayoutSpec.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy
build/groovy/org/jetbrains/intellij/build/impl/ModuleLibraryData.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/PlatformLayout.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/PluginLayout.groovy
build/scripts/layouts.gant
java/compiler/impl/src/com/intellij/compiler/impl/ProblemsViewImpl.java
java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
java/debugger/impl/src/com/intellij/debugger/DebugEnvironment.java
java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
java/debugger/impl/src/com/intellij/debugger/impl/AlternativeJreIndexHelper.java [new file with mode: 0644]
java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java
java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
java/execution/impl/src/com/intellij/execution/application/ApplicationConfiguration.java
java/execution/openapi/src/com/intellij/execution/configurations/ConfigurationWithAlternativeJre.java [moved from plugins/settings-repository/src/keychain/CredentialsStore.kt with 60% similarity]
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/LibrariesModifiableModel.java
java/java-analysis-impl/java-analysis-impl.iml
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPassFactory.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.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/ModuleHighlightUtil.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/PostHighlightingVisitor.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteElementFix.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/NullParameterConstraintChecker.java
java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java
java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspectionBase.java
java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefFieldImpl.java
java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java
java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java
java/java-analysis-impl/src/com/intellij/ide/highlighter/JavaHighlightingColors.java
java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoTargetRendererProvider.java
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedParametersInspection.java [moved from java/java-impl/src/com/intellij/codeInspection/unusedParameters/UnusedParametersInspection.java with 84% similarity]
java/java-impl/src/com/intellij/codeInspection/ex/ClassPatternsPanel.java
java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsConfigurable.java [deleted file]
java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java
java/java-impl/src/com/intellij/codeInspection/unusedSymbol/OptionsPanel.form
java/java-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspection.java
java/java-impl/src/com/intellij/ide/actions/CreateModuleInfoAction.java
java/java-impl/src/com/intellij/ide/projectView/impl/JavaProjectViewDirectoryHelper.java
java/java-impl/src/com/intellij/ide/util/treeView/TreeViewUtil.java
java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java
java/java-impl/src/com/intellij/openapi/vfs/impl/jrt/JrtFileSystem.java
java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringProcessor.java
java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaNullMethodArgumentUtil.java
java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/ParameterNameFoldingManager.java
java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiClassReferenceListStubImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java
java/java-psi-impl/src/messages/JavaErrorMessages.properties
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NamesHighlighting.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/scopeBased/x/Shared.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/scopeBased/x/X.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/suppress15Inspections/afterSuppressUnusedParameter.java
java/java-tests/testData/inspection/dataFlow/fixture/AssertThat.java
java/java-tests/testData/inspection/dataFlow/fixture/GenericParameterNullity.java
java/java-tests/testData/inspection/dataFlow/fixture/NotNullOnSuperParameter.java [new file with mode: 0644]
java/java-tests/testData/inspection/dataFlow/fixture/NullArgumentIsFailingMethodCall.java
java/java-tests/testData/inspection/dataFlow/fixture/SpringAssert.java [new file with mode: 0644]
java/java-tests/testData/inspection/dataFlow/fixture/ThrowNull.java
java/java-tests/testData/inspection/dataFlow/fixture/ThrowNullable.java [new file with mode: 0644]
java/java-tests/testData/inspection/deadCode/packageLocal/expected.xml
java/java-tests/testData/inspection/nullableProblems/NullPassedAsPartNotNullAnnotatedOfVarArg.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inlineSuperClass/inlineClassUsedInJavadocLink/after/Test.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inlineSuperClass/inlineClassUsedInJavadocLink/before/Super.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inlineSuperClass/inlineClassUsedInJavadocLink/before/Test.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/MultipleJdksHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/HighlightStressTest.java
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/quickFix/Suppress15InspectionsTest.java
java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTestSuite.java
java/java-tests/testSrc/com/intellij/codeInspection/HardcodedContractsTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationClassPatternsTest.kt
java/java-tests/testSrc/com/intellij/codeInspection/UnusedMethodParameterTest.java
java/java-tests/testSrc/com/intellij/ide/fileTemplates/impl/FileTemplateLexerTest.java
java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java
java/java-tests/testSrc/com/intellij/refactoring/InlineSuperClassTest.java
jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/api/ClassFilesIndicesBuilder.java
jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java
jps/jps-builders/src/org/jetbrains/jps/incremental/BuildOperations.java
jps/jps-builders/src/org/jetbrains/jps/incremental/ChunkBuildOutputConsumerImpl.java
jps/jps-builders/src/org/jetbrains/jps/incremental/CompiledClass.java
jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/ModuleLevelBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/BaseInstrumentingBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/NotNullInstrumentingBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/RmiStubsGenerator.java
jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/messages/CompilerMessage.java
jps/jps-builders/testSrc/org/jetbrains/jps/builders/CompileScopeTestBuilder.java
jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
jps/jps-builders/testSrc/org/jetbrains/jps/builders/java/ForcedCompilationTest.java
jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsProjectLoader.java
lib/bcprov-jdk15on-155.jar [new file with mode: 0644]
lib/required_for_dist.txt
lib/src/bcprov.zip [new file with mode: 0644]
platform/analysis-api/src/com/intellij/codeInspection/GlobalInspectionTool.java
platform/analysis-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/Divider.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java
platform/analysis-impl/src/com/intellij/codeInspection/InspectionEngine.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionToolWrapper.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/HTMLComposerImpl.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java
platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java
platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInWebServer.kt
platform/configuration-store-impl/src/SchemeManagerImpl.kt
platform/core-api/src/com/intellij/lexer/FlexAdapter.java
platform/core-api/src/com/intellij/openapi/util/SimpleTimer.java
platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java
platform/core-api/src/com/intellij/ui/LayeredIcon.java
platform/core-impl/src/com/intellij/codeInsight/completion/CompletionUtilCoreImpl.java
platform/core-impl/src/com/intellij/indentation/IndentationParser.java
platform/core-impl/src/com/intellij/openapi/application/TransactionGuardImpl.java
platform/core-impl/src/com/intellij/openapi/editor/impl/EditorDocumentPriorities.java
platform/core-impl/src/com/intellij/openapi/fileEditor/impl/LoadTextUtil.java
platform/core-impl/src/com/intellij/psi/impl/DocumentCommitThread.java
platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorTypeInfo.java
platform/core-impl/src/com/intellij/psi/stubs/DefaultStubBuilder.java
platform/core-impl/src/com/intellij/psi/stubs/PsiFileStubImpl.java
platform/credential-store/credential-store.iml
platform/credential-store/src/FileCredentialStore.kt
platform/credential-store/src/PasswordSafeImpl.kt
platform/credential-store/src/com/intellij/credentialStore/EnterPasswordComponent.java [moved from platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java with 59% similarity]
platform/credential-store/src/com/intellij/credentialStore/MasterPasswordDialog.java [moved from platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterPasswordDialog.java with 97% similarity]
platform/credential-store/src/com/intellij/credentialStore/PasswordComponentBase.form [moved from platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.form with 89% similarity]
platform/credential-store/src/com/intellij/credentialStore/PasswordComponentBase.java [moved from platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.java with 90% similarity]
platform/credential-store/src/com/intellij/credentialStore/PasswordDatabase.java [moved from platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordDatabase.java with 94% similarity]
platform/credential-store/src/credentialStore.kt
platform/credential-store/src/dbV1Convertor.kt
platform/credential-store/src/kdbx/KdbxEntry.kt [new file with mode: 0644]
platform/credential-store/src/kdbx/KdbxGroup.kt [new file with mode: 0644]
platform/credential-store/src/kdbx/KdbxHeader.kt [new file with mode: 0644]
platform/credential-store/src/kdbx/KeePassDatabase.kt [new file with mode: 0644]
platform/credential-store/src/kdbx/kdbx.kt [new file with mode: 0644]
platform/credential-store/src/libraries/linuxSecretLibrary.kt
platform/credential-store/src/libraries/macOsKeychainLibrary.kt
platform/credential-store/src/nativeCredentialStore.kt
platform/credential-store/src/org/linguafranca/hashedblock/HashedBlockInputStream.java [new file with mode: 0644]
platform/credential-store/src/org/linguafranca/hashedblock/HashedBlockOutputStream.java [new file with mode: 0644]
platform/credential-store/src/org/linguafranca/pwdb/kdbx/KdbxSerializer.java [new file with mode: 0644]
platform/credential-store/test/CredentialSerializeTest.kt [moved from platform/credential-store/test/CredentialTest.kt with 64% similarity]
platform/credential-store/test/CsTestSuite.kt [new file with mode: 0644]
platform/credential-store/test/FileCredentialStoreTest.kt
platform/credential-store/test/LinuxSecretTest.kt [deleted file]
platform/credential-store/test/MasterPasswordMigrationTest.kt
platform/credential-store/test/NativeKeychainTest.kt [new file with mode: 0644]
platform/credential-store/test/testClass.kt [new file with mode: 0644]
platform/dvcs-impl/src/com/intellij/dvcs/actions/DvcsCompareWithBranchAction.java
platform/editor-ui-api/src/com/intellij/openapi/editor/Editor.java
platform/editor-ui-api/src/com/intellij/openapi/editor/EditorCustomElementRenderer.java [new file with mode: 0644]
platform/editor-ui-api/src/com/intellij/openapi/editor/Inlay.java [new file with mode: 0644]
platform/editor-ui-api/src/com/intellij/openapi/editor/InlayModel.java [new file with mode: 0644]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemNotificationManager.java
platform/lang-impl/gen/com/intellij/ide/fileTemplates/impl/_FileTemplateTextLexer.java
platform/lang-impl/src/com/intellij/codeInsight/actions/FileInEditorProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IdentifierHighlighterPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InjectedGeneralHighlightingPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersPassFactory.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersUtil.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPassFactory.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/LazyEditor.java
platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionViewPsiTreeChangeAdapter.java
platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateTextLexer.flex
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiFileSystemItemFilter.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/util/DeleteHandler.java
platform/lang-impl/src/com/intellij/injected/editor/EditorWindowImpl.java
platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java
platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java
platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java
platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/JavaLikeLangLineIndentProvider.java
platform/lang-impl/src/com/intellij/refactoring/rename/AutomaticRenamingDialog.java
platform/lang-impl/src/com/intellij/slicer/LanguageSlicing.java
platform/lang-impl/src/com/intellij/slicer/SliceBackwardAction.java
platform/lang-impl/src/com/intellij/slicer/SliceForwardAction.java
platform/lang-impl/src/com/intellij/ui/DeferredIconImpl.java
platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java
platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/LocalHistoryAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/LocalHistoryActionWithDialog.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/PutLabelAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/RecentChangesAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/ShowHistoryAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/ShowSelectionHistoryAction.java
platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt [new file with mode: 0644]
platform/platform-api/src/com/intellij/credentialStore/CredentialStore.java [new file with mode: 0644]
platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java
platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java
platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java
platform/platform-api/src/com/intellij/execution/ui/ConsoleViewContentType.java
platform/platform-api/src/com/intellij/ide/passwordSafe/PasswordSafe.java
platform/platform-api/src/com/intellij/ide/passwordSafe/PasswordStorage.java
platform/platform-api/src/com/intellij/openapi/actionSystem/AsyncUpdateAction.java
platform/platform-api/src/com/intellij/ui/components/JBTextField.java
platform/platform-api/src/com/intellij/ui/components/MacScrollBarUI.java
platform/platform-api/src/com/intellij/util/Alarm.java
platform/platform-api/src/com/intellij/util/string.kt [moved from platform/platform-impl/src/com/intellij/util/string.kt with 100% similarity]
platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java
platform/platform-api/src/com/intellij/util/ui/update/Update.java
platform/platform-impl/src/com/intellij/ide/actions/EditSourceInNewWindowAction.java
platform/platform-impl/src/com/intellij/ide/actions/OpenElementInNewWindowAction.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/EncryptionUtil.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java
platform/platform-impl/src/com/intellij/notification/SingletonNotificationManager.java [moved from platform/built-in-server/src/org/jetbrains/notification/SingletonNotificationManager.java with 81% similarity]
platform/platform-impl/src/com/intellij/openapi/application/Preloader.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/BackspaceAction.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java
platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/FontInfo.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/InlayImpl.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/editor/impl/InlayModelImpl.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/editor/impl/IterationState.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorCoordinateMapper.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorSizeManager.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorView.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/IterationState.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/VisualLineFragmentsIterator.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/VisualLinesIterator.java
platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentInlayModel.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/AsyncEditorLoader.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorState.java
platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/project/FileContentQueue.java
platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java
platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.java
platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
platform/platform-impl/src/com/intellij/util/MergingBackgroundExecutor.java
platform/platform-impl/src/com/intellij/util/containers/util.kt
platform/platform-impl/src/com/intellij/util/graph/impl/KShortestPathsFinder.java
platform/platform-impl/src/com/intellij/util/path.kt
platform/platform-resources-en/src/messages/InspectionsBundle.properties
platform/platform-resources-en/src/messages/OptionsBundle.properties
platform/platform-resources-en/src/messages/VcsBundle.properties
platform/platform-resources-en/src/messages/XmlBundle.properties
platform/platform-resources/src/DefaultColorSchemesManager.xml
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/platform-resources/src/META-INF/XmlPlugin.xml
platform/platform-resources/src/idea/LangActions.xml
platform/platform-resources/src/idea/PlatformActions.xml
platform/platform-resources/src/idea/PlatformLangActionManager.xml
platform/platform-tests/testSrc/com/intellij/history/integration/PatchingTestCase.java
platform/platform-tests/testSrc/com/intellij/history/integration/ui/LocalHistoryActionsTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/view/VisualLinesIteratorTest.java
platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedScheduledExecutorTest.java
platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java
platform/platform-tests/testSrc/com/intellij/util/containers/ContainerUtilTest.java
platform/projectModel-impl/src/com/intellij/jdom.kt
platform/remote-servers/impl/src/com/intellij/remoteServer/agent/impl/RemoteAgentThreadProxyCreator.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerTaskExecutorImpl.java
platform/testFramework/src/com/intellij/testFramework/LightProjectDescriptor.java
platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/openapi/diff/impl/string/DiffString.java
platform/util/src/com/intellij/openapi/util/text/InjectorMatchingEndFinder.java [new file with mode: 0644]
platform/util/src/com/intellij/openapi/util/text/StringInjectionsProcessor.java [new file with mode: 0644]
platform/util/src/com/intellij/util/concurrency/AppExecutorUtil.java
platform/util/src/com/intellij/util/concurrency/BoundedScheduledExecutorService.java
platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutor.java
platform/util/src/com/intellij/util/concurrency/SequentialTaskExecutor.java
platform/util/src/com/intellij/util/containers/ContainerUtil.java
platform/util/src/com/intellij/util/io/BaseOutputReader.java
platform/util/src/com/intellij/util/text/ByteArrayCharSequence.java
platform/util/src/com/intellij/util/text/CharArrayCharSequence.java
platform/util/src/com/intellij/util/text/CharSequenceSubSequence.java
platform/util/src/com/intellij/util/text/ImmutableText.java
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/BinaryEncoder.java [new file with mode: 0644]
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/BinaryPatchContentParser.java [new file with mode: 0644]
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/PatchReader.java
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/lib/base85xjava/Base85x.java [new file with mode: 0644]
platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangesUtil.java
platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
platform/vcs-api/vcs-api-core/src/com/intellij/openapi/diff/impl/patch/BinaryFilePatch.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AbstractCommonCheckinAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AbstractShowDiffAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AbstractVcsAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CompareWithSelectedRevisionAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/SelectAndCompareWithSelectedRevisionAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/SelectedBlockHistoryAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/ShowBaseRevisionAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/ShowChangeMarkerAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/TabbedShowHistoryAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsContextWrapper.java
platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsGroupsWrapper.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/AbstractMissingFilesAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/EditAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/IgnoreUnversionedAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/MoveChangesToAnotherListAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RollbackAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ScheduleForAdditionAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/GetCommittedChangelistAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryFilePatchInProgress.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryPatchWriter.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BlobIndexUtil.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CommonBinaryFilePatchInProgress.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/PatchWriter.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ShelvedBinaryFilePatchInProgress.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedBinaryContentRevision.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChange.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/SimpleBinaryContentRevision.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/UnshelveWithDialogAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserLockedFoldersNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/MultipleChangeListBrowser.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/RollbackWorker.java
platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java
platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsCommitMetadataImpl.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/CommitPanel.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java
platform/vcs-log/impl/vcs-log-impl.iml
plugins/InspectionGadgets/test/com/siyeh/igtest/junit/rule/wrongdatapoint.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java
plugins/ant/src/com/intellij/lang/ant/segments/Extractor.java
plugins/git4idea/src/git4idea/GitRevisionNumber.java
plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
plugins/git4idea/src/git4idea/config/GitVersion.java
plugins/git4idea/src/git4idea/push/GitOutgoingCommitsProvider.java
plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java
plugins/git4idea/src/git4idea/update/GitUpdater.java
plugins/git4idea/tests/git4idea/log/GitSha1Test.kt [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/PasteMvnDependencyPreProcessor.java
plugins/gradle/src/org/jetbrains/plugins/gradle/projectView/GradleTreeStructureProvider.java
plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleRunnerConfigurable.java
plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleSystemRunningSettings.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/codeInsight/actions/MvnDependencyPasteTest.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/changeToOperator/transformations/CompareToTransformation.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/changeToOperator/transformations/UnaryTransformation.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionMembersCache.java
plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovycOutputParser.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureSynchronizer.java
plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
plugins/hg4idea/src/org/zmlx/hg4idea/HgChange.java
plugins/hg4idea/src/org/zmlx/hg4idea/HgContentRevision.java
plugins/hg4idea/src/org/zmlx/hg4idea/HgFile.java
plugins/hg4idea/src/org/zmlx/hg4idea/HgFileRevision.java
plugins/hg4idea/src/org/zmlx/hg4idea/HgNameWithHashInfo.java
plugins/hg4idea/src/org/zmlx/hg4idea/HgRevisionNumber.java
plugins/hg4idea/src/org/zmlx/hg4idea/push/HgPushTargetPanel.java
plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepoInfo.java
plugins/hg4idea/src/org/zmlx/hg4idea/util/HgVersion.java
plugins/maven/jps-plugin/src/org/jetbrains/jps/maven/compiler/DependencyResolvingBuilder.java
plugins/properties/properties-psi-api/resources/messages/PropertiesBundle.properties
plugins/properties/properties-psi-api/src/com/intellij/lang/properties/ResourceBundle.java
plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertiesFile.java
plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/Property.java
plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unsorted/AlphaUnsortedPropertiesFileInspection.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/ResourceBundleManager.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesParser.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesParserDefinition.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesFileImpl.java
plugins/properties/src/com/intellij/ide/favoritesTreeView/ResourcesFavoriteNodeProvider.java
plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java
plugins/properties/src/com/intellij/lang/properties/PropertiesWordCompletionFilter.java
plugins/properties/src/com/intellij/lang/properties/ResourceBundleReference.java
plugins/properties/src/com/intellij/lang/properties/create/AddNewPropertyFileAction.java
plugins/properties/src/com/intellij/lang/properties/create/CreateResourceBundleDialogComponent.java
plugins/properties/src/com/intellij/lang/properties/editor/GotoPropertyDeclarationsProvider.java
plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java
plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java
plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditorUtil.java [deleted file]
plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java
plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspection.java
plugins/properties/src/com/intellij/lang/properties/editor/inspections/incomplete/IncompletePropertyInspectionOptionsPanel.java
plugins/properties/src/com/intellij/lang/properties/formatting/PropertiesFormattingModelBuilder.java
plugins/properties/src/com/intellij/lang/properties/formatting/PropertiesRootBlock.java
plugins/properties/src/com/intellij/lang/properties/projectView/CustomResourceBundlePropertiesFileNode.java
plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleGrouper.java
plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleMoveProvider.java
plugins/properties/src/com/intellij/lang/properties/refactoring/rename/RenamePropertyProcessor.java
plugins/properties/src/com/intellij/lang/properties/refactoring/rename/ResourceBundleFromEditorRenameHandler.java
plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java
plugins/properties/src/com/intellij/lang/properties/references/PropertiesCompletionContributor.java
plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewComponent.java
plugins/properties/testSrc/com/intellij/lang/properties/CustomResourceBundleTest.java
plugins/properties/testSrc/com/intellij/lang/properties/DuplicatePropertyInspectionTest.java
plugins/properties/testSrc/com/intellij/lang/properties/PropertiesCommenterTest.java
plugins/properties/testSrc/com/intellij/lang/properties/PropertiesEnterTest.java
plugins/properties/testSrc/com/intellij/lang/properties/PropertiesFileTest.java
plugins/properties/testSrc/com/intellij/lang/properties/PropertiesJoinLinesTest.java
plugins/properties/testSrc/com/intellij/lang/properties/TrailingSpacesInPropertyInspectionTest.java
plugins/settings-repository/lib/org/eclipse/jgit/transport/annotations.xml
plugins/settings-repository/settings-repository.iml
plugins/settings-repository/src/CredentialsStore.kt
plugins/settings-repository/src/IcsCredentialsStore.kt [new file with mode: 0644]
plugins/settings-repository/src/IcsManager.kt
plugins/settings-repository/src/git/GitEx.kt
plugins/settings-repository/src/git/GitRepositoryManager.kt
plugins/settings-repository/src/git/JGitCredentialsProvider.kt
plugins/settings-repository/src/git/gitCredential.kt
plugins/settings-repository/src/keychain/FileCredentialsStore.kt [deleted file]
plugins/settings-repository/src/keychain/OsXCredentialsStore.kt [deleted file]
plugins/settings-repository/testSrc/IcsCredentialTest.kt
plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java
plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ShelveLocalChangesTask.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnConcurrentChangeListManagerTest.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnConcurrentChangeListManagerTest.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalCustomizer.java
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalView.java
plugins/ui-designer/jps-plugin/src/org/jetbrains/jps/uiDesigner/compiler/FormsInstrumenter.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskFileDialog.java [deleted file]
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskFilePanel.form [deleted file]
python/helpers/pydev/_pydev_bundle/pydev_monkey.py
python/helpers/pydev/_pydevd_bundle/pydevd_vars.py
python/helpers/pydev/pydevd_plugins/jinja2_debug.py
python/pydevSrc/com/jetbrains/python/debugger/pydev/GetReferrersCommand.java
python/src/com/jetbrains/python/debugger/dataframe/TableValueDescriptor.java
python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java
python/testData/debug/test_ref.py [new file with mode: 0644]
python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java
python/testSrc/com/jetbrains/env/python/debug/PyBaseDebuggerTask.java
resources-en/src/inspectionDescriptions/UnusedParameters.html [deleted file]
resources-en/src/inspectionDescriptions/unused.html
resources-en/src/messages/QuickFixBundle.properties
resources/src/META-INF/IdeaPlugin.xml
resources/src/idea/JavaActions.xml
resources/src/idea/RichPlatformPlugin.xml
updater/src/com/intellij/updater/CreateAction.java
updater/src/com/intellij/updater/DeleteAction.java
updater/src/com/intellij/updater/Patch.java
updater/src/com/intellij/updater/PatchAction.java
updater/src/com/intellij/updater/UpdateAction.java
updater/src/com/intellij/updater/Utils.java
xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlExtraClosingTagInspection.java
xml/xml-analysis-impl/src/com/intellij/xml/util/CollapseTagIntention.java
xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java
xml/xml-psi-impl/resources/messages/XmlErrorMessages.properties
xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java

diff --git a/.idea/libraries/bouncy_castle.xml b/.idea/libraries/bouncy_castle.xml
deleted file mode 100644 (file)
index 4e4673a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<component name="libraryTable">
-  <library name="bouncy-castle">
-    <CLASSES>
-      <root url="jar://$PROJECT_DIR$/android/android/lib/bcpkix-jdk15on-1.48.jar!/" />
-      <root url="jar://$PROJECT_DIR$/android/android/lib/bcprov-jdk15on-1.48.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES />
-  </library>
-</component>
\ No newline at end of file
diff --git a/.idea/libraries/bouncy_castle_provider.xml b/.idea/libraries/bouncy_castle_provider.xml
new file mode 100644 (file)
index 0000000..f9cc69c
--- /dev/null
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+  <library name="bouncy-castle-provider">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/bcprov-jdk15on-155.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$PROJECT_DIR$/lib/src/bcprov.zip!/" />
+    </SOURCES>
+  </library>
+</component>
\ No newline at end of file
index c432ad844bc41c9efbfe767d92757dfed50dda88..bf7e6db493b30d14b87143aa502526917bfc4967 100644 (file)
@@ -78,6 +78,8 @@ class CommunityLibraryLicenses {
                        licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.html"),
     new LibraryLicense(name: "bouncy-castle", version: "1.48", license: "MIT License", url: "http://bouncycastle.org",
                        licenseUrl: "http://bouncycastle.org/licence.html"),
+    new LibraryLicense(name: "bouncy-castle-provider", version: "1.55", license: "MIT License", url: "http://bouncycastle.org",
+                       licenseUrl: "http://bouncycastle.org/licence.html"),
     new LibraryLicense(name: "CGLib", libraryName: "CGLIB", version: "2.2.2", license: "Apache", url: "http://cglib.sourceforge.net/",
                        licenseUrl: "http://www.apache.org/foundation/licence-FAQ.html"),
     new LibraryLicense(name: "classworlds", libraryName: "classworlds-1.1.jar", version: "1.1", license: "codehaus",
index 4a1a0f7b9271c5756ca7ade395a8a40f54b916f4..2e43847def35e42154935168dab181fc980d1d8f 100644 (file)
@@ -140,14 +140,14 @@ class CommunityRepositoryModules {
       withOptionalModule("IntelliLang-java", "IntelliLang.jar")
       withOptionalModule("IntelliLang-xml", "IntelliLang.jar")
       withOptionalModule("intellilang-jps-plugin", "intellilang-jps-plugin.jar")
-      doNotCreateSeperateJarForLocalizableResources()
+      doNotCreateSeparateJarForLocalizableResources()
     },
     plugin("tasks-core") {
       directoryName = "tasks"
       withModule("tasks-api")
       withModule("jira")
       withOptionalModule("tasks-java")
-      doNotCreateSeperateJarForLocalizableResources()
+      doNotCreateSeparateJarForLocalizableResources()
     },
     plugin("terminal") {
       withResource("lib/jediterm.in", "lib")
index d8addb07a4e077bc9523ba3423f2fe29a24ec892..163937c7de2fe27f82951d8224b8a5af7c8e3ab9 100644 (file)
@@ -33,6 +33,7 @@
 
 package org.jetbrains.intellij.build
 
+import com.intellij.openapi.util.MultiValuesMap
 import groovy.transform.CompileStatic
 import org.jetbrains.intellij.build.impl.PluginLayout
 
@@ -71,14 +72,14 @@ class ProductModulesLayout {
   List<String> pluginModulesToPublish = []
 
   /**
-   * Paths to JAR files which contents should be extracted into {@link #mainJarName} JAR.
+   * Names of the project libraries which JARs' contents should be extracted into {@link #mainJarName} JAR.
    */
-  List<String> additionalJarsToUnpackIntoMainJar = []
+  List<String> projectLibrariesToUnpackIntoMainJar = []
 
   /**
-   * Maps names of the modules to names of JARs; these modules will be packed into these JARs and copied to the product's 'lib' directory.
+   * Maps names of JARs to names of the modules; these modules will be packed into these JARs and copied to the product's 'lib' directory.
    */
-  Map<String, String> additionalPlatformModules = [:]
+  MultiValuesMap<String, String> additionalPlatformJars = new MultiValuesMap<>(true)
 
 
   /**
@@ -99,12 +100,15 @@ class ProductModulesLayout {
 
   /**
    * @param allPlugins descriptions of layout of all plugins which may be included into the product
-   * @return list of all modules which output is included into the product platform's JARs or the plugin's JARs
+   * @return list of all modules which output is included into the plugin's JARs
    */
-  List<String> getIncludedModules(List<PluginLayout> allPlugins) {
+  List<String> getIncludedPluginModules(List<PluginLayout> allPlugins) {
     Set<String> enabledPluginModules = getEnabledPluginModules()
-    def allPluginModules = allPlugins.findAll { enabledPluginModules.contains(it.mainModule) }.collectMany { it.getActualModules(enabledPluginModules).values() }
-    ((allPluginModules + platformApiModules + platformImplementationModules + additionalPlatformModules.keySet()) as Set<String>) as List<String>
+    allPlugins.findAll { enabledPluginModules.contains(it.mainModule) }.collectMany { it.getActualModules(enabledPluginModules).values() }
+  }
+
+  List<String> getIncludedPlatformModules() {
+    platformApiModules + platformImplementationModules + additionalPlatformJars.values()
   }
 
   Set<String> getEnabledPluginModules() {
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/BaseLayout.groovy b/build/groovy/org/jetbrains/intellij/build/impl/BaseLayout.groovy
new file mode 100644 (file)
index 0000000..f7f30d3
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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 org.jetbrains.intellij.build.impl
+
+import com.intellij.openapi.util.MultiValuesMap
+import org.jetbrains.intellij.build.BuildContext
+
+/**
+ * Describes layout of a plugin or the platform JARs in the product distribution
+ *
+ * @author nik
+ */
+abstract class BaseLayout {
+  /** JAR name (or path relative to 'lib' directory) to module name */
+  final MultiValuesMap<String, String> moduleJars = new MultiValuesMap<>(true)
+  /** source directory -> relative path to a target directory under the plugin directory */
+  final Map<String, String> resourcePaths = [:]
+  /** source directory -> relative path to a zip file under the plugin directory */
+  final Map<String, String> resourceArchivePaths = [:]
+  /** module name to entries which should be excluded from its output */
+  final MultiValuesMap<String, String> moduleExcludes = new MultiValuesMap<>(true)
+  final List<String> includedProjectLibraries = []
+  final List<ModuleLibraryData> includedModuleLibraries = []
+  /** JAR name -> name of project library which content should be unpacked */
+  final MultiValuesMap<String, String> projectLibrariesToUnpack = new MultiValuesMap<>()
+  protected final Set<String> modulesWithLocalizableResourcesInCommonJar = new LinkedHashSet<>()
+
+  boolean packLocalizableResourcesInCommonJar(String moduleName) {
+    return modulesWithLocalizableResourcesInCommonJar.contains(moduleName)
+  }
+
+  abstract String basePath(BuildContext buildContext)
+}
\ No newline at end of file
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/BaseLayoutSpec.groovy b/build/groovy/org/jetbrains/intellij/build/impl/BaseLayoutSpec.groovy
new file mode 100644 (file)
index 0000000..fdffc16
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2000-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Copyright 2000-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 org.jetbrains.intellij.build.impl
+
+/**
+ * @author nik
+ */
+class BaseLayoutSpec {
+  protected final BaseLayout layout
+
+  BaseLayoutSpec(BaseLayout layout) {
+    this.layout = layout
+  }
+
+  /**
+   * Register an additional module to be included into the plugin distribution. If {@code relativeJarPath} doesn't contain '/' (i.e. the
+   * JAR will be added to the plugin's classpath) this will also cause modules library from {@code moduleName} with scopes 'Compile' and
+   * 'Runtime' to be copied to the 'lib' directory of the plugin.
+   *
+   * @param relativeJarPath target JAR path relative to 'lib' directory of the plugin; different modules may be packed into the same JAR,
+   * but don't use this for new plugins; this parameter is temporary added to keep layout of old plugins.
+   * @param localizableResourcesInCommonJar if {@code true} the translatable resources from the module (messages, inspection descriptions, etc) will be
+   * placed into a separate 'resources_en.jar'. <strong>Do not use this for new plugins, this parameter is temporary added to keep layout of old plugins</strong>.
+   */
+  void withModule(String moduleName, String relativeJarPath = "${moduleName}.jar", boolean localizableResourcesInCommonJar = true) {
+    if (localizableResourcesInCommonJar) {
+      layout.modulesWithLocalizableResourcesInCommonJar << moduleName
+    }
+    layout.moduleJars.put(relativeJarPath, moduleName)
+  }
+
+  /**
+   * @param resourcePath path to resource file or directory relative to the plugin's main module content root
+   * @param relativeOutputDirectory target path relative to the plugin root directory
+   */
+  void withResource(String resourcePath, String relativeOutputDirectory) {
+    layout.resourcePaths[resourcePath] = relativeOutputDirectory
+  }
+
+  /**
+   * @param resourcePath path to resource file or directory relative to the plugin's main module content root
+   * @param relativeOutputFile target path relative to the plugin root directory
+   */
+  void withResourceArchive(String resourcePath, String relativeOutputFile) {
+    layout.resourceArchivePaths[resourcePath] = relativeOutputFile
+  }
+
+  /**
+   * Include the project library to 'lib' directory of the plugin distribution
+   */
+  void withProjectLibrary(String libraryName) {
+    layout.includedProjectLibraries << libraryName
+  }
+
+  /**
+   * Include the module library to the plugin distribution. Please note that it makes sense to call this method only
+   * for additional modules which aren't copied directly to the 'lib' directory of the plugin distribution, because for ordinary modules
+   * their module libraries are included into the layout automatically.
+   */
+  void withModuleLibrary(String libraryName, String moduleName, String relativeOutputPath) {
+    layout.includedModuleLibraries << new ModuleLibraryData(moduleName: moduleName, libraryName: libraryName,
+                                                            relativeOutputPath: relativeOutputPath)
+  }
+
+  /**
+   * Exclude the specified directory when {@code moduleName} is packed into JAR file.
+   * <strong>This is a temporary method added to keep layout of some old plugins. If some directory from a module shouldn't be included into the
+   * module JAR it's strongly recommended to move that directory outside of the module source roots.</strong>
+   * @param excludedDirectory path to the directory to be exclude relatively to the module output root
+   */
+  void excludeFromModule(String moduleName, String excludedDirectory) {
+    layout.moduleExcludes.put(moduleName, excludedDirectory)
+  }
+}
index bcdbce195b95a97aa397a32a5aaf8d2467b52a3a..dbf62b3f063a1a20515f4359ea5abb165c8746b2 100644 (file)
@@ -245,7 +245,7 @@ class BuildContextImpl extends BuildContext {
   boolean includeBreakGenLibraries() {
     def productLayout = productProperties.productLayout
     return productLayout.mainJarName == null || //todo[nik] remove this condition later
-           productLayout.additionalPlatformModules.containsKey("execution-impl")
+           productLayout.includedPlatformModules.contains("execution-impl")
   }
 
   @CompileDynamic
index 4fdbcbc6bddb9656b34ce9d7b8935a9e689f14ae..cefde9d7d4e927487d775703996a409093f3d8bb 100644 (file)
@@ -266,10 +266,10 @@ idea.fatal.error.notification=disabled
     def productLayout = buildContext.productProperties.productLayout
     checkProductLayout(productLayout, allPlugins)
     cleanOutput()
-    def includedModules = productLayout.getIncludedModules(allPlugins)
-    compileModules(includedModules)
+    def distributionJARsBuilder = new DistributionJARsBuilder(buildContext, allPlugins)
+    compileModules(productLayout.getIncludedPluginModules(allPlugins) + distributionJARsBuilder.getPlatformModules())
     buildContext.messages.block("Build platform and plugin JARs") {
-      new DistributionJARsBuilder(buildContext, includedModules, allPlugins).buildJARs()
+      distributionJARsBuilder.buildJARs()
     }
     if (buildContext.productProperties.scrambleMainJar) {
       if (buildContext.proprietaryBuildTools.scrambleTool != null) {
@@ -287,15 +287,28 @@ idea.fatal.error.notification=disabled
     checkPluginModules(layout.bundledPluginModules, "bundledPluginModules", allPluginModules)
     checkPluginModules(layout.pluginModulesToPublish, "pluginModulesToPublish", allPluginModules)
 
-    checkModules(layout.platformApiModules, "platformApiModules")
-    checkModules(layout.platformImplementationModules, "platformImplementationModules")
-    checkModules(layout.additionalPlatformModules.keySet(), "additionalPlatformModules")
+    checkModules(layout.platformApiModules, "productProperties.productLayout.platformApiModules")
+    checkModules(layout.platformImplementationModules, "productProperties.productLayout.platformImplementationModules")
+    checkModules(layout.additionalPlatformJars.values(), "productProperties.productLayout.additionalPlatformJars")
+    checkProjectLibraries(layout.projectLibrariesToUnpackIntoMainJar, "productProperties.productLayout.projectLibrariesToUnpackIntoMainJar")
+    allPlugins.findAll {layout.enabledPluginModules.contains(it.mainModule)}.each { plugin ->
+      checkModules(plugin.moduleJars.values(), "'$plugin.mainModule' plugin")
+      checkModules(plugin.moduleExcludes.keySet(), "'$plugin.mainModule' plugin")
+      checkProjectLibraries(plugin.includedProjectLibraries, "'$plugin.mainModule' plugin")
+    }
   }
 
   private void checkModules(Collection<String> modules, String fieldName) {
     def unknownModules = modules.findAll {buildContext.findModule(it) == null}
     if (!unknownModules.empty) {
-      buildContext.messages.error("The following modules from productProperties.$fieldName aren't found in the project.")
+      buildContext.messages.error("The following modules from $fieldName aren't found in the project.")
+    }
+  }
+
+  private void checkProjectLibraries(Collection<String> names, String fieldName) {
+    def unknownLibraries = names.findAll {buildContext.project.libraryCollection.findLibrary(it) == null}
+    if (!unknownLibraries.empty) {
+      buildContext.messages.error("The following libraries from $fieldName aren't found in the project.")
     }
   }
 
@@ -346,8 +359,8 @@ idea.fatal.error.notification=disabled
       buildContext.projectBuilder.buildProduction()
     }
     else {
-      List<String> modulesToBuild = ((moduleNames as Set<String>) + DistributionJARsBuilder.ADDITIONAL_MODULES_TO_COMPILE
-        buildContext.proprietaryBuildTools.scrambleTool?.additionalModulesToCompile ?: []) as List<String>
+      List<String> modulesToBuild = ((moduleNames as Set<String>) +
+        buildContext.proprietaryBuildTools.scrambleTool?.additionalModulesToCompile ?: []) as List<String>
       List<String> invalidModules = modulesToBuild.findAll {buildContext.findModule(it) == null}
       if (!invalidModules.empty) {
         buildContext.messages.warning("The following modules won't be compiled: $invalidModules")
index 2c853685dece32a8739c6487592b85185e5d2bf2..80ed9f7a5391053c3b0c955aef7ff25dc5ef1316 100644 (file)
  */
 package org.jetbrains.intellij.build.impl
 
+import com.intellij.openapi.util.MultiValuesMap
 import com.intellij.openapi.util.io.FileUtil
-import com.intellij.util.PathUtilRt
 import org.jetbrains.intellij.build.BuildContext
 import org.jetbrains.intellij.build.BuildOptions
 import org.jetbrains.jps.model.java.JpsJavaClasspathKind
 import org.jetbrains.jps.model.java.JpsJavaExtensionService
+import org.jetbrains.jps.model.library.JpsLibrary
+import org.jetbrains.jps.model.library.JpsOrderRootType
 import org.jetbrains.jps.model.module.JpsLibraryDependency
 import org.jetbrains.jps.model.module.JpsModule
-import org.jetbrains.jps.util.JpsPathUtil
+import org.jetbrains.jps.model.module.JpsModuleReference
 
 /**
  * @author nik
  */
 class DistributionJARsBuilder {
-  public static final List<String> ADDITIONAL_MODULES_TO_COMPILE = [
-    "java-runtime",//required to build searchable options index
-    "colorSchemes", "platform-resources", "platform-resources-en", "boot", "icons", "forms_rt", "bootstrap"
-  ]
   private static final boolean COMPRESS_JARS = false
   private static final String RESOURCES_INCLUDED = "resources.included"
   private static final String RESOURCES_EXCLUDED = "resources.excluded"
   private final BuildContext buildContext
   private final List<PluginLayout> allPlugins
   private final Set<String> usedModules = new LinkedHashSet<>()
-  private final List<String> includedModules
+  private final PlatformLayout platform
 
-  DistributionJARsBuilder(BuildContext buildContext, List<String> includedModules, List<PluginLayout> allPlugins) {
-    this.includedModules = includedModules
+  DistributionJARsBuilder(BuildContext buildContext, List<PluginLayout> allPlugins) {
     this.buildContext = buildContext
     this.allPlugins = allPlugins
     buildContext.ant.patternset(id: RESOURCES_INCLUDED) {
-      include(name: "**/*.properties")
+      include(name: "**/*Bundle*.properties")
+      include(name: "**/*Messages.properties")
+      include(name: "messages/**/*.properties")
       include(name: "fileTemplates/**")
       include(name: "inspectionDescriptions/**")
       include(name: "intentionDescriptions/**")
@@ -70,7 +69,9 @@ class DistributionJARsBuilder {
     }
 
     buildContext.ant.patternset(id: RESOURCES_EXCLUDED) {
-      exclude(name: "**/*.properties")
+      exclude(name: "**/*Bundle*.properties")
+      exclude(name: "**/*Messages.properties")
+      exclude(name: "messages/**/*.properties")
       exclude(name: "fileTemplates/**")
       exclude(name: "fileTemplates")
       exclude(name: "inspectionDescriptions/**")
@@ -81,6 +82,66 @@ class DistributionJARsBuilder {
       exclude(name: "tips")
       exclude(name: "search/**")
     }
+
+    def productLayout = buildContext.productProperties.productLayout
+
+    List<JpsLibrary> projectLibrariesUsedByPlugins = getPluginsByModules(productLayout.enabledPluginModules).collectMany { plugin ->
+      plugin.getActualModules(productLayout.enabledPluginModules).values().collectMany {
+        def module = buildContext.findRequiredModule(it)
+        JpsJavaExtensionService.dependencies(module).includedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME).libraries.findAll {
+          !(it.createReference().parentReference instanceof JpsModuleReference) && !plugin.includedProjectLibraries.contains(it.name)
+        }
+      }
+    }
+
+    platform = PlatformLayout.platform {
+      productLayout.additionalPlatformJars.entrySet().each {
+        def jarName = it.key
+        it.value.each {
+          withModule(it, jarName)
+        }
+      }
+      productLayout.platformApiModules.each {
+        withModule(it, "openapi.jar")
+      }
+      productLayout.platformImplementationModules.each {
+        withModule(it, productLayout.mainJarName)
+      }
+      withModule("util")
+      withModule("util-rt", "util.jar")
+      withModule("annotations")
+      withModule("annotations-common", "annotations.jar")
+      withModule("extensions")
+      withModule("bootstrap")
+      withModule("forms_rt")
+      withModule("icons")
+      withModule("boot")
+      withModule("platform-resources", "resources.jar")
+      withModule("colorSchemes", "resources.jar")
+      withModule("platform-resources-en", productLayout.mainJarName)
+      withModule("coverage-common", productLayout.mainJarName)
+
+      ["linux", "macosx", "win"].each {
+        withResource("lib/libpty/$it", "lib/libpty/$it")
+      }
+
+      withResource("lib/src/trove4j_src.jar", "lib/src")
+
+      projectLibrariesUsedByPlugins.each {
+        if (!productLayout.projectLibrariesToUnpackIntoMainJar.contains(it.name)) {
+          withProjectLibrary(it.name)
+        }
+      }
+      productLayout.projectLibrariesToUnpackIntoMainJar.each {
+        withProjectLibraryUnpackedIntoJar(it, productLayout.mainJarName)
+      }
+      withProjectLibrariesFromIncludedModules(buildContext)
+    }
+  }
+
+  List<String> getPlatformModules() {
+    (platform.moduleJars.values() as List<String>) +
+    ["java-runtime"] //required to build searchable options index
   }
 
   void buildJARs() {
@@ -127,107 +188,17 @@ class DistributionJARsBuilder {
       layoutBuilder.patchModuleOutput("platform-resources", FileUtil.toSystemIndependentName(patchedKeyMapDir.absolutePath))
     }
 
-    Set<String> usedJars = collectUsedJars(includedModules, []) - productLayout.additionalJarsToUnpackIntoMainJar.collect {FileUtil.toSystemIndependentName(it)}
+    buildByLayout(layoutBuilder, platform, buildContext.paths.distAll, platform.moduleJars)
 
     if (buildContext.proprietaryBuildTools.scrambleTool != null) {
       def forbiddenJarNames = buildContext.proprietaryBuildTools.scrambleTool.namesOfJarsRequiredToBeScrambled
-      def forbiddenJars = usedJars.findAll { forbiddenJarNames.contains(PathUtilRt.getFileName(it)) }
+      def packagedFiles = new File(buildContext.paths.distAll, "lib").listFiles()
+      def forbiddenJars = packagedFiles.findAll { forbiddenJarNames.contains(it.name) }
       if (!forbiddenJars.empty) {
-        buildContext.messages.error("The following JARs cannot be included into the product 'lib' directory, they need to be scrambled with the main jar: ${forbiddenJars}")
+        buildContext.messages.error( "The following JARs cannot be included into the product 'lib' directory, they need to be scrambled with the main jar: ${forbiddenJars}")
       }
     }
 
-    def communityHome = "$buildContext.paths.communityHome"
-    def resourcesIncluded = RESOURCES_INCLUDED
-    def resourcesExcluded = RESOURCES_EXCLUDED
-
-    layoutBuilder.layout("$buildContext.paths.distAll/lib") {
-      jar("util.jar") {
-        module("util")
-        module("util-rt")
-      }
-      jar("openapi.jar") {
-        productLayout.platformApiModules.each { module it }
-      }
-
-      jar("annotations.jar") {
-        module("annotations-common")
-        module("annotations")
-      }
-      jar("extensions.jar") { module("extensions") }
-      jar("bootstrap.jar") { module("bootstrap") }
-      jar("resources.jar", true) {
-        modulePatches(["platform-resources"])
-        module("colorSchemes")
-        module("platform-resources")
-      }
-
-      jar("forms_rt.jar") { module("forms_rt") }
-
-      productLayout.additionalPlatformModules.entrySet().findAll { it.value != productLayout.mainJarName }.each {
-        def moduleName = it.key
-        jar(it.value) {
-          module(moduleName) {
-            ant.patternset(refid: resourcesExcluded)
-          }
-        }
-      }
-
-      jar("resources_en.jar", true) {
-        productLayout.additionalPlatformModules.keySet().each {
-          modulePatches([it]) {
-            ant.patternset(refid: resourcesIncluded)
-          }
-          module(it) {
-            ant.patternset(refid: resourcesIncluded)
-          }
-        }
-        module("platform-resources-en")
-        module("coverage-common") {
-          ant.patternset(refid: resourcesIncluded)
-        }
-      }
-
-      jar("icons.jar") { module("icons") }
-      jar("boot.jar") { module("boot") }
-      projectLibrary("KotlinJavaRuntime")
-
-      jar(productLayout.mainJarName, true, false) {
-        modulePatches(productLayout.platformImplementationModules)
-        productLayout.platformImplementationModules.each { module it }
-        module("coverage-common") {
-          ant.patternset(refid: resourcesExcluded)
-        }
-        productLayout.additionalPlatformModules.entrySet().findAll {it.value == productLayout.mainJarName}.each {
-          modulePatches([it.key]) {
-            ant.patternset(refid: resourcesExcluded)
-          }
-          module(it.key) {
-            ant.patternset(refid: resourcesExcluded)
-          }
-        }
-        productLayout.additionalJarsToUnpackIntoMainJar.each {
-          ant.zipfileset(src: it)
-        }
-      }
-
-      usedJars.each {
-        ant.fileset(file: it)
-      }
-
-      dir("libpty") {
-        ant.fileset(dir: "$communityHome/lib/libpty") {
-          exclude(name: "*.txt")
-        }
-      }
-
-      dir("src") {
-        ant.fileset(dir: "$communityHome/lib/src") {
-          include(name: "trove4j_changes.txt")
-          include(name: "trove4j_src.jar")
-        }
-      }
-    }
     usedModules.addAll(layoutBuilder.usedModules)
   }
 
@@ -265,89 +236,98 @@ class DistributionJARsBuilder {
     }
   }
 
-  private List<PluginLayout> getPluginsByModules(List<String> modules) {
+  private List<PluginLayout> getPluginsByModules(Collection<String> modules) {
     def modulesToInclude = modules as Set<String>
     allPlugins.findAll { modulesToInclude.contains(it.mainModule) }
   }
 
-  private buildPlugins(LayoutBuilder layoutBuilder, List<PluginLayout> pluginsToInclude, String targetDirectory) {
+  private void buildPlugins(LayoutBuilder layoutBuilder, List<PluginLayout> pluginsToInclude, String targetDirectory) {
+    def enabledModulesSet = buildContext.productProperties.productLayout.enabledPluginModules
+    pluginsToInclude.each { plugin ->
+      def actualModuleJars = plugin.getActualModules(enabledModulesSet)
+      buildByLayout(layoutBuilder, plugin, "$targetDirectory/$plugin.directoryName", actualModuleJars)
+    }
+  }
+
+  private void buildByLayout(LayoutBuilder layoutBuilder, BaseLayout layout, String targetDirectory, MultiValuesMap<String, String> moduleJars) {
     def ant = buildContext.ant
     def resourceExcluded = RESOURCES_EXCLUDED
     def resourcesIncluded = RESOURCES_INCLUDED
-    def enabledModulesSet = buildContext.productProperties.productLayout.enabledPluginModules
+    def buildContext = buildContext
     layoutBuilder.layout(targetDirectory) {
-      pluginsToInclude.each { plugin ->
-        dir(plugin.directoryName) {
-          dir("lib") {
-            def actualModuleJars = plugin.getActualModules(enabledModulesSet)
-            actualModuleJars.entrySet().each {
-              def modules = it.value
-              def jarPath = it.key
-              jar(jarPath, true) {
-                modulePatches(modules)
-                modules.each { moduleName ->
-                  module(moduleName) {
-                    if (plugin.packLocalizableResourcesInCommonJar(moduleName)) {
-                      ant.patternset(refid: resourceExcluded)
-                    }
-                    plugin.moduleExcludes.get(moduleName)?.each {
-                      ant.exclude(name: "$it/**")
-                    }
-                  }
+      dir("lib") {
+        moduleJars.entrySet().each {
+          def modules = it.value
+          def jarPath = it.key
+          jar(jarPath, true) {
+            modulePatches(modules)
+            modules.each { moduleName ->
+              module(moduleName) {
+                if (layout.packLocalizableResourcesInCommonJar(moduleName)) {
+                  ant.patternset(refid: resourceExcluded)
                 }
-              }
-            }
-            def modulesWithResources = actualModuleJars.values().findAll { plugin.packLocalizableResourcesInCommonJar(it) }
-            if (!modulesWithResources.empty) {
-              jar("resources_en.jar") {
-                modulesWithResources.each {
-                  module(it) {
-                    ant.patternset(refid: resourcesIncluded)
-                  }
+                layout.moduleExcludes.get(moduleName)?.each {
+                  ant.exclude(name: "$it/**")
                 }
               }
             }
-            plugin.includedProjectLibraries.each {
-              projectLibrary(it)
-            }
-
-            //include all module libraries from the plugin modules added to IDE classpath to layout
-            actualModuleJars.entrySet().findAll {!it.key.contains("/")}.collectMany {it.value}.each { moduleName ->
-              findModule(moduleName).dependenciesList.dependencies.
-                findAll { it instanceof JpsLibraryDependency && it?.libraryReference?.parentReference?.resolve() instanceof JpsModule}.
-                findAll { JpsJavaExtensionService.instance.getDependencyExtension(it)?.scope?.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME) ?: false}.
-                each {
-                  jpsLibrary(((JpsLibraryDependency)it).library)
-                }
-            }
-
-            plugin.includedModuleLibraries.each { data ->
-              dir(data.relativeOutputPath) {
-                moduleLibrary(data.moduleName, data.libraryName)
+            layout.projectLibrariesToUnpack.get(jarPath)?.each {
+              buildContext.project.libraryCollection.findLibrary(it)?.getFiles(JpsOrderRootType.COMPILED)?.each {
+                ant.zipfileset(src: it.absolutePath)
               }
             }
           }
-          plugin.resourcePaths.entrySet().each {
-            def contentRoot = JpsPathUtil.urlToPath(findModule(plugin.mainModule).contentRootsList.urls.first())
-            def path = FileUtil.toSystemIndependentName(new File("$contentRoot/$it.key").absolutePath)
-            dir(it.value) {
-              if (new File(path).isFile()) {
-                ant.fileset(file: path)
+        }
+        def modulesWithResources = moduleJars.values().findAll { layout.packLocalizableResourcesInCommonJar(it) }
+        if (!modulesWithResources.empty) {
+          jar("resources_en.jar", true) {
+            modulesWithResources.each {
+              modulePatches([it]) {
+                ant.patternset(refid: resourcesIncluded)
               }
-              else {
-                ant.fileset(dir: path)
+              module(it) {
+                ant.patternset(refid: resourcesIncluded)
               }
             }
           }
-          plugin.resourceArchivePaths.entrySet().each {
-            def contentRoot = JpsPathUtil.urlToPath(findModule(plugin.mainModule).contentRootsList.urls.first())
-            def path = "$contentRoot/$it.key"
-            zip(it.value) {
-              ant.fileset(dir: path)
+        }
+        layout.includedProjectLibraries.each {
+          projectLibrary(it)
+        }
+
+        //include all module libraries from the plugin modules added to IDE classpath to layout
+        moduleJars.entrySet().findAll { !it.key.contains("/") }.collectMany { it.value }.each { moduleName ->
+          findModule(moduleName).dependenciesList.dependencies.
+            findAll { it instanceof JpsLibraryDependency && it?.libraryReference?.parentReference?.resolve() instanceof JpsModule }.
+            findAll { JpsJavaExtensionService.instance.getDependencyExtension(it)?.scope?.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME) ?: false }.
+            each {
+              jpsLibrary(((JpsLibraryDependency)it).library)
             }
+        }
+
+        layout.includedModuleLibraries.each { data ->
+          dir(data.relativeOutputPath) {
+            moduleLibrary(data.moduleName, data.libraryName)
+          }
+        }
+      }
+      layout.resourcePaths.entrySet().each {
+        def path = FileUtil.toSystemIndependentName(new File("${layout.basePath(buildContext)}/$it.key").absolutePath)
+        dir(it.value) {
+          if (new File(path).isFile()) {
+            ant.fileset(file: path)
+          }
+          else {
+            ant.fileset(dir: path)
           }
         }
       }
+      layout.resourceArchivePaths.entrySet().each {
+        def path = "${layout.basePath(buildContext)}/$it.key"
+        zip(it.value) {
+          ant.fileset(dir: path)
+        }
+      }
     }
   }
 
@@ -380,32 +360,6 @@ class DistributionJARsBuilder {
     }
   }
 
-  private Set<String> collectUsedJars(List<String> modules, List<String> additionalLibFolders) {
-    def usedJars = new LinkedHashSet<String>();
-    List<String> approvedJars =
-      (["$buildContext.paths.communityHome/lib", "$buildContext.paths.projectHome/lib", "$buildContext.paths.communityHome/xml/relaxng/lib"] as List<String>) +
-      additionalLibFolders
-
-    modules.each {
-      def module = buildContext.findModule(it)
-      if (module != null) {
-        buildContext.projectBuilder.moduleRuntimeClasspath(module, false).each {
-          File file = new File(it)
-          if (file.exists()) {
-            String path = FileUtil.toSystemIndependentName(file.canonicalPath)
-            if (path.endsWith(".jar") && approvedJars.any { FileUtil.startsWith(path, it) }) {
-              if (usedJars.add(path)) {
-                buildContext.messages.info("\tADDED: $path for $module.name")
-              }
-            }
-          }
-        }
-      }
-    }
-
-    return usedJars
-  }
-
   private File createKeyMapWithAltClickReassignedToMultipleCarets() {
     def sourceFile = new File("${buildContext.projectBuilder.moduleOutput(buildContext.findModule("platform-resources"))}/idea/Keymap_Default.xml")
     String defaultKeymapContent = sourceFile.text
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/ModuleLibraryData.groovy b/build/groovy/org/jetbrains/intellij/build/impl/ModuleLibraryData.groovy
new file mode 100644 (file)
index 0000000..5795683
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Copyright 2000-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 org.jetbrains.intellij.build.impl
+
+import groovy.transform.Immutable
+
+/**
+ * @author nik
+ */
+@Immutable
+class ModuleLibraryData {
+  String moduleName
+  String libraryName
+  String relativeOutputPath
+}
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/PlatformLayout.groovy b/build/groovy/org/jetbrains/intellij/build/impl/PlatformLayout.groovy
new file mode 100644 (file)
index 0000000..f441908
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2000-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Copyright 2000-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 org.jetbrains.intellij.build.impl
+
+import org.jetbrains.intellij.build.BuildContext
+import org.jetbrains.jps.model.java.JpsJavaClasspathKind
+import org.jetbrains.jps.model.java.JpsJavaExtensionService
+import org.jetbrains.jps.model.module.JpsModule
+import org.jetbrains.jps.model.module.JpsModuleReference
+
+/**
+ * @author nik
+ */
+class PlatformLayout extends BaseLayout {
+  static PlatformLayout platform(@DelegatesTo(PlatformLayoutSpec) Closure body = {}) {
+    def layout = new PlatformLayout()
+    def spec = new PlatformLayoutSpec(layout)
+    body.delegate = spec
+    body()
+    return layout
+  }
+
+  @Override
+  String basePath(BuildContext buildContext) {
+    buildContext.paths.communityHome
+  }
+
+  static class PlatformLayoutSpec extends BaseLayoutSpec {
+    PlatformLayoutSpec(PlatformLayout layout) {
+      super(layout)
+    }
+
+    /**
+     * Include all project libraries from dependencies of modules already included into layout to 'lib' directory
+     */
+    void withProjectLibrariesFromIncludedModules(BuildContext context) {
+      layout.moduleJars.values().each {
+        def module = context.findRequiredModule(it)
+        JpsJavaExtensionService.dependencies(module).includedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME).libraries.findAll {
+          !(it.createReference().parentReference instanceof JpsModuleReference) && !layout.projectLibrariesToUnpack.values().contains(it.name)
+        }.each {
+          withProjectLibrary(it.name)
+        }
+      }
+    }
+
+    /**
+     * Include contents of JARs of the project library {@code libraryName} into JAR {@code jarName}
+     */
+    void withProjectLibraryUnpackedIntoJar(String libraryName, String jarName) {
+      layout.projectLibrariesToUnpack.put(jarName, libraryName)
+    }
+  }
+}
\ No newline at end of file
index 179c21f37d3a9ebe29bcda2cf8f7dce8d53d92bb..d8dd956f3761714a3fc03abb179d4c0ec3f6cf12 100644 (file)
@@ -32,32 +32,25 @@ package org.jetbrains.intellij.build.impl
 
 import com.intellij.openapi.util.MultiValuesMap
 import groovy.transform.Immutable
+import org.jetbrains.intellij.build.BuildContext
+import org.jetbrains.jps.util.JpsPathUtil
 
 /**
+ * Described layout of a plugin in the product distribution
+ *
  * @author nik
  */
-class PluginLayout {
+class PluginLayout extends BaseLayout {
   final String mainModule
   String directoryName
-  /** JAR name (or path relative to 'lib' directory) to module name */
-  final MultiValuesMap<String, String> moduleJars = new MultiValuesMap<>(true)
-  /** source directory -> relative path to a target directory under the plugin directory */
-  final Map<String, String> resourcePaths = [:]
-  /** source directory -> relative path to a zip file under the plugin directory */
-  final Map<String, String> resourceArchivePaths = [:]
-  /** module name to entries which should be excluded from its output */
-  final MultiValuesMap<String, String> moduleExcludes = new MultiValuesMap<>(true)
-  final List<String> includedProjectLibraries = []
-  final List<ModuleLibraryData> includedModuleLibraries = []
   final Set<String> optionalModules = new LinkedHashSet<>()
-  private final Set<String> modulesWithLocalizableResourcesInCommonJar = new LinkedHashSet<>()
   private boolean doNotCreateSeparateJarForLocalizableResources
 
   private PluginLayout(String mainModule) {
     this.mainModule = mainModule
   }
 
-  /**
+/**
    * Creates the plugin layout description. The default plugin layout is composed of a jar with name {@code mainModuleName}.jar containing output of
    * {@code mainModuleName}, resources_en.jar containing translatable resources from {@code mainModuleName}, and the module libraries of
    * {@code mainModuleName} with scopes 'Compile' and 'Runtime' placed under 'lib' directory in a directory with name {@code mainModuleName}.
@@ -90,11 +83,12 @@ class PluginLayout {
     return result
   }
 
-  boolean packLocalizableResourcesInCommonJar(String moduleName) {
-    return modulesWithLocalizableResourcesInCommonJar.contains(moduleName)
+  @Override
+  String basePath(BuildContext buildContext) {
+    JpsPathUtil.urlToPath(buildContext.findRequiredModule(mainModule).contentRootsList.urls.first())
   }
 
-  static class PluginLayoutSpec {
+  static class PluginLayoutSpec extends BaseLayoutSpec {
     private final PluginLayout layout
     /**
      * Name of the directory (under 'plugins' directory) where the plugin should be placed
@@ -106,6 +100,7 @@ class PluginLayout {
     String mainJarName
 
     PluginLayoutSpec(PluginLayout layout) {
+      super(layout)
       this.layout = layout
       directoryName = layout.mainModule
       mainJarName = "${layout.mainModule}.jar"
@@ -119,82 +114,17 @@ class PluginLayout {
       withModule(moduleName, relativeJarPath)
     }
 
-    /**
-     * Register an additional module to be included into the plugin distribution. If {@code relativeJarPath} doesn't contain '/' (i.e. the
-     * JAR will be added to the plugin's classpath) this will also cause modules library from {@code moduleName} with scopes 'Compile' and
-     * 'Runtime' to be copied to the 'lib' directory of the plugin.
-     *
-     * @param relativeJarPath target JAR path relative to 'lib' directory of the plugin; different modules may be packed into the same JAR,
-     * but don't use this for new plugins; this parameter is temporary added to keep layout of old plugins.
-     * @param localizableResourcesInCommonJar if {@code true} the translatable resources from the module (messages, inspection descriptions, etc) will be
-     * placed into a separate 'resources_en.jar'. <strong>Do not use this for new plugins, this parameter is temporary added to keep layout of old plugins</strong>.
-     */
-    void withModule(String moduleName, String relativeJarPath = "${moduleName}.jar", boolean localizableResourcesInCommonJar = true) {
-      if (localizableResourcesInCommonJar) {
-        layout.modulesWithLocalizableResourcesInCommonJar << moduleName
-      }
-      layout.moduleJars.put(relativeJarPath, moduleName)
-    }
-
     void withJpsModule(String moduleName) {
       withModule(moduleName, "jps/${moduleName}.jar")
     }
 
-    /**
-     * @param resourcePath path to resource file or directory relative to the plugin's main module content root
-     * @param relativeOutputDirectory target path relative to the plugin root directory
-     */
-    void withResource(String resourcePath, String relativeOutputDirectory) {
-      layout.resourcePaths[resourcePath] = relativeOutputDirectory
-    }
-
-    /**
-     * @param resourcePath path to resource file or directory relative to the plugin's main module content root
-     * @param relativeOutputFile target path relative to the plugin root directory
-     */
-    void withResourceArchive(String resourcePath, String relativeOutputFile) {
-      layout.resourceArchivePaths[resourcePath] = relativeOutputFile
-    }
-
-    /**
-     * Include the project library to 'lib' directory of the plugin distribution
-     */
-    void withProjectLibrary(String libraryName) {
-      layout.includedProjectLibraries << libraryName
-    }
-
-    /**
-     * Include the module library to the plugin distribution. Please note that it makes sense to call this method only
-     * for additional modules which aren't copied directly to the 'lib' directory of the plugin distribution, because for ordinary modules
-     * their module libraries are included into the layout automatically.
-     */
-    void withModuleLibrary(String libraryName, String moduleName = layout.mainModule, String relativeOutputPath) {
-      layout.includedModuleLibraries << new ModuleLibraryData(moduleName: moduleName, libraryName: libraryName, relativeOutputPath: relativeOutputPath)
-    }
-
-    /**
-     * Exclude the specified directory when {@code moduleName} is packed into JAR file.
-     * <strong>This is a temporary method added to keep layout of some old plugins. If some directory from a module shouldn't be included into the
-     * module JAR it's strongly recommended to move that directory outside of the module source roots.</strong>
-     * @param excludedDirectory path to the directory to be exclude relatively to the module output root
-     */
-    void excludeFromModule(String moduleName, String excludedDirectory) {
-      layout.moduleExcludes.put(moduleName, excludedDirectory)
-    }
 
     /**
      * Do not create 'resources_en.jar' and pack all resources into corresponding module JARs.
      * <strong>Do not use this for new plugins, this method is temporary added to keep layout of old plugins</strong>.
      */
-    void doNotCreateSeperateJarForLocalizableResources() {
+    void doNotCreateSeparateJarForLocalizableResources() {
       layout.doNotCreateSeparateJarForLocalizableResources = true
     }
   }
-
-  @Immutable
-  static class ModuleLibraryData {
-    String moduleName
-    String libraryName
-    String relativeOutputPath
-  }
 }
\ No newline at end of file
index 80aa006080e686fd3a9c5a63610edbcce97c6e11..271d4c3087e1e08a58841eae2737224cbebbf3ab 100644 (file)
@@ -898,6 +898,11 @@ def layoutJps(String home, String targetDir, String buildNumber, Closure additio
 
 
       jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
+      jar("aether-dependency-resolver.jar") { module("aether-dependency-resolver") }
+      fileset(dir: "$home/plugins/maven/lib") {
+        include(name: "aether-*.jar")
+        include(name: "maven-aether-provider-*.jar")
+      }
       jar("gradle-jps-plugin.jar") { module("gradle-jps-plugin") }
       fileset(dir: "$home/plugins/maven/maven30-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
 
index 3e6c5f64b6cb3d04af73675b276d8d91333d822b..62e5917b2d2c662760a94ee8296c4e89ac782e81 100644 (file)
@@ -52,7 +52,7 @@ public class ProblemsViewImpl extends ProblemsView{
   private static final EnumSet<ErrorTreeElementKind> ALL_MESSAGE_KINDS = EnumSet.allOf(ErrorTreeElementKind.class);
 
   private final ProblemsViewPanel myPanel;
-  private final ExecutorService myViewUpdater = SequentialTaskExecutor.createSequentialApplicationPoolExecutor();
+  private final ExecutorService myViewUpdater = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("ProblemsView pool");
   private final Icon myActiveIcon = AllIcons.Toolwindows.Problems;
   private final Icon myPassiveIcon = IconLoader.getDisabledIcon(myActiveIcon);
 
index 1f08d8913a5c17d522509aa7a88fa1134a94c32e..f56391e3a0c88e62019b71949da5c5a371b0c457 100644 (file)
@@ -160,7 +160,7 @@ public class BuildManager implements Disposable {
   private final Map<String, Future<Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler>>> myPreloadedBuilds =
     Collections.synchronizedMap(new HashMap<String, Future<Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler>>>());
   private final BuildProcessClasspathManager myClasspathManager = new BuildProcessClasspathManager();
-  private final ExecutorService myRequestsProcessor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor();
+  private final ExecutorService myRequestsProcessor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("BuildManager requestProcessor pool");
   private final Map<String, ProjectData> myProjectDataMap = Collections.synchronizedMap(new HashMap<String, ProjectData>());
 
   private final BuildManagerPeriodicTask myAutoMakeTask = new BuildManagerPeriodicTask(this) {
@@ -856,7 +856,7 @@ public class BuildManager implements Disposable {
     synchronized (myProjectDataMap) {
       ProjectData data = myProjectDataMap.get(projectPath);
       if (data == null) {
-        data = new ProjectData(SequentialTaskExecutor.createSequentialApplicationPoolExecutor());
+        data = new ProjectData(SequentialTaskExecutor.createSequentialApplicationPoolExecutor("BuildManager pool"));
         myProjectDataMap.put(projectPath, data);
       }
       return data;
index 5d392abe3213901913b774f524aa65551e9c4abd..4105ecbffb7b213bf17c8886fa3d29c0f1513e42 100644 (file)
@@ -51,7 +51,7 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler {
   private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.DefaultMessageHandler");
   public static final long CONSTANT_SEARCH_TIME_LIMIT = 60 * 1000L; // one minute
   private final Project myProject;
-  private final ExecutorService myTaskExecutor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor();
+  private final ExecutorService myTaskExecutor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("DefaultMessageHandler pool");
   private volatile long myConstantSearchTime = 0L;
 
   protected DefaultMessageHandler(Project project) {
index 85f452fcec1a603b4734eadf6c35dd950a4761f1..d6cd833154385acabc7608a103a3f525294afc36 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.debugger;
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.ExecutionResult;
 import com.intellij.execution.configurations.RemoteConnection;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.search.GlobalSearchScope;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -36,6 +37,11 @@ public interface DebugEnvironment {
   @NotNull
   GlobalSearchScope getSearchScope();
 
+  @Nullable
+  default Sdk getAlternativeJre() {
+    return null;
+  }
+
   boolean isRemote();
 
   RemoteConnection getRemoteConnection();
index 5cfee964e7d6f936753daa5bbdbbe896899ea4b7..e4d6499f6e42d4d28a0abe434cc0526e96a6b2bb 100644 (file)
  */
 package com.intellij.debugger;
 
+import com.intellij.debugger.impl.AlternativeJreIndexHelper;
 import com.intellij.debugger.impl.DebuggerManagerImpl;
 import com.intellij.debugger.settings.DebuggerSettings;
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.ExecutionResult;
 import com.intellij.execution.configurations.*;
 import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.search.GlobalSearchScope;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 public class DefaultDebugEnvironment implements DebugEnvironment {
   private final GlobalSearchScope mySearchScope;
@@ -87,4 +90,10 @@ public class DefaultDebugEnvironment implements DebugEnvironment {
   public String getSessionName() {
     return environment.getRunProfile().getName();
   }
+
+  @Nullable
+  @Override
+  public Sdk getAlternativeJre() {
+    return AlternativeJreIndexHelper.getAlternativeJre(environment.getRunProfile());
+  }
 }
index 6c1e55e3db4b5b23286a37daf8805830f5f322f8..25188dd36f7d94a477d8cc8ce7e54de2656ff00a 100644 (file)
@@ -20,13 +20,16 @@ import com.intellij.debugger.NoDataException;
 import com.intellij.debugger.PositionManager;
 import com.intellij.debugger.SourcePosition;
 import com.intellij.debugger.engine.evaluation.EvaluateException;
+import com.intellij.debugger.impl.AlternativeJreIndexHelper;
 import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
 import com.intellij.debugger.requests.ClassPrepareRequestor;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.NullableComputable;
 import com.intellij.openapi.util.Ref;
@@ -35,8 +38,11 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.psi.*;
+import com.intellij.psi.impl.compiled.ClsClassImpl;
+import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
 import com.intellij.psi.search.FilenameIndex;
 import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StubIndex;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.DocumentUtil;
 import com.intellij.util.containers.ContainerUtil;
@@ -351,13 +357,39 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
     //}
 
     final String originalQName = refType.name();
-    final GlobalSearchScope searchScope = myDebugProcess.getSearchScope();
-    PsiClass psiClass = DebuggerUtils.findClass(originalQName, project, searchScope); // try to lookup original name first
+
+    PsiClass psiClass = null;
+
+    // first check alternative jre if any
+    Sdk alternativeJre = myDebugProcess.getSession().getAlternativeJre();
+    if (alternativeJre != null) {
+      try {
+        psiClass = ContainerUtil.getFirstItem(StubIndex.getElements(JavaStubIndexKeys.CLASS_FQN,
+                                                                    originalQName.hashCode(),
+                                                                    project,
+                                                                    AlternativeJreIndexHelper.getSearchScope(alternativeJre),
+                                                                    PsiClass.class));
+
+        if (psiClass instanceof ClsClassImpl) { //try to find sources
+          PsiFile psiSource = findSourceFile((ClsClassImpl)psiClass, alternativeJre);
+          if (psiSource != null) {
+            return psiSource;
+          }
+        }
+      }
+      catch (IndexNotReadyException ignored) {
+      }
+    }
+
     if (psiClass == null) {
-      int dollar = originalQName.indexOf('$');
-      if (dollar > 0) {
-        final String qName = originalQName.substring(0, dollar);
-        psiClass = DebuggerUtils.findClass(qName, project, searchScope);
+      GlobalSearchScope searchScope = myDebugProcess.getSearchScope();
+      psiClass = DebuggerUtils.findClass(originalQName, project, searchScope); // try to lookup original name first
+      if (psiClass == null) {
+        int dollar = originalQName.indexOf('$');
+        if (dollar > 0) {
+          final String qName = originalQName.substring(0, dollar);
+          psiClass = DebuggerUtils.findClass(qName, project, searchScope);
+        }
       }
     }
 
@@ -393,6 +425,24 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
     return null;
   }
 
+  @Nullable
+  private static PsiFile findSourceFile(ClsClassImpl psiClass, Sdk alternativeJre) {
+    String sourceFileName = psiClass.getSourceFileName();
+    String packageName = ((PsiClassOwner)psiClass.getContainingFile()).getPackageName();
+    String relativePath = packageName.isEmpty() ? sourceFileName : packageName.replace('.', '/') + '/' + sourceFileName;
+
+    for (VirtualFile file : AlternativeJreIndexHelper.getSourceRoots(alternativeJre)) {
+      VirtualFile source = file.findFileByRelativePath(relativePath);
+      if (source != null && source.isValid()) {
+        PsiFile psiSource = psiClass.getManager().findFile(source);
+        if (psiSource instanceof PsiClassOwner) {
+          return psiSource;
+        }
+      }
+    }
+    return null;
+  }
+
   @NotNull
   public List<ReferenceType> getAllClasses(@NotNull final SourcePosition position) throws NoDataException {
     return ApplicationManager.getApplication().runReadAction(new Computable<List<ReferenceType>>() {
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/AlternativeJreIndexHelper.java b/java/debugger/impl/src/com/intellij/debugger/impl/AlternativeJreIndexHelper.java
new file mode 100644 (file)
index 0000000..8428225
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * 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.debugger.impl;
+
+import com.intellij.execution.RunManager;
+import com.intellij.execution.configurations.ConfigurationWithAlternativeJre;
+import com.intellij.execution.configurations.RunConfiguration;
+import com.intellij.execution.configurations.RunProfile;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.ProjectJdkTable;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.NonClasspathDirectoriesScope;
+import com.intellij.util.containers.SmartHashSet;
+import com.intellij.util.indexing.IndexableSetContributor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author egor
+ */
+public class AlternativeJreIndexHelper extends IndexableSetContributor {
+  @NotNull
+  @Override
+  public Set<VirtualFile> getAdditionalRootsToIndex() {
+    return Collections.emptySet();
+  }
+
+  @NotNull
+  @Override
+  public Set<VirtualFile> getAdditionalProjectRootsToIndex(@NotNull Project project) {
+    SmartHashSet<VirtualFile> res = new SmartHashSet<>();
+    for (RunConfiguration configuration : RunManager.getInstance(project).getAllConfigurationsList()) {
+      Sdk jre = getAlternativeJre(configuration);
+      if (jre != null) {
+        res.addAll(getClassRoots(jre));
+      }
+    }
+    return res;
+  }
+
+  @Nullable
+  public static Sdk getAlternativeJre(RunProfile profile) {
+    if (profile instanceof ConfigurationWithAlternativeJre) {
+      ConfigurationWithAlternativeJre appConfig = (ConfigurationWithAlternativeJre)profile;
+      if (appConfig.isAlternativeJrePathEnabled()) {
+        return ProjectJdkTable.getInstance().findJdk(appConfig.getAlternativeJrePath());
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  private static Collection<VirtualFile> getClassRoots(@NotNull Sdk jre) {
+    return Arrays.asList(jre.getRootProvider().getFiles(OrderRootType.CLASSES));
+  }
+
+  @NotNull
+  public static Collection<VirtualFile> getSourceRoots(@NotNull Sdk jre) {
+    return Arrays.asList(jre.getRootProvider().getFiles(OrderRootType.SOURCES));
+  }
+
+  @Nullable
+  public static GlobalSearchScope getSearchScope(@NotNull Sdk jre) {
+    return new NonClasspathDirectoriesScope(getClassRoots(jre));
+  }
+}
index 1b66288e086e3ff73fb152d26733480dc0f0a3e0..005fdd6bf59cb36f4d795c87d3200d5b00c00eb4 100644 (file)
@@ -42,6 +42,7 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Disposer;
@@ -91,6 +92,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
   private final String mySessionName;
   private final DebugProcessImpl myDebugProcess;
   private final GlobalSearchScope mySearchScope;
+  private final Sdk myAlternativeJre;
 
   private final DebuggerContextImpl SESSION_EMPTY_CONTEXT;
   //Thread, user is currently stepping through
@@ -117,6 +119,10 @@ public class DebuggerSession implements AbstractDebuggerSession {
     return mySearchScope;
   }
 
+  public Sdk getAlternativeJre() {
+    return myAlternativeJre;
+  }
+
   public boolean isModifiedClassesScanRequired() {
     return myModifiedClassesScanRequired;
   }
@@ -207,6 +213,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
     myDebugProcess.addEvaluationListener(new MyEvaluationListener());
     ValueLookupManager.getInstance(getProject()).startListening();
     mySearchScope = environment.getSearchScope();
+    myAlternativeJre = environment.getAlternativeJre();
   }
 
   @NotNull
index e30b4a18a5634a1902bda2e77312a83ed7fb5d31..3570bdeb3ce3c09c3c466e2ffd0609af78917dff 100644 (file)
@@ -33,7 +33,9 @@ import com.intellij.execution.runners.JavaPatchableProgramRunner;
 import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.options.SettingsEditor;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.indexing.UnindexedFilesUpdater;
 import com.intellij.xdebugger.XDebugProcess;
 import com.intellij.xdebugger.XDebugProcessStarter;
 import com.intellij.xdebugger.XDebugSession;
@@ -117,6 +119,11 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
 
     final DebugProcessImpl debugProcess = debuggerSession.getProcess();
 
+    // index alternative jdk if needed
+    if (AlternativeJreIndexHelper.getAlternativeJre(env.getRunProfile()) != null) {
+      DumbService.getInstance(debuggerSession.getProject()).queueTask(new UnindexedFilesUpdater(debuggerSession.getProject(), false));
+    }
+
     return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
       @Override
       @NotNull
index fa4de4318d94088d5bfd51b784ed3d11df2ad95e..9df298fabeb0dad81610efccf4e968f9b9ddcc71 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 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.
@@ -45,7 +45,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunConfigurationModule>
-  implements CommonJavaRunConfigurationParameters, SingleClassConfiguration, RefactoringListenerProvider {
+  implements CommonJavaRunConfigurationParameters, SingleClassConfiguration, RefactoringListenerProvider, ConfigurationWithAlternativeJre {
 
   public String MAIN_CLASS_NAME;
   public String VM_PARAMETERS;
similarity index 60%
rename from plugins/settings-repository/src/keychain/CredentialsStore.kt
rename to java/execution/openapi/src/com/intellij/execution/configurations/ConfigurationWithAlternativeJre.java
index b4618a39a39e01e11a7daf50feb60affaa42edc9..6c857cd9a1845eb0b39294bb2a8c255faa2f7f93 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.jetbrains.keychain
+package com.intellij.execution.configurations;
 
-import com.intellij.credentialStore.Credentials
-import com.intellij.openapi.diagnostic.Logger
+import org.jetbrains.annotations.Nullable;
 
-val LOG: Logger = Logger.getInstance(CredentialsStore::class.java)
-
-interface CredentialsStore {
-  fun get(host: String?, sshKeyFile: String? = null): Credentials?
-
-  fun save(host: String?, credentials: Credentials, sshKeyFile: String? = null)
+/**
+ * @author egor
+ */
+public interface ConfigurationWithAlternativeJre {
+  boolean isAlternativeJrePathEnabled();
 
-  fun reset(host: String)
+  @Nullable
+  String getAlternativeJrePath();
 }
index 676da93af17de76d6c8b4b12c5c26a0a0f5c027a..8476a7b2519ec75514782f38a813631e007e432d 100644 (file)
@@ -185,6 +185,10 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl
     }
   }
 
+  public void removeLibraryNode(@NotNull final Library library) {
+    removeLibrary(new LibraryProjectStructureElement(myContext, library));
+  }
+
   @Override
   public void dispose() {
     if (myContext != null) {
index 3fc02e597ccd8e9c3e14c3e4b52acf23570dd924..c64bc2ef0bd75122eec863c0a8079bca082ea12c 100644 (file)
@@ -76,6 +76,10 @@ public class LibrariesModifiableModel implements LibraryTableBase.ModifiableMode
     removeLibraryEditor(library);
     final Library existingLibrary = myTable.getLibraryByName(library.getName());
     getLibrariesModifiableModel().removeLibrary(library);
+
+    final BaseLibrariesConfigurable configurable = ProjectStructureConfigurable.getInstance(myProject).getConfigurableFor(library);
+    configurable.removeLibraryNode(library);
+
     if (existingLibrary == library) {
       myRemovedLibraries.add(library);
     } else {
index 8fd2b17879028f6437321965d2bca348d9b1b1db..c603d53670ac71deb4624355b5364922fad668f4 100644 (file)
@@ -18,5 +18,6 @@
     <orderEntry type="module" module-name="resources-en" />
     <orderEntry type="module" module-name="xml-psi-impl" />
     <orderEntry type="library" exported="" name="ASM" level="project" />
+    <orderEntry type="module" module-name="platform-impl" />
   </component>
 </module>
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPassFactory.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPassFactory.java
new file mode 100644 (file)
index 0000000..4a07ad4
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * 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;
+
+import com.intellij.codeHighlighting.EditorBoundHighlightingPass;
+import com.intellij.codeHighlighting.TextEditorHighlightingPass;
+import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory;
+import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
+import com.intellij.codeInsight.folding.impl.ParameterNameFoldingManager;
+import com.intellij.lang.folding.FoldingDescriptor;
+import com.intellij.openapi.components.AbstractProjectComponent;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.Inlay;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressIndicatorProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.registry.Registry;
+import com.intellij.psi.*;
+import com.intellij.util.containers.HashSet;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+public class ParameterHintsPassFactory extends AbstractProjectComponent implements TextEditorHighlightingPassFactory {
+  private static final Key<Boolean> REPEATED_PASS = Key.create("RepeatedParameterHintsPass");
+
+  public ParameterHintsPassFactory(Project project, TextEditorHighlightingPassRegistrar registrar) {
+    super(project);
+    registrar.registerTextEditorHighlightingPass(this, null, null, false, -1);
+  }
+
+  @Nullable
+  @Override
+  public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor editor) {
+    return new ParameterHintsPass(file, editor);
+  }
+
+  private static class ParameterHintsPass extends EditorBoundHighlightingPass {
+    private final Map<Integer, String> myAnnotations = new HashMap<>();
+
+    private ParameterHintsPass(@NotNull PsiFile file, @NotNull Editor editor) {
+      super(editor, file, true);
+    }
+
+    @Override
+    public void doCollectInformation(@NotNull ProgressIndicator progress) {
+      assert myDocument != null;
+      myAnnotations.clear();
+      if (!Registry.is("editor.inline.parameter.hints") || !(myFile instanceof PsiJavaFile)) return;
+      PsiJavaFile file = (PsiJavaFile) myFile;
+
+      PsiClass[] classes = file.getClasses();
+      for (PsiClass aClass : classes) {
+        ProgressIndicatorProvider.checkCanceled();
+        addElementsToFold(aClass);
+      }
+    }
+
+    private void addElementsToFold(PsiClass aClass) {
+      PsiElement[] children = aClass.getChildren();
+      for (PsiElement child : children) {
+        ProgressIndicatorProvider.checkCanceled();
+
+        if (child instanceof PsiMethod) {
+          PsiMethod method = (PsiMethod)child;
+          PsiCodeBlock body = method.getBody();
+          if (body != null) {
+            addCodeBlockFolds(body);
+          }
+        }
+        else if (child instanceof PsiField) {
+          PsiField field = (PsiField)child;
+          PsiExpression initializer = field.getInitializer();
+          if (initializer != null) {
+            addCodeBlockFolds(initializer);
+          } else if (field instanceof PsiEnumConstant) {
+            addCodeBlockFolds(field);
+          }
+        }
+        else if (child instanceof PsiClassInitializer) {
+          PsiClassInitializer initializer = (PsiClassInitializer)child;
+          addCodeBlockFolds(initializer);
+        }
+        else if (child instanceof PsiClass) {
+          addElementsToFold((PsiClass)child);
+        }
+      }
+    }
+
+    private void addCodeBlockFolds(PsiElement scope) {
+      scope.accept(new JavaRecursiveElementWalkingVisitor() {
+        @Override
+        public void visitClass(PsiClass aClass) {
+          addElementsToFold(aClass);
+        }
+
+        @Override
+        public void visitMethodCallExpression(PsiMethodCallExpression expression) {
+          inlineLiteralArgumentsNames(expression);
+          super.visitMethodCallExpression(expression);
+        }
+
+        @Override
+        public void visitNewExpression(PsiNewExpression expression) {
+          inlineLiteralArgumentsNames(expression);
+          super.visitNewExpression(expression);
+        }
+      });
+    }
+
+    private void inlineLiteralArgumentsNames(@NotNull PsiCallExpression expression) {
+      ParameterNameFoldingManager manager = new ParameterNameFoldingManager(expression);
+      List<FoldingDescriptor> descriptors = manager.getDescriptors();
+      for (FoldingDescriptor descriptor : descriptors) {
+        String text = descriptor.getPlaceholderText();
+        assert text != null;
+        int colonPos = text.indexOf(':');
+        myAnnotations.put(descriptor.getRange().getEndOffset(), text.substring(1, colonPos));
+      }
+    }
+
+    @Override
+    public void doApplyInformationToEditor() {
+      assert myDocument != null;
+      boolean firstTime = myEditor.getUserData(REPEATED_PASS) == null;
+      ParameterHintsPresentationManager presentationManager = ParameterHintsPresentationManager.getInstance();
+      Set<String> removedHints = new HashSet<>();
+      for (Inlay inlay : myEditor.getInlayModel().getInlineElementsInRange(0, myDocument.getTextLength())) {
+        if (!presentationManager.isParameterHint(inlay)) continue;
+        int offset = inlay.getOffset();
+        String oldText = presentationManager.getHintText(inlay);
+        String newText = myAnnotations.remove(offset);
+        if (!Objects.equals(newText, oldText)) {
+          if (newText == null) {
+            removedHints.add(oldText);
+            presentationManager.deleteHint(myEditor, inlay);
+          }
+          else {
+            presentationManager.replaceHint(myEditor, inlay, newText);
+          }
+        }
+      }
+      for (Map.Entry<Integer, String> e : myAnnotations.entrySet()) {
+        int offset = e.getKey();
+        String text = e.getValue();
+        presentationManager.addHint(myEditor, offset, text, !firstTime && !removedHints.contains(text));
+      }
+      myEditor.putUserData(REPEATED_PASS, Boolean.TRUE);
+    }
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java
new file mode 100644 (file)
index 0000000..597ab43
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+ * 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;
+
+import com.intellij.ide.highlighter.JavaHighlightingColors;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorCustomElementRenderer;
+import com.intellij.openapi.editor.Inlay;
+import com.intellij.openapi.editor.impl.FontInfo;
+import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.ui.GraphicsConfig;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Key;
+import com.intellij.ui.ColorUtil;
+import com.intellij.util.Alarm;
+import com.intellij.util.ui.GraphicsUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class ParameterHintsPresentationManager implements Disposable {
+  private static final Key<FontMetrics> HINT_FONT_METRICS = Key.create("ParameterHintFontMetrics");
+  private static final Key<AnimationStep> ANIMATION_STEP = Key.create("ParameterHintAnimationStep");
+
+  private static final int ANIMATION_STEP_MS = 25;
+  private static final int ANIMATION_CHARS_PER_STEP = 3;
+
+  private final Alarm myAlarm = new Alarm(this);
+
+  public static ParameterHintsPresentationManager getInstance() {
+    return ServiceManager.getService(ParameterHintsPresentationManager.class);
+  }
+
+  private ParameterHintsPresentationManager() {
+  }
+
+  public boolean isParameterHint(@NotNull Inlay inlay) {
+    return inlay.getRenderer() instanceof MyRenderer;
+  }
+
+  public String getHintText(@NotNull Inlay inlay) {
+    EditorCustomElementRenderer renderer = inlay.getRenderer();
+    return renderer instanceof MyRenderer ? ((MyRenderer)renderer).myText : null;
+  }
+
+  public void addHint(@NotNull Editor editor, int offset, @NotNull String hintText, boolean useAnimation) {
+    MyRenderer renderer = new MyRenderer(editor, hintText, useAnimation);
+    Inlay inlay = editor.getInlayModel().addInlineElement(offset, renderer);
+    if (useAnimation && inlay != null) {
+      scheduleRendererUpdate(editor, inlay);
+    }
+  }
+
+  public void deleteHint(@NotNull Editor editor, @NotNull Inlay hint) {
+    updateRenderer(editor, hint, null);
+  }
+
+  public void replaceHint(@NotNull Editor editor, @NotNull Inlay hint, @NotNull String newText) {
+    updateRenderer(editor, hint, newText);
+  }
+
+  private void updateRenderer(@NotNull Editor editor, @NotNull Inlay hint, @Nullable String newText) {
+    MyRenderer renderer = (MyRenderer)hint.getRenderer();
+    renderer.update(editor, newText);
+    hint.updateSize();
+    scheduleRendererUpdate(editor, hint);
+  }
+
+  @Override
+  public void dispose() {}
+
+  private void scheduleRendererUpdate(Editor editor, Inlay inlay) {
+    AnimationStep step = editor.getUserData(ANIMATION_STEP);
+    if (step == null) {
+      editor.putUserData(ANIMATION_STEP, step = new AnimationStep(editor));
+    }
+    step.inlays.add(inlay);
+    scheduleAnimationStep(step);
+  }
+
+  private void scheduleAnimationStep(AnimationStep step) {
+    myAlarm.cancelRequest(step);
+    myAlarm.addRequest(step, ANIMATION_STEP_MS, ModalityState.any());
+  }
+
+  private static Font getFont(@NotNull Editor editor) {
+    return getFontMetrics(editor).getFont();
+  }
+
+  private static FontMetrics getFontMetrics(@NotNull Editor editor) {
+    String familyName = UIManager.getFont("Label.font").getFamily();
+    int size = Math.max(1, editor.getColorsScheme().getEditorFontSize() - 1);
+    FontMetrics metrics = editor.getUserData(HINT_FONT_METRICS);
+    if (metrics != null) {
+      Font font = metrics.getFont();
+      if (!familyName.equals(font.getFamily()) || size != font.getSize()) metrics = null;
+    }
+    if (metrics == null) {
+      Font font = new Font(familyName, Font.PLAIN, size);
+      metrics = FontInfo.createReferenceGraphics().getFontMetrics(font);
+      editor.putUserData(HINT_FONT_METRICS, metrics);
+    }
+    return metrics;
+  }
+
+  private static class MyRenderer implements EditorCustomElementRenderer {
+    private String myText;
+    private int startWidth;
+    private int steps;
+    private int step;
+
+    private MyRenderer(Editor editor, String text, boolean animated) {
+      updateState(editor, text);
+      if (!animated) step = steps + 1;
+    }
+
+    public void update(Editor editor, String newText) {
+      updateState(editor, newText);
+    }
+
+    private void updateState(Editor editor, String text) {
+      FontMetrics metrics = getFontMetrics(editor);
+      startWidth = doCalcWidth(myText, metrics);
+      myText = text;
+      int endWidth = doCalcWidth(myText, metrics);
+      step = 1;
+      steps = Math.max(1, Math.abs(endWidth - startWidth) / metrics.charWidth('a') / ANIMATION_CHARS_PER_STEP);
+    }
+
+    public boolean nextStep() {
+      return ++step <= steps;
+    }
+
+    @Override
+    public int calcWidthInPixels(@NotNull Editor editor) {
+      FontMetrics metrics = getFontMetrics(editor);
+      int endWidth = doCalcWidth(myText, metrics);
+      return step <= steps ? Math.max(1, startWidth + (endWidth - startWidth) / steps * step) : endWidth;
+    }
+
+    private static int doCalcWidth(@Nullable String text, @NotNull FontMetrics fontMetrics) {
+      return text == null ? 0 : fontMetrics.stringWidth(text) + 14;
+    }
+
+    @Override
+    public void paint(@NotNull Editor editor, @NotNull Graphics g, @NotNull Rectangle r) {
+      if (myText != null && (step > steps || startWidth != 0)) {
+        TextAttributes attributes = editor.getColorsScheme().getAttributes(JavaHighlightingColors.INLINE_PARAMETER_HINT);
+        if (attributes != null) {
+          GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
+          int shadeRectHeight = Math.min(4, r.height - 3);
+          Color backgroundColor = attributes.getBackgroundColor();
+          g.setColor(ColorUtil.brighter(backgroundColor, 1));
+          g.fillRoundRect(r.x + 2, r.y + 1, r.width - 4, shadeRectHeight, 4, 4);
+          g.setColor(ColorUtil.darker(backgroundColor, 1));
+          g.fillRoundRect(r.x + 2, r.y + r.height - shadeRectHeight - 1, r.width - 4, shadeRectHeight, 4, 4);
+          g.setColor(backgroundColor);
+          g.fillRoundRect(r.x + 2, r.y + 2, r.width - 4, r.height - 4, 4, 4);
+          g.setColor(attributes.getForegroundColor());
+          g.setFont(getFont(editor));
+          FontMetrics metrics = g.getFontMetrics();
+          Shape savedClip = g.getClip();
+          g.clipRect(r.x + 3, r.y + 2, r.width - 6, r.height - 4);
+          g.drawString(myText, r.x + 7, r.y + (r.height + metrics.getAscent() - metrics.getDescent()) / 2);
+          g.setClip(savedClip);
+          config.restore();
+        }
+      }
+    }
+  }
+
+  private class AnimationStep implements Runnable {
+    private final Editor myEditor;
+    private final Set<Inlay> inlays = new HashSet<>();
+
+    AnimationStep(Editor editor) {
+      myEditor = editor;
+    }
+
+    @Override
+    public void run() {
+      Iterator<Inlay> it = inlays.iterator();
+      while (it.hasNext()) {
+        Inlay inlay = it.next();
+        if (inlay.isValid()) {
+          MyRenderer renderer = (MyRenderer)inlay.getRenderer();
+          if (!renderer.nextStep()) {
+            it.remove();
+          }
+          if (renderer.calcWidthInPixels(myEditor) == 0) {
+            Disposer.dispose(inlay);
+          }
+          else {
+            inlay.updateSize();
+          }
+        }
+        else {
+          it.remove();
+        }
+      }
+      if (inlays.isEmpty()) {
+        myEditor.putUserData(ANIMATION_STEP, null);
+      }
+      else {
+        scheduleAnimationStep(this);
+      }
+    }
+  }
+}
index 91bd277ff7c61c83d795756661627d6192044ea2..4d0885abe70ae08c9e47d1585f15bf7198fc69c9 100644 (file)
@@ -32,6 +32,8 @@ import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ModuleFileIndex;
+import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.io.FileUtil;
@@ -163,12 +165,16 @@ public class HighlightClassUtil {
 
     PsiClass[] classes = JavaPsiFacade.getInstance(aClass.getProject()).findClasses(qualifiedName, GlobalSearchScope.moduleScope(module));
     if (classes.length < numOfClassesToFind) return null;
+    final ModuleFileIndex fileIndex = ModuleRootManager.getInstance(module).getFileIndex();
+    final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(aClass);
+    if (virtualFile == null) return null;
+    final boolean isTestSourceRoot = fileIndex.isInTestSourceContent(virtualFile);
     String dupFileName = null;
     for (PsiClass dupClass : classes) {
       // do not use equals
       if (dupClass != aClass) {
         VirtualFile file = dupClass.getContainingFile().getVirtualFile();
-        if (file != null && manager.isInProject(dupClass)) {
+        if (file != null && manager.isInProject(dupClass) && fileIndex.isInTestSourceContent(file) == isTestSourceRoot) {
           dupFileName = FileUtil.toSystemDependentName(file.getPath());
           break;
         }
index 914babab5bf49c696a85cf67f52bccadacbcaecb..5c915995234fe27eb26f0effcb61988f1ed181ef 100644 (file)
@@ -112,17 +112,12 @@ public class HighlightNamesUtil {
 
   @NotNull
   static HighlightInfo highlightClassName(@Nullable PsiClass aClass, @NotNull PsiElement elementToHighlight, @NotNull TextAttributesScheme colorsScheme) {
-    HighlightInfoType type = getClassNameHighlightType(aClass, elementToHighlight);
-    TextAttributes attributes = mergeWithScopeAttributes(aClass, type, colorsScheme);
     TextRange range = elementToHighlight.getTextRange();
     if (elementToHighlight instanceof PsiJavaCodeReferenceElement) {
       final PsiJavaCodeReferenceElement referenceElement = (PsiJavaCodeReferenceElement)elementToHighlight;
-      PsiReferenceParameterList parameterList = referenceElement.getParameterList();
-      if (parameterList != null) {
-        final TextRange paramListRange = parameterList.getTextRange();
-        if (paramListRange.getEndOffset() > paramListRange.getStartOffset()) {
-          range = new TextRange(range.getStartOffset(), paramListRange.getStartOffset());
-        }
+      PsiElement identifier = referenceElement.getReferenceNameElement();
+      if (identifier != null) {
+        range = identifier.getTextRange();
       }
     }
 
@@ -133,6 +128,8 @@ public class HighlightNamesUtil {
       range = new TextRange(psiAnnotation.getTextRange().getStartOffset(), range.getEndOffset());
     }
 
+    HighlightInfoType type = getClassNameHighlightType(aClass, elementToHighlight);
+    TextAttributes attributes = mergeWithScopeAttributes(aClass, type, colorsScheme);
     HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(type).range(range);
     if (attributes != null) {
       builder.textAttributes(attributes);
@@ -313,4 +310,32 @@ public class HighlightNamesUtil {
     if (node != null) return node.getTextRange().getStartOffset();
     return textRange.getStartOffset();
   }
+
+  static HighlightInfo highlightPackage(@NotNull PsiElement resolved, @NotNull PsiJavaCodeReferenceElement elementToHighlight, @NotNull TextAttributesScheme scheme) {
+    PsiElement referenceNameElement = elementToHighlight.getReferenceNameElement();
+    TextRange range;
+    if (referenceNameElement == null) {
+      range = elementToHighlight.getTextRange();
+    }
+    else {
+      PsiElement nextSibling = PsiTreeUtil.nextLeaf(referenceNameElement);
+      if (nextSibling != null && nextSibling.getTextRange().isEmpty()) {
+        // empty PsiReferenceParameterList
+        nextSibling = PsiTreeUtil.nextLeaf(nextSibling);
+      }
+      if (nextSibling instanceof PsiJavaToken && ((PsiJavaToken)nextSibling).getTokenType() == JavaTokenType.DOT) {
+        range = new TextRange(referenceNameElement.getTextRange().getStartOffset(), nextSibling.getTextRange().getEndOffset());
+      }
+      else {
+        range = referenceNameElement.getTextRange();
+      }
+    }
+    HighlightInfoType type = JavaHighlightInfoTypes.CLASS_NAME;
+    TextAttributes attributes = mergeWithScopeAttributes(resolved, type, scheme);
+    HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(type).range(range);
+    if (attributes != null) {
+      builder.textAttributes(attributes);
+    }
+    return builder.createUnconditionally();
+  }
 }
index 25426f6e326a7ffa6fe94a601e897a15fbde615f..d95ce00d89b92f9dea37b876e90630b86fd7350a 100644 (file)
@@ -53,7 +53,10 @@ import gnu.trove.TObjectIntHashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 public class HighlightVisitorImpl extends JavaElementVisitor implements HighlightVisitor {
   @NotNull
@@ -819,9 +822,6 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
 
   private void highlightReferencedMethodOrClassName(@NotNull PsiJavaCodeReferenceElement element, PsiElement resolved) {
     PsiElement parent = element.getParent();
-    if (parent instanceof PsiReferenceExpression || parent instanceof PsiJavaCodeReferenceElement) {
-      return;
-    }
     final TextAttributesScheme colorsScheme = myHolder.getColorsScheme();
     if (parent instanceof PsiMethodCallExpression) {
       PsiMethod method = ((PsiMethodCallExpression)parent).resolveMethod();
@@ -839,33 +839,19 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
           final PsiElement referenceNameElement = element.getReferenceNameElement();
           if(referenceNameElement != null) {
             // exclude type parameters from the highlighted text range
-            TextRange range = new TextRange(element.getTextRange().getStartOffset(), referenceNameElement.getTextRange().getEndOffset());
+            TextRange range = referenceNameElement.getTextRange();
             myHolder.add(HighlightNamesUtil.highlightMethodName(methodOrClass, referenceNameElement, range, colorsScheme, false));
           }
         }
       }
       catch (IndexNotReadyException ignored) { }
     }
-    else if (parent instanceof PsiImportStatement && ((PsiImportStatement)parent).isOnDemand()) {
-      // highlight on demand import as class
-      myHolder.add(HighlightNamesUtil.highlightClassName(null, element, colorsScheme));
+    else if (resolved instanceof PsiPackage) {
+      // highlight package (and following dot) as a class
+      myHolder.add(HighlightNamesUtil.highlightPackage(resolved, element, colorsScheme));
     }
     else if (resolved instanceof PsiClass) {
-      final PsiElement qualifier = element.getQualifier();
-      boolean highlightByItem = qualifier instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)qualifier).getTypeParameters().length > 0 ||
-                                PsiTreeUtil.findChildOfType(element, PsiComment.class) != null;
-      final PsiElement referenceNameElement = element.getReferenceNameElement();
-      final List<PsiElement> toHighlight = new ArrayList<>();
-      if (highlightByItem && referenceNameElement != null) {
-        toHighlight.add(referenceNameElement);
-        toHighlight.addAll(PsiTreeUtil.findChildrenOfType(element, PsiJavaCodeReferenceElement.class));
-      }
-      else {
-        toHighlight.add(element);
-      }
-      for (PsiElement psiElement : toHighlight) {
-        myHolder.add(HighlightNamesUtil.highlightClassName((PsiClass)resolved, psiElement, colorsScheme));
-      }
+      myHolder.add(HighlightNamesUtil.highlightClassName((PsiClass)resolved, element, colorsScheme));
     }
   }
 
@@ -1634,6 +1620,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
     if (!myHolder.hasErrorResults()) myHolder.add(checkFeature(module, Feature.MODULES));
     if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkFileName(module, myFile));
     if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkFileDuplicates(module, myFile));
+    if (!myHolder.hasErrorResults()) myHolder.addAll(ModuleHighlightUtil.checkDuplicateRequires(module));
     if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkFileLocation(module, myFile));
   }
 
index 804bf1f51dcd829772a98636db5785ef4c04cf03..82358fa9c96fe55a992822958bc18e66782a91dc 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.daemon.JavaErrorMessages;
 import com.intellij.codeInsight.daemon.QuickFixBundle;
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
 import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
+import com.intellij.codeInsight.daemon.impl.quickfix.DeleteElementFix;
 import com.intellij.codeInsight.daemon.impl.quickfix.GoToSymbolFix;
 import com.intellij.codeInsight.daemon.impl.quickfix.MoveFileFix;
 import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
@@ -32,10 +33,13 @@ import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.psi.search.FilenameIndex;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
+import java.util.List;
+import java.util.Map;
 
 import static com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE;
 
@@ -71,6 +75,32 @@ public class ModuleHighlightUtil {
     return null;
   }
 
+  @NotNull
+  static List<HighlightInfo> checkDuplicateRequires(@NotNull PsiJavaModule module) {
+    List<HighlightInfo> results = ContainerUtil.newSmartList();
+
+    Map<String, PsiElement> map = ContainerUtil.newHashMap();
+    for (PsiElement child = module.getFirstChild(); child != null; child = child.getNextSibling()) {
+      if (child instanceof PsiRequiresStatement) {
+        PsiJavaModuleReferenceElement ref = ((PsiRequiresStatement)child).getReferenceElement();
+        if (ref != null) {
+          String text = ref.getReferenceText();
+          if (!map.containsKey(text)) {
+            map.put(text, child);
+          }
+          else {
+            String message = JavaErrorMessages.message("module.duplicate.requires", text);
+            HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(child).description(message).create();
+            QuickFixAction.registerQuickFixAction(info, new DeleteElementFix(child));
+            results.add(info);
+          }
+        }
+      }
+    }
+
+    return results;
+  }
+
   @Nullable
   static HighlightInfo checkFileLocation(@NotNull PsiJavaModule element, @NotNull PsiFile file) {
     VirtualFile vFile = file.getVirtualFile();
index d75a00b93390c57b88f3444a169815cc653541e7..b449a9be74233e4a742272f192d107040cb8e597 100644 (file)
@@ -218,9 +218,13 @@ class PostHighlightingVisitor {
     if (parent instanceof PsiField && compareVisibilities((PsiModifierListOwner)parent, myUnusedSymbolInspection.getFieldVisibility())) {
       return processField(myProject, (PsiField)parent, identifier, progress, helper);
     }
-    if (parent instanceof PsiParameter && compareVisibilities((PsiModifierListOwner)parent, myUnusedSymbolInspection.getParameterVisibility())) {
-      if (SuppressionUtil.isSuppressed(identifier, UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME)) return null;
-      return processParameter(myProject, (PsiParameter)parent, identifier, progress);
+    if (parent instanceof PsiParameter) {
+      final PsiElement declarationScope = ((PsiParameter)parent).getDeclarationScope();
+      if (declarationScope instanceof PsiMethod ? compareVisibilities((PsiModifierListOwner)declarationScope, myUnusedSymbolInspection.getParameterVisibility())
+                                                : myUnusedSymbolInspection.LOCAL_VARIABLE) {
+        if (SuppressionUtil.isSuppressed(identifier, UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME)) return null;
+        return processParameter(myProject, (PsiParameter)parent, identifier, progress);
+      }
     }
     if (parent instanceof PsiMethod) {
       if (myUnusedSymbolInspection.isIgnoreAccessors() && PropertyUtil.isSimplePropertyAccessor((PsiMethod)parent)) {
@@ -230,8 +234,12 @@ class PostHighlightingVisitor {
         return processMethod(myProject, (PsiMethod)parent, identifier, progress, helper);
       }
     }
-    if (parent instanceof PsiClass && compareVisibilities((PsiModifierListOwner)parent, myUnusedSymbolInspection.getClassVisibility())) {
-      return processClass(myProject, (PsiClass)parent, identifier, progress, helper);
+    if (parent instanceof PsiClass) {
+      final String acceptedVisibility = ((PsiClass)parent).getContainingClass() == null ? myUnusedSymbolInspection.getClassVisibility()
+                                                                                        : myUnusedSymbolInspection.getInnerClassVisibility();
+      if (compareVisibilities((PsiModifierListOwner)parent, acceptedVisibility)) {
+        return processClass(myProject, (PsiClass)parent, identifier, progress, helper);
+      }
     }
     return null;
   }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteElementFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteElementFix.java
new file mode 100644 (file)
index 0000000..c0b4ce1
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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.quickfix;
+
+import com.intellij.codeInsight.FileModificationService;
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.SmartPointerManager;
+import com.intellij.psi.SmartPsiElementPointer;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+public class DeleteElementFix implements IntentionAction {
+  private final SmartPsiElementPointer<PsiElement> myPointer;
+
+  public DeleteElementFix(@NotNull PsiElement element) {
+    myPointer = SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element);
+  }
+
+  @Nls
+  @NotNull
+  @Override
+  public String getText() {
+    return QuickFixBundle.message("delete.element.fix.text");
+  }
+
+  @Nls
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return getText();
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+    return myPointer.getElement() != null;
+  }
+
+  @Override
+  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+    PsiElement element = myPointer.getElement();
+    if (element != null && element.isValid() && FileModificationService.getInstance().prepareFileForWrite(file)) {
+      element.delete();
+    }
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return true;
+  }
+}
\ No newline at end of file
index bd1d017f69f3715a1c5a5d7f626ac7ee4f9ad8c2..4d72212249f3cebef7d756087e7fd2ec70aae95c 100644 (file)
@@ -21,7 +21,6 @@ import com.intellij.codeInspection.dataFlow.instructions.*;
 import com.intellij.codeInspection.dataFlow.value.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
@@ -740,19 +739,20 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
       exception.accept(this);
       CatchDescriptor cd = findNextCatch(false);
       if (cd == null) {
+        addInstruction(new FieldReferenceInstruction(exception, "thrown exception"));
         addInstruction(new ReturnInstruction(true, statement));
         finishElement(statement);
         return;
       }
-      
+
       addConditionalRuntimeThrow();
       addInstruction(new DupInstruction());
       addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
       addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, myProject));
       ConditionalGotoInstruction gotoInstruction = new ConditionalGotoInstruction(null, true, null);
       addInstruction(gotoInstruction);
-      
-      addInstruction(new PopInstruction());
+
+      addInstruction(new FieldReferenceInstruction(exception, "thrown exception"));
       initException(myNpe, cd);
       addThrowCode(cd, statement);
 
index f55098cd051a2d0d74556adb9f126855533dac6e..7a5465c500581c1473aa13bca55037dfdfcfa8a8 100644 (file)
@@ -90,6 +90,9 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
     if (TREAT_UNKNOWN_MEMBERS_AS_NULLABLE) {
       node.addContent(new Element("option").setAttribute("name", "TREAT_UNKNOWN_MEMBERS_AS_NULLABLE").setAttribute("value", "true"));
     }
+    if (!REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER) {
+      node.addContent(new Element("option").setAttribute("name", "REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER").setAttribute("value", "false"));
+    }
   }
 
   @Override
@@ -148,7 +151,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
       for (PsiParameter parameter : NullParameterConstraintChecker.checkMethodParameters(method, isOnTheFly)) {
         final String name = parameter.getName();
         holder.registerProblem(parameter.getNameIdentifier(),
-                               InspectionsBundle.message("dataflow.method.fails.with.null.argument", name),
+                               InspectionsBundle.message("dataflow.method.fails.with.null.argument"),
                                ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                NullableStuffInspectionBase.getWrappedUiDependentQuickFix(this::createNavigateToNullParameterUsagesFix, parameter, isOnTheFly));
       }
@@ -469,7 +472,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
                            fix);
   }
 
-  private void reportFieldAccessMayProduceNpe(ProblemsHolder holder, PsiElement elementToAssert, PsiExpression expression) {
+  private void reportFieldAccessMayProduceNpe(ProblemsHolder holder, PsiElement elementToAssert, @NotNull PsiExpression expression) {
     if (expression instanceof PsiArrayAccessExpression) {
       LocalQuickFix[] fix = createNPEFixes((PsiExpression)elementToAssert, expression, holder.isOnTheFly());
       holder.registerProblem(expression,
@@ -479,8 +482,11 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
     else {
       LocalQuickFix[] fix = createNPEFixes((PsiExpression)elementToAssert, expression, holder.isOnTheFly());
       assert elementToAssert != null;
+      //noinspection ConditionalExpressionWithIdenticalBranches
       holder.registerProblem(elementToAssert,
-                             InspectionsBundle.message("dataflow.message.npe.field.access"),
+                             expression.textMatches("null")
+                             ? InspectionsBundle.message("dataflow.message.npe.field.access.sure")
+                             : InspectionsBundle.message("dataflow.message.npe.field.access"),
                              fix);
     }
   }
index 6f0f02b69860f872910fea234bc4af7be516472a..b7e3418791a82fbb3f82c377bed7856f111c981d 100644 (file)
@@ -127,9 +127,16 @@ public class DataFlowRunner {
         }
       }
 
+      if (LOG.isTraceEnabled()) {
+        LOG.trace("Analyzing code block: " + psiBlock.getText());
+        for (int i = 0; i < myInstructions.length; i++) {
+          LOG.trace(i + ": " + myInstructions[i]);
+        }
+      }
+
       Integer tooExpensiveHash = psiBlock.getUserData(TOO_EXPENSIVE_HASH);
       if (tooExpensiveHash != null && tooExpensiveHash == psiBlock.getText().hashCode()) {
-        LOG.debug("Too complex because hasn't changed since being too complex already");
+        LOG.trace("Too complex because hasn't changed since being too complex already");
         return RunnerResult.TOO_COMPLEX;
       }
 
@@ -148,12 +155,18 @@ public class DataFlowRunner {
         List<DfaInstructionState> states = queue.getNextInstructionStates(joinInstructions);
         for (DfaInstructionState instructionState : states) {
           if (count++ % 1024 == 0 && measurer.isTimeOver()) {
-            LOG.debug("Too complex because the analysis took too long");
+            LOG.trace("Too complex because the analysis took too long");
             psiBlock.putUserData(TOO_EXPENSIVE_HASH, psiBlock.getText().hashCode());
             return RunnerResult.TOO_COMPLEX;
           }
           ProgressManager.checkCanceled();
 
+          if (LOG.isTraceEnabled()) {
+            LOG.trace(instructionState.toString());
+          }
+          // useful for quick debugging by uncommenting and hot-swapping
+          //System.out.println(instructionState.toString());
+
           Instruction instruction = instructionState.getInstruction();
 
           if (instruction instanceof BranchingInstruction) {
@@ -163,7 +176,7 @@ public class DataFlowRunner {
               continue;
             }
             if (processed.size() > MAX_STATES_PER_BRANCH) {
-              LOG.debug("Too complex because too many different possible states");
+              LOG.trace("Too complex because too many different possible states");
               return RunnerResult.TOO_COMPLEX; // Too complex :(
             }
             if (loopNumber[branching.getIndex()] != 0) {
@@ -180,7 +193,7 @@ public class DataFlowRunner {
             handleStepOutOfLoop(instruction, nextInstruction, loopNumber, processedStates, incomingStates, states, after, queue);
             if (nextInstruction instanceof BranchingInstruction) {
               BranchingInstruction branching = (BranchingInstruction)nextInstruction;
-              if (processedStates.get(branching).contains(state.getMemoryState()) || 
+              if (processedStates.get(branching).contains(state.getMemoryState()) ||
                   incomingStates.get(branching).contains(state.getMemoryState())) {
                 continue;
               }
@@ -194,6 +207,7 @@ public class DataFlowRunner {
       }
 
       psiBlock.putUserData(TOO_EXPENSIVE_HASH, null);
+      LOG.trace("Analysis ok");
       return RunnerResult.OK;
     }
     catch (ArrayIndexOutOfBoundsException | EmptyStackException e) {
index 50db5a142e76bf056bb04f46074f8df52f9d905d..76f3d1b92a61e26f037e5cba640a566f712e8163 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.codeInspection.dataFlow;
 
+import com.intellij.codeInsight.AnnotationUtil;
 import com.intellij.codeInsight.NullableNotNullManager;
 import com.intellij.codeInspection.dataFlow.instructions.Instruction;
 import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction;
@@ -94,7 +95,7 @@ public class DfaPsiUtil {
     if (NullableNotNullManager.isNullable(owner)) {
       return Nullness.NULLABLE;
     }
-    if (NullableNotNullManager.isNotNull(owner)) {
+    if (isNotNullLocally(owner)) {
       return Nullness.NOT_NULL;
     }
 
@@ -110,6 +111,22 @@ public class DfaPsiUtil {
     return Nullness.UNKNOWN;
   }
 
+  private static boolean isNotNullLocally(@NotNull PsiModifierListOwner owner) {
+    NullableNotNullManager nnnm = NullableNotNullManager.getInstance(owner.getProject());
+    PsiAnnotation notNullAnno = nnnm.getNotNullAnnotation(owner, true);
+    if (notNullAnno == null) return false;
+
+    if (!(owner instanceof PsiParameter)) return true; // notnull on a super method requires all inheritors to return notnull as well
+
+    // @NotNull on a super parameter doesn't prohibit calling the inheritors with null args, if they're ready for that.
+    // so treat parameters as @NotNull only if they're annotated explicitly, or if they're in a scope of some nullity default annotation.
+    return isOwnAnnotation(owner, notNullAnno) || nnnm.isContainerAnnotation(notNullAnno);
+  }
+
+  private static boolean isOwnAnnotation(@NotNull PsiModifierListOwner owner, @NotNull PsiAnnotation anno) {
+    return AnnotationUtil.findAnnotation(owner, anno.getQualifiedName()) == anno;
+  }
+
   private static boolean isEnumValueOf(PsiMethod method) {
     if ("valueOf".equals(method.getName()) && method.hasModifierProperty(PsiModifier.STATIC)) {
       PsiClass containingClass = method.getContainingClass();
index c7e2fce923cdcc6a8d9c41f068ee10ca2b4a63b8..db6aa677095c5badd2f17b35476c39f29e36932e 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.codeInspection.dataFlow;
 import com.intellij.lang.injection.InjectedLanguageManager;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.containers.ContainerUtil;
 import com.siyeh.ig.psiutils.ExpressionUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -52,9 +53,7 @@ public class HardcodedContracts {
     }
     else if ("com.google.common.base.Preconditions".equals(className)) {
       if ("checkNotNull".equals(methodName) && paramCount > 0) {
-        MethodContract.ValueConstraint[] constraints = createConstraintArray(paramCount);
-        constraints[0] = NULL_VALUE;
-        return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+        return failIfNull(0, paramCount);
       }
       if (("checkArgument".equals(methodName) || "checkState".equals(methodName)) && paramCount > 0) {
         MethodContract.ValueConstraint[] constraints = createConstraintArray(paramCount);
@@ -64,17 +63,15 @@ public class HardcodedContracts {
     }
     else if ("java.util.Objects".equals(className)) {
       if ("requireNonNull".equals(methodName) && paramCount > 0) {
-        MethodContract.ValueConstraint[] constraints = createConstraintArray(paramCount);
-        constraints[0] = NULL_VALUE;
-        return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+        return failIfNull(0, paramCount);
       }
     }
-    else if ("org.apache.commons.lang.Validate".equals(className) || 
-             "org.apache.commons.lang3.Validate".equals(className) || 
+    else if ("org.apache.commons.lang.Validate".equals(className) ||
+             "org.apache.commons.lang3.Validate".equals(className) ||
              "org.springframework.util.Assert".equals(className)) {
-      if ("notNull".equals(methodName) && paramCount > 0) {
+      if (("isTrue".equals(methodName) || "state".equals(methodName)) && paramCount > 0) {
         MethodContract.ValueConstraint[] constraints = createConstraintArray(paramCount);
-        constraints[0] = NULL_VALUE;
+        constraints[0] = FALSE_VALUE;
         return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
       }
     }
@@ -117,25 +114,7 @@ public class HardcodedContracts {
   private static List<MethodContract> handleTestFrameworks(int paramCount, String className, String methodName,
                                                            @Nullable PsiMethodCallExpression call) {
     if (("assertThat".equals(methodName) || "assumeThat".equals(methodName) || "that".equals(methodName)) && call != null) {
-      PsiExpression[] args = call.getArgumentList().getExpressions();
-      if (args.length == paramCount) {
-        for (int i = 1; i < args.length; i++) {
-          if (isNotNullMatcher(args[i])) {
-            MethodContract.ValueConstraint[] constraints = createConstraintArray(args.length);
-            constraints[i - 1] = NULL_VALUE;
-            return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
-          }
-        }
-        if (args.length == 1) {
-          final PsiElement parent = call.getParent();
-          if (parent instanceof PsiReferenceExpression && 
-              "isNotNull".equals(((PsiReferenceExpression)parent).getReferenceName()) && 
-              parent.getParent() instanceof PsiMethodCallExpression) {
-            return Collections.singletonList(new MethodContract(new MethodContract.ValueConstraint[]{NULL_VALUE}, THROW_EXCEPTION));
-          }
-        }
-      }
-      return Collections.emptyList();
+      return handleAssertThat(paramCount, call);
     }
 
     if (!"junit.framework.Assert".equals(className) &&
@@ -169,12 +148,46 @@ public class HardcodedContracts {
       return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
     }
     if ("assertNotNull".equals(methodName) || "assumeNotNull".equals(methodName)) {
-      constraints[checkedParam] = NULL_VALUE;
-      return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+      return failIfNull(checkedParam, paramCount);
     }
     return Collections.emptyList();
   }
 
+  @NotNull
+  private static List<MethodContract> handleAssertThat(int paramCount, @NotNull PsiMethodCallExpression call) {
+    PsiExpression[] args = call.getArgumentList().getExpressions();
+    if (args.length == paramCount) {
+      for (int i = 1; i < args.length; i++) {
+        if (isNotNullMatcher(args[i])) {
+          return failIfNull(i - 1, paramCount);
+        }
+      }
+      if (args.length == 1 && hasNotNullChainCall(call)) {
+        return failIfNull(0, 1);
+      }
+    }
+    return Collections.emptyList();
+  }
+
+  private static boolean hasNotNullChainCall(PsiMethodCallExpression call) {
+    Iterable<PsiElement> exprParents = SyntaxTraverser.psiApi().parents(call).
+      takeWhile(e -> !(e instanceof PsiStatement) && !(e instanceof PsiMember));
+    return ContainerUtil.exists(exprParents, HardcodedContracts::isNotNullCall);
+  }
+
+  private static boolean isNotNullCall(PsiElement ref) {
+    return ref instanceof PsiReferenceExpression &&
+           "isNotNull".equals(((PsiReferenceExpression)ref).getReferenceName()) &&
+           ref.getParent() instanceof PsiMethodCallExpression;
+  }
+
+  @NotNull
+  private static List<MethodContract> failIfNull(int argIndex, int argCount) {
+    MethodContract.ValueConstraint[] constraints = createConstraintArray(argCount);
+    constraints[argIndex] = NULL_VALUE;
+    return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+  }
+
   public static boolean isHardcodedPure(PsiMethod method) {
     String qName = PsiUtil.getMemberQualifiedName(method);
     if ("java.lang.System.exit".equals(qName)) {
index 296e5e2b33a4c1c7d53be90336b7f1fdcfa3e71a..7a0351e351259bd19e89291ae30e5358902a7c9c 100644 (file)
@@ -63,6 +63,7 @@ class NullParameterConstraintChecker extends DataFlowRunner {
       PsiParameter parameter = parameters[index];
       if (!(parameter.getType() instanceof PsiPrimitiveType) &&
           !NullableNotNullManager.isNotNull(parameter) &&
+          !NullableNotNullManager.isNullable(parameter) &&
           JavaNullMethodArgumentUtil.hasNullArgument(method, index)) {
         nullableParameters.add(parameter);
       }
index 7a99ce8661f933310092100481a87a0b71f4c11d..ffcac0a2d3041b3243e47bfe0906d5c9e9432ad9 100644 (file)
@@ -40,7 +40,7 @@ public class DummyEntryPointsTool extends UnusedDeclarationInspectionBase {
 
   @Nullable
   @Override
-  public JobDescriptor[] getAdditionalJobs() {
+  public JobDescriptor[] getAdditionalJobs(GlobalInspectionContext context) {
     return JobDescriptor.EMPTY_ARRAY;
   }
 
index 0d8e7910302a6dea398ff0a58902e77d3a21d9e5..f165531fbb91712347b3215dd997a7411848757b 100644 (file)
@@ -77,7 +77,6 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
 
   private Set<RefElement> myProcessedSuspicious;
   private int myPhase;
-  private GlobalInspectionContext myContext;
   private final boolean myEnabledInEditor;
 
   @SuppressWarnings("TestOnlyProblems")
@@ -113,10 +112,6 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
     return myLocalInspectionBase;
   }
 
-  protected GlobalInspectionContext getContext() {
-    return myContext;
-  }
-
   private boolean isAddMainsEnabled() {
     return ADD_MAINS_TO_ENTRIES;
   }
@@ -279,7 +274,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
           final boolean isSuppressed = refElement.isSuppressed(getShortName(), ALTERNATIVE_ID);
           if (isSuppressed || !((GlobalInspectionContextBase)globalContext).isToCheckFile(file, UnusedDeclarationInspectionBase.this)) {
             if (isSuppressed || !scope.contains(file)) {
-              getEntryPointsManager().addEntryPoint(refElement, false);
+              getEntryPointsManager(globalContext).addEntryPoint(refElement, false);
             }
             return;
           }
@@ -288,7 +283,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
             @Override
             public void visitMethod(@NotNull RefMethod method) {
               if (isAddMainsEnabled() && method.isAppMain()) {
-                getEntryPointsManager().addEntryPoint(method, false);
+                getEntryPointsManager(globalContext).addEntryPoint(method, false);
               }
             }
 
@@ -296,7 +291,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
             public void visitClass(@NotNull RefClass aClass) {
               if (isAddAppletEnabled() && aClass.isApplet() ||
                   isAddServletEnabled() && aClass.isServlet()) {
-                getEntryPointsManager().addEntryPoint(aClass, false);
+                getEntryPointsManager(globalContext).addEntryPoint(aClass, false);
               }
             }
           });
@@ -334,7 +329,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
                 final PsiNonJavaFileReferenceProcessor processor = new PsiNonJavaFileReferenceProcessor() {
                   @Override
                   public boolean process(PsiFile file, int startOffset, int endOffset) {
-                    getEntryPointsManager().addEntryPoint(refElement, false);
+                    getEntryPointsManager(globalContext).addEntryPoint(refElement, false);
                     return false;
                   }
                 };
@@ -348,11 +343,11 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
                 if (helper.processUsagesInNonJavaFiles(qualifiedName, processor, globalSearchScope)) {
                   final PsiReference reference = ReferencesSearch.search(psiClass, globalSearchScope).findFirst();
                   if (reference != null) {
-                    getEntryPointsManager().addEntryPoint(refElement, false);
+                    getEntryPointsManager(globalContext).addEntryPoint(refElement, false);
                     for (PsiMethod method : psiClass.getMethods()) {
                       final RefElement refMethod = refManager.getReference(method);
                       if (refMethod != null) {
-                        getEntryPointsManager().addEntryPoint(refMethod, false);
+                        getEntryPointsManager(globalContext).addEntryPoint(refMethod, false);
                       }
                     }
                   }
@@ -462,13 +457,13 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
               myProcessedSuspicious.add(refField);
               PsiField psiField = refField.getElement();
               if (psiField != null && isSerializationImplicitlyUsedField(psiField)) {
-                getEntryPointsManager().addEntryPoint(refField, false);
+                getEntryPointsManager(globalContext).addEntryPoint(refField, false);
               }
               else {
-                getJavaContext().enqueueFieldUsagesProcessor(refField, new GlobalJavaInspectionContext.UsagesProcessor() {
+                globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT).enqueueFieldUsagesProcessor(refField, new GlobalJavaInspectionContext.UsagesProcessor() {
                   @Override
                   public boolean process(PsiReference psiReference) {
-                    getEntryPointsManager().addEntryPoint(refField, false);
+                    getEntryPointsManager(globalContext).addEntryPoint(refField, false);
                     return false;
                   }
                 });
@@ -485,14 +480,14 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
               else {
                 PsiMethod psiMethod = (PsiMethod)refMethod.getElement();
                 if (psiMethod != null && isSerializablePatternMethod(psiMethod, refMethod.getOwnerClass())) {
-                  getEntryPointsManager().addEntryPoint(refMethod, false);
+                  getEntryPointsManager(globalContext).addEntryPoint(refMethod, false);
                 }
                 else if (!refMethod.isExternalOverride() && !PsiModifier.PRIVATE.equals(refMethod.getAccessModifier())) {
                   for (final RefMethod derivedMethod : refMethod.getDerivedMethods()) {
                     myProcessedSuspicious.add(derivedMethod);
                   }
 
-                  enqueueMethodUsages(refMethod);
+                  enqueueMethodUsages(globalContext, refMethod);
                   requestAdded[0] = true;
                 }
               }
@@ -502,18 +497,18 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
             public void visitClass(@NotNull final RefClass refClass) {
               myProcessedSuspicious.add(refClass);
               if (!refClass.isAnonymous()) {
-                getJavaContext().enqueueDerivedClassesProcessor(refClass, new GlobalJavaInspectionContext.DerivedClassesProcessor() {
+                globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT).enqueueDerivedClassesProcessor(refClass, new GlobalJavaInspectionContext.DerivedClassesProcessor() {
                   @Override
                   public boolean process(PsiClass inheritor) {
-                    getEntryPointsManager().addEntryPoint(refClass, false);
+                    getEntryPointsManager(globalContext).addEntryPoint(refClass, false);
                     return false;
                   }
                 });
 
-                getJavaContext().enqueueClassUsagesProcessor(refClass, new GlobalJavaInspectionContext.UsagesProcessor() {
+                globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT).enqueueClassUsagesProcessor(refClass, new GlobalJavaInspectionContext.UsagesProcessor() {
                   @Override
                   public boolean process(PsiReference psiReference) {
-                    getEntryPointsManager().addEntryPoint(refClass, false);
+                    getEntryPointsManager(globalContext).addEntryPoint(refClass, false);
                     return false;
                   }
                 });
@@ -543,31 +538,27 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
            isWriteReplaceMethod(psiMethod, refClass) || isExternalizableNoParameterConstructor(psiMethod, refClass);
   }
 
-  private void enqueueMethodUsages(final RefMethod refMethod) {
+  private static void enqueueMethodUsages(GlobalInspectionContext globalContext, final RefMethod refMethod) {
     if (refMethod.getSuperMethods().isEmpty()) {
-      getJavaContext().enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() {
+      globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT).enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() {
         @Override
         public boolean process(PsiReference psiReference) {
-          getEntryPointsManager().addEntryPoint(refMethod, false);
+          getEntryPointsManager(globalContext).addEntryPoint(refMethod, false);
           return false;
         }
       });
     }
     else {
       for (RefMethod refSuper : refMethod.getSuperMethods()) {
-        enqueueMethodUsages(refSuper);
+        enqueueMethodUsages(globalContext, refSuper);
       }
     }
   }
 
-  private GlobalJavaInspectionContext getJavaContext() {
-    return getContext().getExtension(GlobalJavaInspectionContext.CONTEXT);
-  }
-
   @Nullable
   @Override
-  public JobDescriptor[] getAdditionalJobs() {
-    return new JobDescriptor[]{getContext().getStdJobDescriptors().BUILD_GRAPH, getContext().getStdJobDescriptors().FIND_EXTERNAL_USAGES};
+  public JobDescriptor[] getAdditionalJobs(GlobalInspectionContext context) {
+    return new JobDescriptor[]{context.getStdJobDescriptors().BUILD_GRAPH, context.getStdJobDescriptors().FIND_EXTERNAL_USAGES};
   }
 
 
@@ -587,7 +578,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
     });
 
 
-    for (RefElement entry : getEntryPointsManager().getEntryPoints()) {
+    for (RefElement entry : getEntryPointsManager(context).getEntryPoints()) {
       entry.accept(codeScanner);
     }
 
@@ -597,8 +588,8 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
     }
   }
 
-  private EntryPointsManager getEntryPointsManager() {
-    return getJavaContext().getEntryPointsManager(getContext().getRefManager());
+  private static EntryPointsManager getEntryPointsManager(final GlobalInspectionContext context) {
+    return context.getExtension(GlobalJavaInspectionContext.CONTEXT).getEntryPointsManager(context.getRefManager());
   }
 
   private static class CodeScanner extends RefJavaVisitor {
@@ -725,7 +716,6 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
   @Override
   public void initialize(@NotNull GlobalInspectionContext context) {
     super.initialize(context);
-    myContext = context;
     ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ToolExtensionPoints.DEAD_CODE_TOOL);
     point.addExtensionPointListener(new ExtensionPointListener<EntryPoint>() {
       @Override
@@ -745,13 +735,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
       public void extensionRemoved(@NotNull final EntryPoint extension, @Nullable PluginDescriptor pluginDescriptor) {
         ContainerUtil.retainAll(myExtensions, point12 -> !point12.getClass().equals(extension.getClass()));
       }
-    }, getEntryPointsManager());
-  }
-
-  @Override
-  public void cleanup(@NotNull Project project) {
-    super.cleanup(project);
-    myContext = null;
+    }, getEntryPointsManager(context));
   }
 
   @TestOnly
index c328d4eb2e33267dc93f85b40823a86bf1de9479..ff794c76238a09c5ace26d6f8454bc00fb33c499 100644 (file)
@@ -74,7 +74,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
   }
   public JDOMExternalizableStringList ADDITIONAL_ANNOTATIONS = new JDOMExternalizableStringList();
   private final Map<String, SmartRefElementPointer> myPersistentEntryPoints;
-  private final List<ClassPattern> myPatterns = new ArrayList<>();
+  private final LinkedHashSet<ClassPattern> myPatterns = new LinkedHashSet<>();
   private final Set<RefElement> myTemporaryEntryPoints;
   private static final String VERSION = "2.0";
   @NonNls private static final String VERSION_ATTR = "version";
@@ -220,7 +220,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
   public void addEntryPoint(@NotNull RefElement newEntryPoint, boolean isPersistent) {
     if (!newEntryPoint.isValid()) return;
     if (isPersistent) {
-      if (newEntryPoint instanceof RefMethod && ((RefMethod)newEntryPoint).isConstructor() || newEntryPoint instanceof RefClass) {
+      if (newEntryPoint instanceof RefImplicitConstructor || newEntryPoint instanceof RefClass) {
         final ClassPattern classPattern = new ClassPattern();
         classPattern.pattern = new SmartRefElementPointerImpl(newEntryPoint, true).getFQName();
         getPatterns().add(classPattern);
@@ -473,17 +473,24 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
     return false;
   }
 
-  public List<ClassPattern> getPatterns() {
+  public LinkedHashSet<ClassPattern> getPatterns() {
     return myPatterns;
   }
 
   @Tag("pattern")
   public static class ClassPattern {
     @Attribute("value")
-    public String pattern;
+    public String pattern = "";
     @Attribute("hierarchically")
     public boolean hierarchically = false;
 
+    public ClassPattern(ClassPattern classPattern) {
+      hierarchically = classPattern.hierarchically;
+      pattern = classPattern.pattern;
+    }
+
+    public ClassPattern() {}
+
     @Override
     public boolean equals(Object o) {
       if (this == o) return true;
index a41cf4512a1cb845b272a6cae9819f886a0445db..e4043a483aa08aee7eb1964e9f086883e943c040 100644 (file)
@@ -70,7 +70,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
       String value = child.getAttributeValue("value");
       if ("IGNORE_EXTERNAL_SUPER_NOTNULL".equals(name) && "false".equals(value) ||
           "REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED".equals(name) && "false".equals(value) ||
-          "REQUIRE_NOTNULL_FIELDS_INITIALIZED".equals(name) && "true".equals(value)) {
+          "REQUIRE_NOTNULL_FIELDS_INITIALIZED".equals(name) && "true".equals(value) ||
+          "REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER".equals(name) && "true".equals(value)) {
         node.removeContent(child);
       }
     }
index 9c2285f3a3db08b2417666a31d9b9699d2df9534..6d023cbb74644c008774a3ba5b140f120cba9473 100644 (file)
@@ -155,10 +155,10 @@ public class RefFieldImpl extends RefJavaElementImpl implements RefField {
 
   @Nullable
   public static PsiField findPsiField(PsiManager manager, String externalName) {
-    int classNameDelimeter = externalName.lastIndexOf(' ');
-    if (classNameDelimeter > 0 && classNameDelimeter < externalName.length() - 1) {
-      final String className = externalName.substring(0, classNameDelimeter);
-      final String fieldName = externalName.substring(classNameDelimeter + 1);
+    int classNameDelimiter = externalName.lastIndexOf(' ');
+    if (classNameDelimiter > 0 && classNameDelimiter < externalName.length() - 1) {
+      final String className = externalName.substring(0, classNameDelimiter);
+      final String fieldName = externalName.substring(classNameDelimiter + 1);
       final PsiClass psiClass = ClassUtil.findPsiClass(manager, className);
       if (psiClass != null) {
         return psiClass.findFieldByName(fieldName, false);
index 7e5b8d9ab2ff7cfb8d02507a656be6b8eae095f0..fb80967fdb21674ba1d81d39362d0771997af309 100644 (file)
@@ -402,8 +402,6 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
 
     // Class isn't instantiated. Most probably we have problem with class, not method.
     if (!isStatic() && !isConstructor()) {
-      if (((RefClassImpl)getOwnerClass()).isSuspicious()) return true;
-
       // Is an override. Probably called via reference to base class.
       for (RefMethod refSuper : getSuperMethods()) {
         if (((RefMethodImpl)refSuper).isSuspicious()) return true;
index 26d59a7e17f0db43eab15249ec02abb15995027c..75005b6ae5eb161d1f0ce7cd6dbaf16953154ebc 100644 (file)
@@ -23,7 +23,6 @@ import com.intellij.openapi.util.InvalidDataException;
 import com.intellij.openapi.util.WriteExternalException;
 import com.intellij.psi.PsiModifier;
 import org.intellij.lang.annotations.Pattern;
-import org.jdom.Attribute;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -39,7 +38,7 @@ public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool
   public boolean FIELD = true;
   public boolean METHOD = true;
   public boolean CLASS = true;
-  protected boolean INNER_CLASS = CLASS;
+  protected boolean INNER_CLASS = true;
   public boolean PARAMETER = true;
   public boolean REPORT_PARAMETER_FOR_PUBLIC_METHODS = true;
 
index f96df5ecec07b694e2b86ba03f2f2ed85ad5d50d..17c5c46b49433d7b46b7b198d91aa4cc688e3f42 100644 (file)
@@ -85,7 +85,9 @@ public class JavaHighlightingColors {
     = TextAttributesKey.createTextAttributesKey("ANONYMOUS_CLASS_NAME_ATTRIBUTES", CLASS_NAME_ATTRIBUTES);
   public static final TextAttributesKey IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES 
     = TextAttributesKey.createTextAttributesKey("IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES", CLASS_NAME_ATTRIBUTES);
-  public static final TextAttributesKey TYPE_PARAMETER_NAME_ATTRIBUTES 
+  public static final TextAttributesKey INLINE_PARAMETER_HINT
+    = TextAttributesKey.createTextAttributesKey("INLINE_PARAMETER_HINT");
+  public static final TextAttributesKey TYPE_PARAMETER_NAME_ATTRIBUTES
     = TextAttributesKey.createTextAttributesKey("TYPE_PARAMETER_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.PARAMETER);
   public static final TextAttributesKey INTERFACE_NAME_ATTRIBUTES 
     = TextAttributesKey.createTextAttributesKey("INTERFACE_NAME_ATTRIBUTES", DefaultLanguageHighlighterColors.INTERFACE_NAME);
index e0a21347acf271ae2418f3b753359360ba712f8c..0258718b5cc825574b3c1e1aff1825acd5c833b4 100644 (file)
  */
 package com.intellij.codeInsight.highlighting;
 
-import com.intellij.codeInsight.daemon.impl.CollectHighlightsUtil;
-import com.intellij.codeInsight.daemon.impl.HighlightInfo;
-import com.intellij.codeInsight.daemon.impl.HighlightInfoProcessor;
-import com.intellij.codeInsight.daemon.impl.LocalInspectionsPass;
+import com.intellij.codeInsight.daemon.impl.*;
 import com.intellij.codeInspection.InspectionManager;
 import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.ex.*;
@@ -37,25 +34,29 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.openapi.ui.popup.PopupStep;
 import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
+import com.intellij.openapi.util.ProperTextRange;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.*;
 import com.intellij.util.Consumer;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-public class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBase<PsiLiteralExpression> {
+class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBase<PsiLiteralExpression> {
   private static final Logger LOG = Logger.getInstance("#" + HighlightSuppressedWarningsHandler.class.getName());
 
   private final PsiAnnotation myTarget;
   private final PsiLiteralExpression mySuppressedExpression;
+  private final ProperTextRange myPriorityRange;
 
-  protected HighlightSuppressedWarningsHandler(Editor editor, PsiFile file, PsiAnnotation target, PsiLiteralExpression suppressedExpression) {
+  HighlightSuppressedWarningsHandler(@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiAnnotation target, @Nullable PsiLiteralExpression suppressedExpression) {
     super(editor, file);
     myTarget = target;
     mySuppressedExpression = suppressedExpression;
+    myPriorityRange = VisibleHighlightingPassFactory.calculateVisibleRange(myEditor);
   }
 
   @Override
@@ -109,7 +110,8 @@ public class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBa
     final Project project = myTarget.getProject();
     final PsiElement parent = myTarget.getParent().getParent();
     final LocalInspectionsPass pass = new LocalInspectionsPass(myFile, myFile.getViewProvider().getDocument(),
-                                                               parent.getTextRange().getStartOffset(), parent.getTextRange().getEndOffset(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE,
+                                                               parent.getTextRange().getStartOffset(), parent.getTextRange().getEndOffset(),
+                                                               myPriorityRange,
                                                                false, HighlightInfoProcessor.getEmpty());
     final InspectionProfile inspectionProfile =
       InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
index b89f4b54de16879e4db91edfc0c248cffc6044b1..58293d42b45ec5de0d8e8b081a3975df9df5adbc 100644 (file)
@@ -31,8 +31,8 @@ import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.IntentionManager;
 import com.intellij.codeInsight.intention.QuickFixFactory;
 import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
 import com.intellij.codeInspection.ex.EntryPointsManagerBase;
-import com.intellij.codeInspection.unusedParameters.UnusedParametersInspection;
 import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase;
 import com.intellij.codeInspection.util.SpecialAnnotationsUtil;
 import com.intellij.diagnostic.AttachmentFactory;
@@ -655,8 +655,8 @@ public class QuickFixFactoryImpl extends QuickFixFactory {
   public void registerFixesForUnusedParameter(@NotNull PsiParameter parameter, @NotNull Object highlightInfo) {
     Project myProject = parameter.getProject();
     InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile();
-    UnusedParametersInspection unusedParametersInspection =
-      (UnusedParametersInspection)profile.getUnwrappedTool(UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME, parameter);
+    UnusedDeclarationInspectionBase unusedParametersInspection =
+      (UnusedDeclarationInspectionBase)profile.getUnwrappedTool(UnusedSymbolLocalInspectionBase.SHORT_NAME, parameter);
     LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || unusedParametersInspection != null);
     List<IntentionAction> options = new ArrayList<>();
     HighlightDisplayKey myUnusedSymbolKey = HighlightDisplayKey.find(UnusedSymbolLocalInspectionBase.SHORT_NAME);
index 8c963ffcd71ee2b0bbe118059aadf0ed454818fb..8b133fe38d8556acd0226fbfc333f0e85cef9fa6 100644 (file)
@@ -17,9 +17,11 @@ package com.intellij.codeInsight.navigation;
 
 import com.intellij.ide.util.MethodCellRenderer;
 import com.intellij.ide.util.PsiClassListCellRenderer;
+import com.intellij.ide.util.PsiClassOrFunctionalExpressionListCellRenderer;
 import com.intellij.ide.util.PsiElementListCellRenderer;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFunctionalExpression;
 import com.intellij.psi.PsiMethod;
 import org.jetbrains.annotations.NotNull;
 
@@ -35,6 +37,9 @@ public class JavaGotoTargetRendererProvider implements GotoTargetRendererProvide
     else if (element instanceof PsiClass) {
       return PsiClassListCellRenderer.INSTANCE;
     }
+    else if (element instanceof PsiFunctionalExpression) {
+      return new PsiClassOrFunctionalExpressionListCellRenderer();
+    }
     return null;
   }
 
index 2b1f8d0633d843baebf6de403d4159813ae3c952..95918f3c1db8e3459b77999df3f269a62443f238 100644 (file)
  */
 package com.intellij.codeInspection.deadCode;
 
-import com.intellij.codeInspection.InspectionsBundle;
+import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInspection.*;
 import com.intellij.codeInspection.ex.EntryPointsManagerImpl;
 import com.intellij.codeInspection.reference.EntryPoint;
+import com.intellij.codeInspection.reference.RefEntity;
+import com.intellij.codeInspection.reference.RefMethod;
+import com.intellij.codeInspection.reference.RefVisitor;
 import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
 import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase;
+import com.intellij.openapi.ui.VerticalFlowLayout;
 import com.intellij.ui.components.JBTabbedPane;
 import com.intellij.util.ui.JBUI;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.TestOnly;
 
 import javax.swing.*;
@@ -30,6 +37,8 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 public class UnusedDeclarationInspection extends UnusedDeclarationInspectionBase {
+  private final UnusedParametersInspection myUnusedParameters = new UnusedParametersInspection();
+
   public UnusedDeclarationInspection() { }
 
   @TestOnly
@@ -37,6 +46,58 @@ public class UnusedDeclarationInspection extends UnusedDeclarationInspectionBase
     super(enabledInEditor);
   }
 
+  @Nullable
+  @Override
+  public String getAlternativeID() {
+    return UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME;
+  }
+
+  @Override
+  public void runInspection(@NotNull AnalysisScope scope,
+                            @NotNull InspectionManager manager,
+                            @NotNull GlobalInspectionContext globalContext,
+                            @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
+    if (myLocalInspectionBase.PARAMETER) {
+      globalContext.getRefManager().iterate(new RefVisitor() {
+        @Override public void visitElement(@NotNull RefEntity refEntity) {
+          if (!(refEntity instanceof RefMethod) ||
+              !globalContext.shouldCheck(refEntity, UnusedDeclarationInspection.this) ||
+              !UnusedDeclarationPresentation.compareVisibilities((RefMethod)refEntity, myLocalInspectionBase.getParameterVisibility())) {
+            return;
+          }
+          CommonProblemDescriptor[] descriptors = myUnusedParameters.checkElement(refEntity, scope, manager, globalContext, problemDescriptionsProcessor);
+          if (descriptors != null) {
+            problemDescriptionsProcessor.addProblemElement(refEntity, descriptors);
+          }
+        }
+      });
+    }
+    super.runInspection(scope, manager, globalContext, problemDescriptionsProcessor);
+  }
+
+  @Override
+  public boolean queryExternalUsagesRequests(@NotNull InspectionManager manager,
+                                             @NotNull GlobalInspectionContext globalContext,
+                                             @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
+    final boolean requests = super.queryExternalUsagesRequests(manager, globalContext, problemDescriptionsProcessor);
+    if (!requests) {
+      myUnusedParameters.queryExternalUsagesRequests(manager, globalContext, problemDescriptionsProcessor);
+    }
+    return requests;
+  }
+
+  @Nullable
+  @Override
+  public String getHint(@NotNull QuickFix fix) {
+    return myUnusedParameters.getHint(fix);
+  }
+
+  @Nullable
+  @Override
+  public QuickFix getQuickFix(String hint) {
+    return myUnusedParameters.getQuickFix(hint);
+  }
+
   @SuppressWarnings("deprecation")
   @Override
   protected UnusedSymbolLocalInspectionBase createUnusedSymbolLocalInspection() {
@@ -126,8 +187,15 @@ public class UnusedDeclarationInspection extends UnusedDeclarationInspectionBase
       });
 
       gc.gridy++;
-      gc.weighty = 1;
       add(myNonJavaCheckbox, gc);
+
+      gc.fill = GridBagConstraints.NONE;
+      gc.gridy++;
+      gc.weighty = 1;
+      final JPanel btnPanel = new JPanel(new VerticalFlowLayout());
+      btnPanel.add(EntryPointsManagerImpl.createConfigureClassPatternsButton());
+      btnPanel.add(EntryPointsManagerImpl.createConfigureAnnotationsButton());
+      add(btnPanel, gc);
     }
 
   }
index bf56d94136f30f19779f5fe5e67b054f180ecc41..7dc55f6430a464e149c263314eaff19edb2838ba 100644 (file)
@@ -49,8 +49,6 @@ import com.intellij.util.ArrayUtil;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.VisibilityUtil;
 import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.HashMap;
-import com.intellij.util.containers.HashSet;
 import com.intellij.util.text.CharArrayUtil;
 import com.intellij.util.text.DateFormatUtil;
 import com.intellij.util.ui.JBUI;
@@ -77,7 +75,6 @@ import java.util.*;
 import java.util.function.Predicate;
 
 public class UnusedDeclarationPresentation extends DefaultInspectionToolPresentation {
-  private final Map<String, Set<RefEntity>> myPackageContents = Collections.synchronizedMap(new HashMap<String, Set<RefEntity>>());
 
   private final Set<RefEntity> myIgnoreElements = ContainerUtil.newConcurrentSet(TObjectHashingStrategy.IDENTITY);
   private final Map<RefEntity, UnusedDeclarationHint> myFixedElements = ContainerUtil.newConcurrentMap(TObjectHashingStrategy.IDENTITY);
@@ -194,7 +191,11 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
       }
     }
 
-    return showFixes ? myQuickFixActions : QuickFixAction.EMPTY;
+    if (showFixes) {
+      final QuickFixAction[] fixes = super.getQuickFixes(refElements, allowedDescriptors);
+      return fixes != null ? ArrayUtil.mergeArrays(fixes, myQuickFixActions) : myQuickFixActions;
+    }
+    return QuickFixAction.EMPTY;
   }
 
   final QuickFixAction[] myQuickFixActions;
@@ -425,7 +426,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
   @Override
   public void updateContent() {
     getTool().checkForReachableRefs(getContext());
-    myPackageContents.clear();
+    myContents.clear();
     final UnusedSymbolLocalInspectionBase localInspectionTool = getTool().getSharedLocalInspectionTool();
     getContext().getRefManager().iterate(new RefJavaVisitor() {
       @Override public void visitElement(@NotNull RefEntity refEntity) {
@@ -433,22 +434,20 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
         RefJavaElement refElement = (RefJavaElement)refEntity;
         if (!compareVisibilities(refElement, localInspectionTool)) return;
         if (!(getContext().getUIOptions().FILTER_RESOLVED_ITEMS && getIgnoredRefElements().contains(refElement)) && refElement.isValid() && getFilter().accepts(refElement)) {
-          String packageName = RefJavaUtil.getInstance().getPackageName(refEntity);
-          Set<RefEntity> content = myPackageContents.get(packageName);
-          if (content == null) {
-            content = new HashSet<>();
-            myPackageContents.put(packageName, content);
-          }
-          content.add(refEntity);
+          registerContentEntry(refEntity, RefJavaUtil.getInstance().getPackageName(refEntity));
         }
       }
     });
+    updateProblemElements();
   }
 
   @PsiModifier.ModifierConstant
   private static String getAcceptedVisibility(UnusedSymbolLocalInspectionBase tool, RefJavaElement element) {
+    if (element instanceof RefImplicitConstructor) {
+      element = ((RefImplicitConstructor)element).getOwnerClass();
+    }
     if (element instanceof RefClass) {
-      return tool.getClassVisibility();
+      return element.getOwner() instanceof RefClass ? tool.getInnerClassVisibility() : tool.getClassVisibility();
     }
     if (element instanceof RefField) {
       return tool.getFieldVisibility();
@@ -471,11 +470,15 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
     return PsiModifier.PUBLIC;
   }
 
-  private static boolean compareVisibilities(RefJavaElement listOwner, UnusedSymbolLocalInspectionBase localInspectionTool) {
-    final String visibility = getAcceptedVisibility(localInspectionTool, listOwner);
-    if (visibility != null) {
+  protected static boolean compareVisibilities(RefJavaElement listOwner,
+                                               UnusedSymbolLocalInspectionBase localInspectionTool) {
+    return compareVisibilities(listOwner, getAcceptedVisibility(localInspectionTool, listOwner));
+  }
+
+  protected static boolean compareVisibilities(RefJavaElement listOwner, final String acceptedVisibility) {
+    if (acceptedVisibility != null) {
       while (listOwner != null) {
-        if (VisibilityUtil.compare(listOwner.getAccessModifier(), visibility) >= 0) {
+        if (VisibilityUtil.compare(listOwner.getAccessModifier(), acceptedVisibility) >= 0) {
           return true;
         }
         final RefEntity parent = listOwner.getOwner();
@@ -492,13 +495,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
 
   @Override
   public boolean hasReportedProblems() {
-    return !myPackageContents.isEmpty();
-  }
-
-  @NotNull
-  @Override
-  public Map<String, Set<RefEntity>> getContent() {
-    return myPackageContents;
+    return !myContents.isEmpty() || super.hasReportedProblems();
   }
 
   @Override
@@ -515,7 +512,6 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
   @Override
   public void cleanup() {
     super.cleanup();
-    myPackageContents.clear();
     myIgnoreElements.clear();
   }
 
@@ -558,6 +554,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
       if (COMMENT.equals(hint)) {
         return new CommentOutFix(((ProblemDescriptor)descriptor).getPsiElement());
       }
+      return super.findQuickFixes(descriptor, hint);
     }
     return null;
   }
similarity index 84%
rename from java/java-impl/src/com/intellij/codeInspection/unusedParameters/UnusedParametersInspection.java
rename to java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedParametersInspection.java
index ba08c94f67b146dbbb81a5e451ee019ce8a2c996..f06ba2a958cfeb410840bde6304cbc5e817c2594 100644 (file)
  * To change template for new class use
  * Code Style | Class Templates options (Tools | IDE Options).
  */
-package com.intellij.codeInspection.unusedParameters;
+package com.intellij.codeInspection.deadCode;
 
 import com.intellij.analysis.AnalysisScope;
 import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInsight.daemon.GroupNames;
 import com.intellij.codeInspection.*;
 import com.intellij.codeInspection.ex.EntryPointsManager;
-import com.intellij.codeInspection.ex.EntryPointsManagerImpl;
 import com.intellij.codeInspection.reference.*;
 import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Comparing;
 import com.intellij.psi.*;
 import com.intellij.psi.search.PsiReferenceProcessor;
 import com.intellij.psi.search.PsiReferenceProcessorAdapter;
@@ -44,18 +41,13 @@ import com.intellij.psi.util.PsiModificationTracker;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
 import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
-import com.intellij.util.ui.JBUI;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import javax.swing.*;
-import java.awt.*;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
-public class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
+class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
   @Override
   @Nullable
   public CommonProblemDescriptor[] checkElement(@NotNull final RefEntity refEntity,
@@ -91,9 +83,7 @@ public class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
         final PsiIdentifier psiIdentifier = parameter != null ? parameter.getNameIdentifier() : null;
         if (psiIdentifier != null) {
           result.add(manager.createProblemDescriptor(psiIdentifier,
-                                                     refMethod.isAbstract()
-                                                     ? InspectionsBundle.message("inspection.unused.parameter.composer")
-                                                     : InspectionsBundle.message("inspection.unused.parameter.composer1"),
+                                                     InspectionsBundle.message(refMethod.isAbstract() ? "inspection.unused.parameter.composer" : "inspection.unused.parameter.composer1"),