Merge remote-tracking branch 'origin/master' into develar/is
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 18 Jul 2016 09:22:38 +0000 (11:22 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 18 Jul 2016 09:22:38 +0000 (11:22 +0200)
# Conflicts:
# platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java
# platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java

381 files changed:
bin/scripts/win/idea.bat
build/groovy/org/jetbrains/intellij/build/BuildContext.groovy
build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/LibraryLicense.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/LibraryLicensesListGenerator.groovy [new file with mode: 0644]
build/scripts/libLicenses.gant [deleted file]
java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java
java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoActionHandler.java
java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java
java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/ClassesOrderRootTypeUIFactory.java
java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileInfoSetImpl.java
java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.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/quickfix/GoToSymbolFix.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MoveFileFix.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/reference/RefJavaManagerImpl.java
java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java
java/java-impl/src/com/intellij/codeInspection/ex/ConfigureClassPatternsDialog.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java
java/java-impl/src/com/intellij/ide/util/gotoByName/JavaModuleNavigationContributor.kt [new file with mode: 0644]
java/java-impl/src/com/intellij/lang/java/JavaBreadcrumbsInfoProvider.java
java/java-impl/src/com/intellij/lang/java/JavaFormattingModelBuilder.java
java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java
java/java-impl/src/com/intellij/psi/formatter/java/ChainMethodCallsBlockBuilder.java
java/java-impl/src/com/intellij/psi/formatter/java/CodeBlockBlock.java
java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationReplacementUtil.java
java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java
java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java
java/java-psi-impl/src/com/intellij/codeInsight/highlighting/JavaHighlightUsagesDescriptionProvider.java
java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java
java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaModulePresentationProvider.java [new file with mode: 0644]
java/java-psi-impl/src/messages/JavaErrorMessages.properties
java/java-tests/testData/codeInsight/typing/semicolonInComment_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/typing/semicolonInComment_before.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/typing/semicolonInStringLiteral_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/typing/semicolonInStringLiteral_before.java [new file with mode: 0644]
java/java-tests/testData/psi/parser-partial/modules/Name3.txt [new file with mode: 0644]
java/java-tests/testData/refactoring/moveInstanceMethod/IOOBE_MovingInvalidCode.java [new file with mode: 0644]
java/java-tests/testData/refactoring/moveInstanceMethod/IOOBE_MovingInvalidCode.java.after [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/ModuleHighlightingTest.kt
java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationClassPatternsTest.kt [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/lang/java/parser/partial/ModuleParserTest.java
java/java-tests/testSrc/com/intellij/navigation/ModuleNavigationTest.kt [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/psi/formatter/java/AbstractJavaFormatterTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/performance/JavaSmartReformatPerformanceTest.java
java/java-tests/testSrc/com/intellij/refactoring/moveMethod/MoveInstanceMethodTest.java
java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java
java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/inspections/MigrateAssertToMatcherAssertInspection.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/guava/BaseGuavaTypeConversionRule.java
java/typeMigration/test/com/intellij/codeInsight/inspections/GuavaInspectionTest.java
java/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java
java/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java
java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java
java/typeMigration/testData/inspections/guava/functionIsMethodReference.java [new file with mode: 0644]
java/typeMigration/testData/inspections/guava/functionIsMethodReference_after.java [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/multiVarDeclaration1/after/Test.items [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/multiVarDeclaration1/after/test.java [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/multiVarDeclaration1/before/test.java [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/multiVarDeclaration2/after/Test.items [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/multiVarDeclaration2/after/test.java [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/multiVarDeclaration2/before/test.java [new file with mode: 0644]
platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java
platform/analysis-api/src/com/intellij/codeInspection/ex/EntryPointsManager.java
platform/analysis-impl/src/com/intellij/codeHighlighting/RainbowHighlighter.java
platform/core-api/src/com/intellij/psi/ElementDescriptionUtil.java
platform/core-api/src/com/intellij/psi/codeStyle/ChangedRangesInfo.java
platform/core-api/src/com/intellij/psi/codeStyle/CodeStyleManager.java
platform/diff-api/src/com/intellij/diff/comparison/ComparisonManagerEx.java [new file with mode: 0644]
platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java
platform/editor-ui-api/src/com/intellij/openapi/editor/markup/HighlighterLayer.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTaskProvider.java
platform/icons/src/nodes/javaModule.png [new file with mode: 0644]
platform/icons/src/nodes/javaModule@2x.png [new file with mode: 0644]
platform/icons/src/nodes/javaModuleRoot.png [new file with mode: 0644]
platform/icons/src/nodes/javaModuleRoot@2x.png [new file with mode: 0644]
platform/icons/src/runConfigurations/testState/red2.png
platform/icons/src/runConfigurations/testState/red2@2x.png
platform/icons/src/runConfigurations/testState/red2@2x_dark.png
platform/icons/src/runConfigurations/testState/red2_dark.png
platform/icons/src/windows/closeActive@2x.png
platform/icons/src/windows/closeActive@2x_dark.png
platform/icons/src/windows/closeHover@2x.png
platform/icons/src/windows/closeInactive@2x.png
platform/icons/src/windows/closeInactive@2x_dark.png
platform/lang-api/src/com/intellij/codeInspection/offline/OfflineProblemDescriptor.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficLightRenderer.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java
platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionRVContentProvider.java
platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionRVContentProviderImpl.java
platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineDescriptorResolveResult.java
platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineInspectionRVContentProvider.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/InspectionResultsViewComparator.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeNode.java
platform/lang-impl/src/com/intellij/execution/TerminateRemoteProcessDialog.java
platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProvider.java
platform/lang-impl/src/com/intellij/execution/ui/RunContentManagerImpl.java
platform/lang-impl/src/com/intellij/formatting/AdjustFormatRangesState.kt
platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java
platform/lang-impl/src/com/intellij/formatting/FormatTextRanges.java
platform/lang-impl/src/com/intellij/formatting/FormattingRangesInfo.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/actions/GotoSymbolAction.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/ExportableFileTemplateSettings.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateSettings.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/projectView/impl/NestingTreeStructureProvider.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/NestingTreeNode.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java
platform/lang-impl/src/com/intellij/psi/formatter/common/AbstractBlock.java
platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java
platform/lang-impl/src/com/intellij/psi/search/PredefinedSearchScopeProviderImpl.java
platform/lang-impl/src/com/intellij/tools/Tool.java
platform/lang-impl/src/com/intellij/util/JdkBundle.java
platform/lang-impl/src/com/intellij/util/indexing/MapIndexStorage.java
platform/platform-api/src/com/intellij/execution/process/AnsiEscapeDecoder.java
platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java
platform/platform-api/src/com/intellij/ide/GeneralSettings.java
platform/platform-api/src/com/intellij/ui/EffectPainter.java [deleted file]
platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java
platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/GeneralSettingsConfigurable.java
platform/platform-impl/src/com/intellij/ide/GeneralSettingsPanel.form
platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java
platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java
platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java
platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/DarculaLaf.java
platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextFieldUI.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/ContentChooser.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/CopyAction.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/CutAction.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/PasteAction.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/SetEditorBidiTextDirectionAction.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleColumnModeAction.java
platform/platform-impl/src/com/intellij/openapi/editor/ex/BidiTextDirection.java [moved from platform/core-api/src/com/intellij/psi/codeStyle/DiffInfo.java with 85% similarity]
platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorSettingsExternalizable.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/IterationState.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.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/LineLayout.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/TextLayoutCache.java
platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditorImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentSelectionModel.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/ReadOnlyStatusDialog.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewRecentProjectPanel.java
platform/platform-impl/src/com/intellij/platform/WebProjectGenerator.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/DiffBundle.properties
platform/platform-resources-en/src/messages/IdeBundle.properties
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/META-INF/LangExtensions.xml
platform/platform-resources/src/idea/PlatformActions.xml
platform/platform-tests/testData/editor/painting/caretRowHasLowerPriorityThanSyntax.png [deleted file]
platform/platform-tests/testData/editor/painting/caretRowWinsOverSyntaxEvenInPresenceOfHighlighter.png [new file with mode: 0644]
platform/platform-tests/testSrc/com/intellij/codeInsight/actions/MockCodeStyleManager.java
platform/platform-tests/testSrc/com/intellij/ide/fileTemplates/impl/LightFileTemplatesTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorRtlTest.java
platform/testFramework/src/_LastInSuiteTest.java
platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java
platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java
platform/testFramework/src/com/intellij/testFramework/LightProjectDescriptor.java
platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/util-rt/src/com/intellij/openapi/util/Bitness.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/execution/process/ProcessHandler.java
platform/util/src/com/intellij/icons/AllIcons.java
platform/util/src/com/intellij/openapi/util/MultiValuesMap.java
platform/util/src/com/intellij/ui/JBColor.java
platform/util/src/com/intellij/util/io/PersistentHashMap.java
platform/util/src/com/intellij/util/io/PersistentHashMapValueStorage.java
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/PatchReader.java
platform/vcs-api/vcs-api-core/src/com/intellij/openapi/diff/impl/patch/TextPatchBuilder.java
platform/vcs-api/vcs-api-core/vcs-api-core.iml
platform/vcs-impl/src/com/intellij/codeInsight/actions/VcsAwareFormatChangedTextUtil.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchMergeTool.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/tool/ApplyPatchViewer.java
platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RangesBuilder.java
platform/vcs-log/api/src/com/intellij/vcs/log/CommitId.java
platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogDataKeys.java
platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefs.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/MiniDetailsGetter.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/RefsModel.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogData.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogRefresherImpl.java
platform/vcs-log/impl/src/com/intellij/vcs/log/data/VisiblePackBuilder.java
platform/vcs-log/impl/src/com/intellij/vcs/log/graph/GraphColorManagerImpl.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/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java
platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogRefresherTest.java
platform/vcs-log/impl/test/com/intellij/vcs/log/data/VisiblePackBuilderTest.kt
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/IgnoreResultOfCallInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/ThrowableInstanceNeverThrownInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/ThrowableResultOfMethodCallIgnoredInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/TooBroadScopeInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/BoolUtils.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ControlFlowStatementVisitorBase.java [new file with mode: 0644]
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/ControlFlowStatementWithoutBracesInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/SingleStatementInBlockInspection.java [new file with mode: 0644]
plugins/InspectionGadgets/src/inspectionDescriptions/SingleStatementInBlock.html [moved from plugins/IntentionPowerPak/src/intentionDescriptions/RemoveBracesIntention/description.html with 53% similarity]
plugins/InspectionGadgets/test/com/siyeh/igfixes/j2me/simplifiable_if_statement/ParenthesesForConditional.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/j2me/simplifiable_if_statement/ParenthesesForConditional.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/BetweenIfAndElse.java [moved from plugins/IntentionPowerPak/test/com/siyeh/ipp/braces/remove/BetweenIfAndElse.java with 100% similarity]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/DoWhile.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/DoWhile.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/ForEach.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/ForEach.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/ForIndex.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/ForIndex.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfElse.after.java [moved from plugins/IntentionPowerPak/test/com/siyeh/ipp/braces/remove/IfElse2_after.java with 100% similarity]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfElse.java [moved from plugins/IntentionPowerPak/test/com/siyeh/ipp/braces/remove/IfElse.java with 88% similarity]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfElse2.after.java [moved from plugins/IntentionPowerPak/test/com/siyeh/ipp/braces/remove/IfElse_after.java with 100% similarity]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfElse2.java [moved from plugins/IntentionPowerPak/test/com/siyeh/ipp/braces/remove/IfElse2.java with 100% similarity]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/While.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/While.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderInnerElse.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderInnerElse.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderInnerFor.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderInnerFor.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderInnerIf.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderInnerIf.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOuterElse.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOuterElse.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOuterFor.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOuterFor.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOuterIf.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOuterIf.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/statement_without_braces/LadderOutside.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/throwable_instance_never_thrown/ThrowableInstanceNeverThrown.java
plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/throwable_result_of_method_call_ignored/ThrowableResultOfMethodCallIgnored.java
plugins/InspectionGadgets/test/com/siyeh/igtest/style/single_statement_block/SingleStatement.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/style/single_statement_block/expected.xml [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/style/statements_without_braces/ControlFlowStatements.java
plugins/InspectionGadgets/test/com/siyeh/igtest/style/statements_without_braces/expected.xml
plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/IgnoreResultOfCallInspectionTest.groovy
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/braces/ControlFlowStatementWithoutBracesFixTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/braces/SingleStatementInBlockFixTest.java [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/j2me/SimplifiableIfStatementFixTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/SingleStatementInBlockInspectionTest.java [new file with mode: 0644]
plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml
plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties
plugins/IntentionPowerPak/src/com/siyeh/ipp/braces/BaseBracesIntention.java [deleted file]
plugins/IntentionPowerPak/src/com/siyeh/ipp/braces/RemoveBracesIntention.java [deleted file]
plugins/IntentionPowerPak/src/intentionDescriptions/RemoveBracesIntention/after.java.template [deleted file]
plugins/IntentionPowerPak/src/intentionDescriptions/RemoveBracesIntention/before.java.template [deleted file]
plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/braces/RemoveBracesIntentionTest.java [deleted file]
plugins/devkit/src/inspections/quickfix/PluginDescriptorChooser.java
plugins/git4idea/src/git4idea/repo/GitRepositoryFiles.java
plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java
plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java
plugins/git4idea/testData/repo/symbolic-refs/current-branch.txt
plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java
plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxEntryPoint.java
plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java
plugins/junit5_rt/src/com/intellij/junit5/JUnit5TestRunnerUtil.java
plugins/testng/src/com/theoryinpractice/testng/inspection/TestNGEntryPoint.java
plugins/testng_rt/src/org/testng/IDEARemoteTestNG.java
plugins/testng_rt/src/org/testng/IDEATestNGConfigurationListener.java [new file with mode: 0644]
plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java
plugins/testng_rt/src/org/testng/IDEATestNGTestListener.java
plugins/yaml/gen/org/jetbrains/yaml/lexer/_YAMLLexer.java
plugins/yaml/src/org/jetbrains/yaml/lexer/yaml.flex
plugins/yaml/src/org/jetbrains/yaml/psi/impl/YAMLQuotedTextImpl.java
plugins/yaml/src/org/jetbrains/yaml/psi/impl/YAMLScalarTextImpl.java
plugins/yaml/testSrc/org/jetbrains/yaml/lexer/YAMLLexerTest.java
plugins/yaml/testSrc/org/jetbrains/yaml/lexer/data/unicodeNewlines.yml [new file with mode: 0644]
plugins/yaml/testSrc/org/jetbrains/yaml/psi/YAMLScalarContentTest.java
plugins/yaml/testSrc/org/jetbrains/yaml/psi/data/doubleQuote4.txt [new file with mode: 0644]
plugins/yaml/testSrc/org/jetbrains/yaml/psi/data/doubleQuote4.yml [new file with mode: 0644]
plugins/yaml/testSrc/org/jetbrains/yaml/scalarConversion/YAMLScalarConversionTest.java
plugins/yaml/testSrc/org/jetbrains/yaml/scalarConversion/data/rubyCode.txt [new file with mode: 0644]
python/educational-core/course-creator/resources/META-INF/plugin.xml
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCLanguageManager.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCStepEditorNotificationProvider.java [new file with mode: 0644]
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCStudyActionListener.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCTestsTabTitleProvider.java [new file with mode: 0644]
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCUtils.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCVirtualFileListener.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAddAnswerPlaceholder.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCEditTaskTextAction.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCNewStepAction.java [new file with mode: 0644]
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCStudentInvisibleFileNode.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCTreeStructureProvider.java
python/educational-core/student/src/com/jetbrains/edu/learning/StudyProjectComponent.java
python/educational-core/student/src/com/jetbrains/edu/learning/StudyStepManager.java [new file with mode: 0644]
python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java
python/educational-core/student/src/com/jetbrains/edu/learning/actions/StudyFillPlaceholdersAction.java
python/educational-core/student/src/com/jetbrains/edu/learning/actions/StudyRefreshTaskFileAction.java
python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckTask.java
python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java
python/educational-core/student/src/com/jetbrains/edu/learning/core/EduAnswerPlaceholderPainter.java
python/educational-core/student/src/com/jetbrains/edu/learning/core/EduDocumentListener.java
python/educational-core/student/src/com/jetbrains/edu/learning/core/EduNames.java
python/educational-core/student/src/com/jetbrains/edu/learning/core/EduUtils.java
python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Course.java
python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Step.java [new file with mode: 0644]
python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Task.java
python/educational-core/student/src/com/jetbrains/edu/learning/editor/StudyEditorFactoryListener.java
python/educational-core/student/src/com/jetbrains/edu/learning/projectView/StudyDirectoryNode.java
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/StepicWrappers.java
python/educational-core/student/src/com/jetbrains/edu/learning/ui/StudyToolWindow.java
python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCLanguageManager.java
python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/run/PyCCCommandLineState.java
python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/run/PyCCRunTestsConfigurationProducer.java
python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyCheckAction.java
python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java
python/helpers/pycharm/django_manage_shell.py
python/helpers/python-skeletons/re.py
python/psi-api/src/com/jetbrains/python/PyNames.java
python/resources/pycharm_core_about.png
python/resources/pycharm_core_about@2x.png
python/resources/pycharm_core_logo.png
python/resources/pycharm_core_logo@2x.png
python/src/com/jetbrains/python/codeInsight/regexp/PythonRegexpInjector.java
python/src/com/jetbrains/python/inspections/PyAttributeOutsideInitInspection.java
python/src/com/jetbrains/python/inspections/PyCallByClassInspection.java
python/src/com/jetbrains/python/inspections/PyMethodParametersInspection.java
python/src/com/jetbrains/python/inspections/PyPropertyAccessInspection.java
python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java
python/src/com/jetbrains/python/inspections/PyProtectedMemberInspection.java
python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java
python/src/com/jetbrains/python/inspections/PySuperArgumentsInspection.java
python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java
python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java
python/src/com/jetbrains/python/packaging/PyPackagesUpdater.java
python/src/com/jetbrains/python/packaging/ui/PyPackageManagementService.java
python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java
python/src/com/jetbrains/python/psi/impl/PyClassImpl.java
python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java
python/src/com/jetbrains/python/psi/impl/references/PyQualifiedReference.java
python/src/com/jetbrains/python/psi/impl/references/PyReferenceImpl.java
python/src/com/jetbrains/python/psi/search/PySuperMethodsSearchExecutor.java
python/src/com/jetbrains/python/psi/types/PyABCUtil.java
python/src/com/jetbrains/python/psi/types/PyTypeChecker.java
python/testData/codeInsight/classMRO/DuplicatedBaseClasses.py [new file with mode: 0644]
python/testData/inspections/PyPropertyAccessInspection/writeToAttrInSlots.py [new file with mode: 0644]
python/testData/inspections/PyTypeCheckerInspection/MutableMapping.py [new file with mode: 0644]
python/testData/inspections/PyUnresolvedReferencesInspection3K/reAndRegexFullmatch.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/PyRegexpTest.java
python/testSrc/com/jetbrains/python/PyTypeTest.java
python/testSrc/com/jetbrains/python/codeInsight/PyClassMROTest.java
python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java
python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java
python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java
resources-en/src/fileTemplates/default.html
resources-en/src/fileTemplates/includes/File Header.java.html
resources-en/src/fileTemplates/includes/default.html
resources/src/META-INF/IdeaPlugin.xml
xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java

index 6ef406ccc23ca26772da08fb4150eafed7ccb046..e40302ee716a4c5a4e6a911c2294c66e71d0e169 100644 (file)
 :: ---------------------------------------------------------------------
 IF EXIST "%@@product_uc@@_JDK%" SET JDK=%@@product_uc@@_JDK%
 IF NOT "%JDK%" == "" GOTO jdk
+SET BITS=64
+SET USER_JDK64_FILE=%USERPROFILE%\.@@system_selector@@\config\@@vm_options@@.jdk
+SET BITS=
 SET USER_JDK_FILE=%USERPROFILE%\.@@system_selector@@\config\@@vm_options@@.jdk
-IF EXIST "%USER_JDK_FILE%" SET/pJDK=<%USER_JDK_FILE%
+IF EXIST "%USER_JDK64_FILE%" ( SET/pJDK=<%USER_JDK64_FILE%
+) ELSE ( IF EXIST "%USER_JDK_FILE%" SET/pJDK=<%USER_JDK_FILE% )
 IF "%JDK%" == "" GOTO jdk0
 IF EXIST "%JDK%" GOTO jdk
 SET JDK=%~dp0\..\%JDK%
@@ -33,7 +37,6 @@ IF NOT EXIST "%JAVA_EXE%" GOTO error
 
 SET JRE=%JDK%
 IF EXIST "%JRE%\jre" SET JRE=%JDK%\jre
-SET BITS=
 IF EXIST "%JRE%\lib\amd64" SET BITS=64
 
 :: ---------------------------------------------------------------------
index f73294e7b9bf679be7b5744b9f98f51125ac4fb1..50fdfa225dddb9252a001ac5db87217aae6a0746 100644 (file)
@@ -40,6 +40,7 @@ abstract class BuildContext {
   MacHostProperties macHostProperties
   BuildOptions options
   SignTool signTool
+  ScrambleTool scrambleTool
   BundledJreManager bundledJreManager
 
   /**
@@ -80,9 +81,10 @@ abstract class BuildContext {
 
   public static BuildContext createContext(GantBuilder ant, JpsGantProjectBuilder projectBuilder, JpsProject project, JpsGlobal global,
                                            String communityHome, String projectHome, String buildOutputRoot, ProductProperties productProperties,
-                                           BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null, SignTool signTool = null) {
+                                           BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null, SignTool signTool = null,
+                                           ScrambleTool scrambleTool = null) {
     return new BuildContextImpl(ant, projectBuilder, project, global, communityHome, projectHome, buildOutputRoot, productProperties,
-                                options, macHostProperties, signTool)
+                                options, macHostProperties, signTool, scrambleTool)
   }
 }
 
diff --git a/build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy b/build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
new file mode 100644 (file)
index 0000000..75c8532
--- /dev/null
@@ -0,0 +1,369 @@
+/*
+ * 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
+
+import static org.jetbrains.intellij.build.LibraryLicense.jetbrainsLibrary
+import static org.jetbrains.intellij.build.LibraryLicense.libraryLicense
+
+/**
+ * @author nik
+ */
+class CommunityLibraryLicenses {
+  public static final List<LibraryLicense> LICENSES_LIST = [
+    libraryLicense(name: "aether-api-0.9.0.M2.jar", version: "0.9.0.M2", libraryNames: ["aether-api-0.9.0.M2.jar"],
+                   license: "Eclipse Public License v1.0", url: "http://www.eclipse.org/aether/",
+                   licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html"),
+    libraryLicense(name: "aether-api", version: "1.13.1", libraryNames: ["aether-api-1.13.1.jar"], license: "Apache 2.0",
+                   url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Alloy L&F", libraryName: "alloy.jar", version: "1.4.4", license: "link (company license)",
+                   url: "http://lookandfeel.incors.com/",
+                   licenseUrl: "http://lookandfeel.incors.com/display_licence.php?back=purchase.php&selMenu=Purchase"),
+    libraryLicense(name: "Android Builder Model", libraryName: "builder-model", license: "Apache 2.0", url: "http://source.android.com/"),
+    libraryLicense(name: "Android Builder", libraryName: "android-builder", license: "Apache 2.0", url: "http://source.android.com/"),
+    libraryLicense(name: "Android Gradle model", libraryName: "android-gradle-model", version: "0.4-SNAPSHOT", license: "Apache 2.0",
+                   url: "https://android.googlesource.com/platform/tools/build/+/master/gradle-model/"),
+    libraryLicense(name: "Android SDK Tools JPS", libraryName: "android-sdk-tools-jps", license: "Apache 2.0",
+                   url: "http://source.android.com/"),
+    libraryLicense(name: "Android SDK Tools", libraryName: "android-sdk-tools", license: "Apache 2.0", url: "http://source.android.com/"),
+    libraryLicense(name: "Ant", version: "1.9", license: "Apache 2.0", url: "http://ant.apache.org/",
+                   licenseUrl: "http://ant.apache.org/license.html"),
+    libraryLicense(name: "ANTLR 4 Runtime", libraryName: "antlr-runtime-4.1.jar", version: "4.1", license: "BSD",
+                   url: "http://www.antlr.org", licenseUrl: "http://www.antlr.org/license.html"),
+    libraryLicense(name: "Antlr", libraryName: "antlr.jar", version: "3.4", license: "BSD", url: "http://www.antlr.org",
+                   licenseUrl: "http://www.antlr.org/license.html"),
+    libraryLicense(name: "Apache Commons BeanUtils", libraryName: "commons-beanutils.jar", version: "1.6", license: "Apache 2.0",
+                   url: "http://commons.apache.org/beanutils/"),
+    libraryLicense(name: "Apache Commons Codec", libraryName: "commons-codec", version: "1.8", license: "Apache 2.0",
+                   url: "http://commons.apache.org/codec/", licenseUrl: "http://www.apache.org/licenses/"),
+    libraryLicense(name: "Apache Commons Compress", libraryName: "commons-compress", version: "1.10", license: "Apache 2.0",
+                   url: "http://commons.apache.org/proper/commons-compress/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Apache Commons Discovery", libraryName: "commons-discovery-0.4.jar", version: "0.4", license: "Apache 2.0",
+                   url: "http://jakarta.apache.org/commons/discovery/", licenseUrl: "http://www.apache.org/licenses/"),
+    libraryLicense(name: "Apache Commons HTTPClient", libraryName: "http-client-3.1", version: "3.1&nbsp; (with patch by JetBrains)",
+                   license: "Apache 2.0", url: "http://hc.apache.org/httpclient-3.x"),
+    libraryLicense(name: "Apache Commons IO", libraryName: "commons-io-1.4.jar", version: "1.4", license: "Apache 2.0",
+                   url: "http://commons.apache.org/io/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt"),
+    libraryLicense(name: "Apache Commons Logging", libraryName: "commons-logging", version: "1.1.1", license: "Apache 2.0",
+                   url: "http://commons.apache.org/logging/"),
+    libraryLicense(name: "Apache Commons Net", libraryName: "commons-net", version: "3.3", license: "Apache 2.0",
+                   url: "http://commons.apache.org/net/"),
+    libraryLicense(name: "Apache Lucene", libraryName: "lucene-core-2.4.1.jar", version: "2.4.1", license: "Apache 2.0",
+                   url: "http://lucene.apache.org/java"),
+    libraryLicense(name: "Apache Sanselan", libraryName: "Sanselan", version: "0.98", license: "Apache 2.0",
+                   url: "https://commons.apache.org/proper/commons-imaging/"),
+    libraryLicense(name: "Apache XML Graphics Commons", libraryName: "xmlgraphics-commons-1.3.1.jar", version: "1.3.1",
+                   license: "Apache 2.0", url: "http://xmlgraphics.apache.org/commons/",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "ASM Bytecode Manipulation Framework", libraryName: "ASM", version: "6.0-ALPHA (with patches by JetBrains)",
+                   license: "BSD", url: "http://asm.objectweb.org/", licenseUrl: "http://asm.objectweb.org/license.html"),
+    libraryLicense(name: "assertJ", version: "3", license: "Apache 2.0", url: "https://github.com/joel-costigliola/assertj-core"),
+    libraryLicense(name: "Automaton", libraryName: "automaton.jar", version: "1.11", license: "BSD", url: "http://www.brics.dk/automaton/",
+                   licenseUrl: "http://www.opensource.org/licenses/bsd-license.php"),
+    libraryLicense(name: "Axis", libraryName: "axis-1.4", version: "1.4", license: "Apache 2.0", url: "http://ws.apache.org/axis/",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.html"),
+    libraryLicense(name: "bouncy-castle", version: "1.48", license: "MIT License", url: "http://bouncycastle.org",
+                   licenseUrl: "http://bouncycastle.org/licence.html"),
+    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"),
+    libraryLicense(name: "classworlds", libraryName: "classworlds-1.1.jar", version: "1.1", license: "codehaus",
+                   url: "https://github.com/codehaus/classworlds",
+                   licenseUrl: "https://github.com/codehaus/classworlds/blob/master/classworlds/LICENSE.txt"),
+    libraryLicense(name: "coverage.py", attachedTo: "python-helpers", version: "3.7.1", license: "Apache 2.0",
+                   url: "http://coverage.readthedocs.org/"),
+    libraryLicense(name: "Cucumber-Core", libraryName: "cucumber-core", version: "1.2.4", license: "MIT License",
+                   url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html"),
+    libraryLicense(name: "Cucumber-Groovy", libraryName: "cucumber-groovy", version: "1.2.4", license: "MIT License",
+                   url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html"),
+    libraryLicense(name: "Cucumber-Java", libraryName: "cucumber-java", version: "1.2.4", license: "MIT License",
+                   url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html"),
+    libraryLicense(name: "data-binding", libraryName: "data-binding.jar", license: "Apache 2.0", url: "http://source.android.com/"),
+    libraryLicense(name: "Diffutils", libraryName: "Diffutils", version: "1.2.1", license: "The Apache Software License, Version 2.0",
+                   url: "https://code.google.com/archive/p/java-diff-utils/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "docutils", attachedTo: "python-helpers", version: "0.8", license: "BSD", url: "http://docutils.sourceforge.net/"),
+    libraryLicense(name: "DTDParser", version: "1.13", license: "LGPL", url: "http://sourceforge.net/projects/dtdparser/",
+                   licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1"),
+    libraryLicense(name: "Eclipse JDT Core", libraryName: "Eclipse", version: "4.2.1", license: "CPL 1.0",
+                   url: "http://www.eclipse.org/jdt/core/index.php"),
+    libraryLicense(name: "EditorConfig Java Core", libraryName: "editorconfig-core-java.jar", version: "1.0", license: "Apache 2.0",
+                   url: "https://github.com/editorconfig/editorconfig-core-java/",
+                   licenseUrl: "https://github.com/editorconfig/editorconfig-core-java/blob/master/LICENSE"),
+    libraryLicense(name: "epydoc", attachedTo: "python-helpers", version: "3.0.1", license: "MIT", url: "http://epydoc.sourceforge.net/"),
+    libraryLicense(name: "Fest", libraryName: "fest", version: "", license: "Apache 2.0",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://code.google.com/p/fest/"),
+    libraryLicense(name: "FreeMarker", attachedTo: "coverage", version: "2.3.15", license: "BSD", url: "http://freemarker.sourceforge.net/"),
+    libraryLicense(name: "FreeMarker", libraryName: "freemarker-2.3.20", version: "2.3.20", license: "BSD",
+                   url: "http://freemarker.sourceforge.net/"),
+    libraryLicense(name: "fxg-utils", libraryName: "fxg-utils", version: "4.9.1", license: "Apache 2.0", url: "http://flex.apache.org",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Gant", version: "1.9.8", libraryName: "gant-1.9.11_groovy-2.3.0.jar", license: "Apache 2.0",
+                   url: "https://github.com/codehaus/gant", licenseUrl: "https://github.com/codehaus/gant/blob/master/LICENCE.txt"),
+    libraryLicense(name: "Gherkin", libraryName: "Gherkin", version: "2.12.2", license: "MIT",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/cucumber/gherkin"),
+    libraryLicense(name: "Google Feedback", libraryName: "GoogleFeedback.jar", version: "", license: "TBD"),
+    libraryLicense(name: "gradle-tooling-api-2.13.jar", version: "2.13", license: "Apache 2.0", url: "http://gradle.org/",
+                   licenseUrl: "http://gradle.org/license"),
+    libraryLicense(name: "Gradle", version: "2.13", license: "Apache 2.0", url: "http://gradle.org/",
+                   licenseUrl: "http://gradle.org/license"),
+    libraryLicense(name: "GradleGuava", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/",
+                   licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "GradleJnaPosix", version: "1.0.3", license: "LGPL 2.1", url: "http://www.jruby.org/",
+                   licenseUrl: "http://www.gnu.org/licenses/lgpl-2.1.txt"),
+    libraryLicense(name: "Groovy", version: "2.4.6", license: "Apache 2.0", url: "http://groovy-lang.org/"),
+    libraryLicense(name: "Gson", version: "2.2.4", libraryName: "gson", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/"),
+    libraryLicense(name: "Guava", libraryName: "guava-tools", version: "14.0.1", license: "Apache 2.0",
+                   url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html"),
+    libraryLicense(name: "Guava", version: "17.0", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/",
+                   licenseUrl: "http://ant.apache.org/license.html"),
+    libraryLicense(name: "hamcrest", version: "1.3", license: "BSD", url: "http://hamcrest.org/",
+                   licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "HttpComponents HttpClient", libraryName: "http-client", version: "4.3.2", license: "Apache 2.0",
+                   url: "http://hc.apache.org/httpcomponents-client-ga/index.html"),
+    libraryLicense(name: "imgscalr", libraryName: "imgscalr", version: "4.2", license: "Apache 2.0",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/thebuzzmedia/imgscalr"),
+    libraryLicense(name: "batik", libraryName: "batik", version: "1.7.1", license: "Apache 2.0",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://xmlgraphics.apache.org/batik/"),
+    libraryLicense(name: "xmlgraphics-commons", libraryName: "xmlgraphics-commons", version: "1.5", license: "Apache 2.0",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://xmlgraphics.apache.org/commons/"),
+    libraryLicense(name: "xml-apis-ext", libraryName: "xml-apis-ext", version: "1.3", license: "Apache 2.0",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt",
+                   url: "http://xerces.apache.org/xml-commons/components/external"),
+    libraryLicense(name: "ImageIO", libraryName: "com.twelvemonkeys.imageio:imageio-tiff:3.2.1", version: "3.2.1", license: "BSD",
+                   url: "https://github.com/haraldk/TwelveMonkeys", licenseUrl: "https://github.com/haraldk/TwelveMonkeys#license"),
+    libraryLicense(name: "ini4j", libraryName: "ini4j-0.5.2-patched", version: "0.5.2 (with a patch by JetBrains)", license: "Apache 2.0",
+                   url: "http://ini4j.sourceforge.net/", attachedTo: "git4idea"),
+    libraryLicense(name: "ISO RELAX", libraryName: "isorelax.jar", license: "MIT License",
+                   url: "http://sourceforge.net/projects/iso-relax/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html"),
+    libraryLicense(name: "Jakarta ORO", libraryName: "OroMatcher", version: "2.0.8", license: "Apache",
+                   url: "http://jakarta.apache.org/oro/", licenseUrl: "http://svn.apache.org/repos/asf/jakarta/oro/trunk/LICENSE"),
+    libraryLicense(name: "Java-WebSocket", libraryName: "java_websocket.jar", version: "1.4.0 Trunk", license: "MIT",
+                   url: "https://github.com/TooTallNate/Java-WebSocket",
+                   licenseUrl: "https://github.com/TooTallNate/Java-WebSocket/blob/master/LICENSE"),
+    libraryLicense(name: "JavaCVS", attachedTo: "javacvs-src", version: "no version number available (with patches by JetBrains)",
+                   license: "Sun Public License", url: "https://versioncontrol.netbeans.org/javacvs/library/",
+                   licenseUrl: "https://netbeans.org/about/legal/license.html"),
+    libraryLicense(name: "JavaHelp", version: "2.0_02", license: "included as license/javahelp_license.html in IntelliJ IDEA distribution",
+                   url: "http://java.sun.com/products/javahelp/"),
+    libraryLicense(name: "javawriter", libraryName: "javawriter", license: "Apache 2.0", url: "https://github.com/square/javawriter"),
+    libraryLicense(name: "JAXB", libraryName: "JAXB", version: "2.2.4-1", license: "CDDL 1.1", url: "http://jaxb.java.net/",
+                   licenseUrl: "http://glassfish.java.net/public/CDDL+GPL_1_1.html"),
+    libraryLicense(name: "Jaxen", version: "", license: "modified Apache", url: "http://www.jaxen.org/",
+                   licenseUrl: "http://www.jaxen.org/license.html"),
+    libraryLicense(name: "jayatana", libraryName: "jayatana", version: "1.2.4", license: "MIT License",
+                   url: "https://code.google.com/p/java-swing-ayatana/", licenseUrl: "http://opensource.org/licenses/mit-license.php"),
+    libraryLicense(name: "JCIP Annotations", libraryName: "jcip", license: "Creative Commons Attribution License",
+                   url: "http://www.jcip.net", licenseUrl: "http://creativecommons.org/licenses/by/2.5"),
+    libraryLicense(name: "JDOM", version: "1.1 (with patches by JetBrains)", license: "modified Apache", url: "http://www.jdom.org/",
+                   licenseUrl: "http://www.jdom.org/docs/faq.html#a0030"),
+    libraryLicense(name: "JediTerm", libraryName: "jediterm-pty", version: "2.2", license: "LGPL 2",
+                   url: "https://github.com/JetBrains/jediterm", licenseUrl: "https://github.com/JetBrains/jediterm/blob/master/COPYING"),
+    libraryLicense(name: "JEuclid", libraryName: "jeuclid-core-3.1.9.jar", version: "3.1.9", license: "Apache 2.0",
+                   url: "http://jeuclid.sourceforge.net", licenseUrl: "http://sourceforge.net/p/jeuclid/code/ci/default/tree/LICENSE.txt"),
+    libraryLicense(name: "JGit", libraryName: "jackson", version: "2.5.1", license: "Apache 2.0",
+                   licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://github.com/FasterXML/jackson"),
+    libraryLicense(name: "JGit", libraryName: "jgit", version: "4.0", license: "Eclipse Distribution License 1.0",
+                   licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://eclipse.org/jgit/"),
+    libraryLicense(name: "JGoodies Common", libraryName: "jgoodies-common", version: "1.2.1", license: "BSD ",
+                   url: "http://www.jgoodies.com/freeware/libraries/looks/", licenseUrl: "https://opensource.org/licenses/bsd-license.html"),
+    libraryLicense(name: "JGoodies Forms", libraryName: "jgoodies-forms", version: "1.1-preview 2006-05-04 11:55:37", license: "BSD ",
+                   url: "http://www.jgoodies.com/freeware/libraries/forms/", licenseUrl: "https://opensource.org/licenses/bsd-license.html"),
+    libraryLicense(name: "JGoodies Looks", libraryName: "jgoodies-looks", version: "2.4.2", license: "BSD ",
+                   url: "http://www.jgoodies.com/freeware/libraries/looks/", licenseUrl: "https://opensource.org/licenses/bsd-license.html"),
+    libraryLicense(name: "jgraphx", libraryName: "jgraphx-3.4.0.1", version: "3.4.0.1", license: "BSD",
+                   url: "https://github.com/jgraph/jgraphx"),
+    libraryLicense(name: "JNA", libraryName: "jna", version: "4.1.0", license: "LGPL 2.1", url: "https://github.com/java-native-access/jna",
+                   licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1.php"),
+    libraryLicense(name: "jsch-agent-proxy for svnkit trilead", libraryName: "jsch.agentproxy.svnkit-trilead-ssh2.jar", version: "0.0.7",
+                   license: "BSD", url: "https://github.com/ymnk/jsch-agent-proxy",
+                   licenseUrl: "https://github.com/ymnk/jsch-agent-proxy/blob/master/LICENSE.txt"),
+    libraryLicense(name: "jsch-agent-proxy", libraryName: "jsch-agent-proxy", version: "0.0.7", license: "BSD",
+                   url: "https://github.com/ymnk/jsch-agent-proxy",
+                   licenseUrl: "https://github.com/ymnk/jsch-agent-proxy/blob/master/LICENSE.txt"),
+    libraryLicense(name: "JSch", libraryName: "JSch", version: "0.1.53", license: "BSD", url: "http://www.jcraft.com/jsch/",
+                   licenseUrl: "http://www.jcraft.com/jsch/LICENSE.txt"),
+    libraryLicense(name: "json-path", libraryName: "json-path-0.8.0.jar", version: "0.8.0", license: "Apache 2.0",
+                   url: "http://code.google.com/p/json-path/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "json-smart", libraryName: "json-smart-1.1.1.jar", version: "1.1.1", license: "Apache 2.0",
+                   url: "http://code.google.com/p/json-smart/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "jsr305", libraryName: "jsr305", version: "snapshot", license: "BSD", url: "http://code.google.com/p/jsr-305/",
+                   licenseUrl: "http://code.google.com/p/jsr-305/source/browse/trunk/ri/LICENSE"),
+    libraryLicense(name: "Jsr305", version: "1.3.9", license: "New BSD", url: "http://code.google.com/p/jsr-305/",
+                   licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "JUnit", libraryName: "JUnit3", version: "3.8.1", license: "CPL 1.0", url: "http://junit.org/"),
+    libraryLicense(name: "JUnit", libraryName: "JUnit4", version: "4.11", license: "CPL 1.0", url: "http://junit.org/"),
+    libraryLicense(name: "junit5_rt", libraryName: "junit5_rt", version: "5.0.0", license: "Eclipse Public License 1.0",
+                   url: "http://junit.org/"),
+    libraryLicense(name: "jzlib", libraryName: "jzlib", version: "1.1.1", license: "BSD", url: "http://www.jcraft.com/jzlib/",
+                   licenseUrl: "http://www.jcraft.com/jzlib/LICENSE.txt"),
+    libraryLicense(name: "Kryo", libraryName: "Kryo", version: "2.22", license: "New BSD License",
+                   url: "https://github.com/EsotericSoftware/kryo",
+                   licenseUrl: "https://github.com/EsotericSoftware/kryo/blob/master/license.txt"),
+    libraryLicense(name: "kXML2", libraryName: "kxml2", version: "2.3.0", license: "BSD", url: "http://sourceforge.net/projects/kxml/"),
+    libraryLicense(name: "Lobo evolution", libraryName: "Loboevolution.jar", version: "0.98.6 (with patches by JetBrains)", license: "MIT",
+                   url: "http://sourceforge.net/projects/loboevolution/", licenseUrl: "http://opensource.org/licenses/mit-license.php"),
+    libraryLicense(name: "Log4j", libraryName: "Log4J", version: "1.2.17", license: "Apache 2.0",
+                   url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Lombok AST", libraryName: "lombok-ast", version: "0.2.1", license: "MIT", url: "http://projectlombok.org/",
+                   licenseUrl: "http://opensource.org/licenses/mit-license.php"),
+    libraryLicense(name: "markdown4j", libraryName: "markdown4j-2.2", version: "2.2", license: "New BSD",
+                   url: "https://code.google.com/p/markdown4j/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "markdownj", attachedTo: "tasks-core", version: "", license: "BSD", url: "https://github.com/myabc/markdownj",
+                   licenseUrl: "http://www.opensource.org/licenses/bsd-license.php"),
+    libraryLicense(name: "markdownj", libraryName: "markdownj", version: "0.4.2", license: "New BSD",
+                   url: "https://github.com/myabc/markdownj", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "maven-2.2.1-uber", version: "2.2.1", libraryNames: ["maven-2.2.1-uber.jar"], license: "Apache 2.0",
+                   url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "maven-artifact", version: "3.0.5", libraryNames: ["maven-artifact-3.0.5.jar"], license: "Apache 2.0",
+                   url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "maven-core", version: "3.0.5", libraryNames: ["maven-core-3.0.5.jar"], license: "Apache 2.0",
+                   url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Maven", version: "2.2.1", license: "Apache 2.0", url: "http://maven.apache.org/",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Maven3",
+                   libraryNames: ["Maven3", "maven-dependency-tree-1.2.jar", "archetype-catalog-2.2.jar", "archetype-common-2.2.jar"],
+                   version: "3.0.5", license: "Apache 2.0", url: "http://maven.apache.org/",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "mercurial_prompthooks", attachedTo: "hg4idea", version: "",
+                   license: "GPLv2 (used as hg extension called from hg executable)",
+                   url: "https://github.com/willemv/mercurial_prompthooks",
+                   licenseUrl: "https://github.com/willemv/mercurial_prompthooks/blob/master/LICENSE.txt"),
+    libraryLicense(name: "Microba", libraryName: "microba", version: "0.4.2", license: "BSD", url: "http://microba.sourceforge.net/",
+                   licenseUrl: "http://microba.sourceforge.net/license.txt"),
+    libraryLicense(name: "MigLayout", libraryName: "miglayout-swing", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/",
+                   licenseUrl: "http://www.miglayout.com/mavensite/license.html"),
+    libraryLicense(name: "minlog", libraryName: "minlog-1.2.jar", version: "1.2", license: "BSD",
+                   url: "https://github.com/EsotericSoftware/minlog", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "NanoXML", version: "2.2.3", license: "zlib/libpng",
+                   url: "http://mvnrepository.com/artifact/be.cyberelf.nanoxml/nanoxml/2.2.3",
+                   licenseUrl: "http://www.opensource.org/licenses/zlib-license.html"),
+    libraryLicense(name: "nekohtml", libraryName: "nekohtml", version: "1.9.14", license: "Apache 2.0",
+                   url: "http://nekohtml.sourceforge.net/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0.txt"),
+    libraryLicense(name: "Netty", libraryName: "Netty", version: "4.1.0.Beta3", license: "Apache 2.0", url: "http://netty.io",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Objenesis", libraryName: "objenesis-1.2.jar", version: "1.2", license: "Apache 2.0", url: "http://objenesis.org/",
+                   licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "opentest4j", libraryName: "opentest4j", version: "1.0.0", license: "Apache 2.0",
+                   url: "https://github.com/ota4j-team/opentest4j", licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "pep8.py", attachedTo: "python-helpers", version: "1.6.2", license: "MIT", url: "http://pep8.readthedocs.org/"),
+    libraryLicense(name: "PicoContainer", libraryName: "picocontainer", version: "1.2", license: "BSD",
+                   url: "https://github.com/codehaus/picocontainer", licenseUrl: "https://opensource.org/licenses/bsd-license.php"),
+    libraryLicense(name: "plexus-archiver", libraryName: "plexus-archiver-2.4.4.jar", version: "2.4.4", license: "Apache 2.0",
+                   url: "https://github.com/codehaus-plexus/plexus-archiver", licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "plexus-classworlds", libraryName: "plexus-classworlds-2.4.jar", version: "2.4", license: "Apache 2.0",
+                   url: "https://github.com/codehaus-plexus/plexus-classworlds", licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "plexus-component-annotations", version: "1.5.5", libraryNames: ["plexus-component-annotations-1.5.5.jar"],
+                   license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "plexus-util", version: "2.0.6", license: "Apache 2.0", url: "http://maven.apache.org/",
+                   libraryNames: ['plexus-utils-2.0.6.jar'], licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Plexus Utils", libraryName: "plexus-utils-1.5.5.jar", version: "1.5.5", license: "Apache 2.0",
+                   url: "http://plexus.codehaus.org/plexus-utils"),
+    libraryLicense(name: "pockets", attachedTo: "python-helpers", version: "0.2.4", license: "BSD", url: "http://pockets.readthedocs.org/"),
+    libraryLicense(name: "protobuf", version: "2.5.0", license: "New BSD", url: "http://code.google.com/p/protobuf/",
+                   licenseUrl: "https://github.com/google/protobuf/blob/master/LICENSE"),
+    libraryLicense(name: "proxy-vole", libraryName: "proxy-vole", version: "20131209", license: "New BSD License",
+                   url: "http://code.google.com/p/proxy-vole/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "pty4j", libraryName: "pty4j", version: "0.7.1", license: "Eclipse Public License v1.0",
+                   url: "https://github.com/traff/pty4j"),
+    libraryLicense(name: "PureJavaComm", libraryName: "purejavacomm", version: "0.0.16", license: "BSD",
+                   url: "http://www.sparetimelabs.com/purejavacomm"),
+    libraryLicense(name: "ReflectASM", libraryName: "reflectasm-1.0.7.jar", version: "1.0.7", license: "BSD",
+                   url: "https://github.com/EsotericSoftware/reflectasm", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
+    libraryLicense(name: "Relax NG Object Model", libraryName: "rngom-20051226-patched.jar", license: "MIT",
+                   url: "http://java.net/projects/rngom/", licenseUrl: "http://www.opensource.org/licenses/mit-license.php"),
+    libraryLicense(name: "Rhino JavaScript Engine", libraryName: "rhino-js-1_7R4", version: "1.7R4", license: "MPL 1.1",
+                   url: "http://www.mozilla.org/rhino/", licenseUrl: "http://www.mozilla.org/MPL/MPL-1.1.html"),
+    libraryLicense(name: "RMI Stubs", attachedTo: "xslt-debugger-engine", license: "Apache 2.0",
+                   url: "https://confluence.jetbrains.com/display/CONTEST/XSLT-Debugger",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "Saxon-6.5.5", version: "6.5.5", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/",
+                   licenseUrl: "http://www.mozilla.org/MPL/"),
+    libraryLicense(name: "Saxon-9HE", version: "9", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/",
+                   licenseUrl: "http://www.mozilla.org/MPL/"),
+    libraryLicense(name: "SceneBuilderKit", version: "8.1.1", license: "BSD", url: "http://gluonhq.com/open-source/scene-builder/",
+                   licenseUrl: "http://www.oracle.com/technetwork/licenses/bsd-license-1835287.html"),
+    libraryLicense(name: "Sequence", libraryName: "sequence-library.jar", version: "bundled with SVNKit",
+                   license: "BSD (see LICENSE.txt in sequence-library.jar)", url: "http://www.syntevo.com"),
+    libraryLicense(name: "six.py", attachedTo: "python-helpers", version: "1.9.0", license: "MIT", url: "http://pythonhosted.org/six/"),
+    libraryLicense(name: "Slf4j", version: "1.7.10", license: "MIT License", url: "http://slf4j.org/",
+                   licenseUrl: "http://slf4j.org/license.html"),
+    libraryLicense(name: "Snappy-Java", libraryName: "Snappy-Java", version: "0.3.1", license: "Apache 2.0",
+                   url: "https://github.com/dain/snappy", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
+    libraryLicense(name: "SnuggleTeX", version: "1.3 (with patches by JetBrains)", license: "BSD",
+                   url: "http://snuggletex.sourceforge.net/", licenseUrl: "http://snuggletex.sourceforge.net/maven/license.html"),
+    libraryLicense(name: "Sonatype Nexus Indexer Artifact", libraryName: "nexus-indexer-artifact-1.0.1.jar", version: "1.0.1",
+                   license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/",
+                   licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html"),
+    libraryLicense(name: "Sonatype Nexus: Indexer", libraryName: "nexus-indexer-1.2.3.jar", version: "1.2.3",
+                   license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/",
+                   licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html"),
+    libraryLicense(name: "Sonatype Nexus: Indexer", libraryName: "nexus-indexer-3.0.4.jar", version: "3.0.4",
+                   license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/",
+                   licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html"),
+    libraryLicense(name: "Spantable", libraryName: "spantable.jar", version: "patched", license: "LGPL 2.1",
+                   licenseUrl: "http://www.gnu.org/licenses/lgpl.html",
+                   url: "https://android.googlesource.com/platform/prebuilts/tools/+/master/common/spantable/"),
+    libraryLicense(name: "sphinxcontrib-napoleon", attachedTo: "python-helpers", version: "0.3.11", license: "BSD",
+                   url: "http://sphinxcontrib-napoleon.readthedocs.org/"),
+    libraryLicense(name: "sqljet", version: "bundled with SVNKit", libraryName: "sqljet.jar", license: "link (commercial license)",
+                   url: "http://sqljet.com", licenseUrl: "http://svnkit.com/license.html"),
+    libraryLicense(name: "svnkit-javahl", version: "bundled with SVNKit", libraryName: "svnkit-javahl.jar",
+                   license: "link (commercial license)", url: "http://www.svnkit.com/", licenseUrl: "http://svnkit.com/license.html"),
+    libraryLicense(name: "SVNKit", libraryName: "svnkit.jar", version: "1.8.12", license: "link (commercial license)",
+                   url: "http://www.svnkit.com/", licenseUrl: "http://svnkit.com/license.html"),
+    libraryLicense(name: "swingx", libraryName: "swingx", version: "1.6.2", license: "LGPL 2.1", url: "http://java.net/downloads/swingx/",
+                   licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1.php"),
+    libraryLicense(name: "TestNG", version: "6.9 snapshot", license: "Apache 2.0", url: "http://testng.org/doc/",
+                   licenseUrl: "https://github.com/cbeust/testng/blob/master/LICENSE.txt"),
+    libraryLicense(name: "Trilead SSH", libraryName: "trilead-ssh2", version: "build 213 and 217",
+                   license: "BSD style (see LICENSE.txt in trilead.jar)", url: "http://www.trilead.com/SSH_Library/"),
+    libraryLicense(name: "Twitter4J", libraryName: "twitter4j-core-4.0.4.jar", version: "4.0.4", license: "Apache 2.0",
+                   url: "http://twitter4j.org/", licenseUrl: "http://twitter4j.org/en/index.html#license"),
+    libraryLicense(name: "Trove4j", version: "1.1 (with patches by JetBrains)", license: "LGPL", url: "http://trove4j.sourceforge.net/",
+                   licenseUrl: "http://trove4j.sourceforge.net/html/license.html"),
+    libraryLicense(name: "Velocity", version: "1.7", license: "Apache 2.0", url: "http://velocity.apache.org/",
+                   licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt"),
+    libraryLicense(name: "winp", version: "1.23", license: "MIT", url: "http://java.net/projects/winp",
+                   licenseUrl: "http://opensource.org/licenses/mit-license.php"),
+    libraryLicense(name: "Xalan", libraryName: "Xalan-2.7.1", version: "2.7.1", license: "Apache 2.0",
+                   url: "http://xml.apache.org/xalan-j/", licenseUrl: "http://xml.apache.org/xalan-j/"),
+    libraryLicense(name: "Xerces", version: "2.11", license: "Apache 2.0", url: "http://xerces.apache.org/xerces2-j/",
+                   licenseUrl: "http://xerces.apache.org/xerces2-j/"),
+    libraryLicense(name: "Xerial SQLite JDBC", libraryName: "sqlite", version: "3.6.20.1", license: "Apache 2.0",
+                   url: "https://github.com/xerial/sqlite-jdbc"),
+    libraryLicense(name: "XML-RPC", libraryName: "XmlRPC", version: "2.0", license: "Apache 2.0",
+                   url: "http://ws.apache.org/xmlrpc/xmlrpc2/", licenseUrl: "http://ws.apache.org/xmlrpc/xmlrpc2/license.html"),
+    libraryLicense(name: "XML Commons (xml-apis.jar, resolver.jar)", version: "",
+                   license: "Apache 2.0, W3C Software License , public domain", url: "http://xml.apache.org/commons/",
+                   licenseUrl: "http://xml.apache.org/commons/licenses.html"),
+    libraryLicense(name: "XMLBeans", libraryName: "XmlBeans", version: "2.3.0", license: "Apache 2.0", url: "http://xmlbeans.apache.org/",
+                   licenseUrl: "http://svn.jetbrains.org/idea/Trunk/bundled/WebServices/resources/lib/xmlbeans-2.3.0/xmlbeans.LICENSE"),
+    libraryLicense(name: "XStream", libraryName: "XStream", version: "1.4.2", license: "BSD License",
+                   url: "https://github.com/codehaus/xstream", licenseUrl: "https://github.com/codehaus/xstream/blob/master/LICENSE.txt"),
+    libraryLicense(name: "XStream", version: "1.4.3", license: "BSD", url: "https://github.com/codehaus/xstream",
+                   licenseUrl: "https://github.com/codehaus/xstream/blob/master/LICENSE.txt"),
+    libraryLicense(name: "YourKit Java Profiler", libraryName: "yjp-controller-api-redist.jar", version: "8.0.x",
+                   license: "link (commercial license)", url: "http://yourkit.com/",
+                   licenseUrl: "http://www.yourkit.com/purchase/license.html"),
+
+    jetbrainsLibrary("Coverage"),
+    jetbrainsLibrary("CoverageReport"),
+    jetbrainsLibrary("intellij-markdown.jar"),
+    jetbrainsLibrary("JPS"),
+    jetbrainsLibrary("Maven Embedder"),
+    jetbrainsLibrary("tcServiceMessages"),
+    jetbrainsLibrary("optimizedFileManager.jar"),
+    jetbrainsLibrary("KotlinJavaRuntime")
+  ]
+}
\ No newline at end of file
diff --git a/build/groovy/org/jetbrains/intellij/build/LibraryLicense.groovy b/build/groovy/org/jetbrains/intellij/build/LibraryLicense.groovy
new file mode 100644 (file)
index 0000000..9cf8985
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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
+
+/**
+ * @author nik
+ */
+class LibraryLicense {
+  private static final Map<String, String> PREDEFINED_LICENSE_URLS = ["Apache 2.0": "http://www.apache.org/licenses/LICENSE-2.0"]
+  public static final String JETBRAINS_OWN = "JetBrains"
+
+  String name, url, version
+  List<String> libraryNames
+  String license, licenseUrl
+  String attachedTo
+
+  public static LibraryLicense libraryLicense(Map args) {
+    if (args.libraryNames == null) {
+      args.libraryNames = [args.libraryName ?: args.name]
+      args.remove("libraryName")
+    }
+    if (args.licenseUrl == null) {
+      args.licenseUrl = PREDEFINED_LICENSE_URLS[args.license]
+    }
+    new LibraryLicense(args)
+  }
+
+  public static jetbrainsLibrary(String libraryName) {
+    libraryLicense(name: libraryName, license: JETBRAINS_OWN)
+  }
+}
\ No newline at end of file
diff --git a/build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy b/build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy
new file mode 100644 (file)
index 0000000..520ae6c
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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
+
+/**
+ * Implement this interfaces and pass the implementation to {@link BuildContext#createContext} method to support scrambling the product
+ * JAR files.
+ *
+ * @author nik
+ */
+interface ScrambleTool {
+  /**
+   * Scramble {@code mainJarName} in {@code "$buildContext.paths.distAll/lib"} directory
+   */
+  void scramble(String mainJarName, BuildContext buildContext)
+}
\ No newline at end of file
index b165429b290e4ea3f7279430e060750b0954156c..0563de6aa82cce36e2690e3d7124b1be6fde6706 100644 (file)
@@ -38,7 +38,7 @@ class BuildContextImpl extends BuildContext {
 //todo[nik] construct buildOutputRoot automatically based on product name
   BuildContextImpl(GantBuilder ant, JpsGantProjectBuilder projectBuilder, JpsProject project, JpsGlobal global,
                    String communityHome, String projectHome, String buildOutputRoot, ProductProperties productProperties,
-                   BuildOptions options, MacHostProperties macHostProperties, SignTool signTool) {
+                   BuildOptions options, MacHostProperties macHostProperties, SignTool signTool, ScrambleTool scrambleTool) {
     this.projectBuilder = projectBuilder
     this.ant = ant
     this.project = project
@@ -50,6 +50,7 @@ class BuildContextImpl extends BuildContext {
     this.options = options
     this.macHostProperties = macHostProperties
     this.signTool = signTool
+    this.scrambleTool = scrambleTool
     underTeamCity = System.getProperty("teamcity.buildType.id") != null
     messages = new BuildMessagesImpl(projectBuilder, ant.project, underTeamCity)
 
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/LibraryLicensesListGenerator.groovy b/build/groovy/org/jetbrains/intellij/build/impl/LibraryLicensesListGenerator.groovy
new file mode 100644 (file)
index 0000000..a7b3073
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * 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.LibraryLicense
+import org.jetbrains.jps.gant.JpsGantProjectBuilder
+import org.jetbrains.jps.model.JpsProject
+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.JpsModule
+
+/**
+ * @author nik
+ */
+class LibraryLicensesListGenerator {
+  private final JpsGantProjectBuilder projectBuilder
+  private final JpsProject project
+  private final List<LibraryLicense> licensesList
+
+  LibraryLicensesListGenerator(JpsGantProjectBuilder projectBuilder, JpsProject project, List<LibraryLicense> licensesList) {
+    this.projectBuilder = projectBuilder
+    this.project = project
+    this.licensesList = licensesList
+  }
+
+  private String getLibraryName(JpsLibrary lib) {
+    def name = lib.name
+    if (name.startsWith("#")) {
+      if (lib.getRoots(JpsOrderRootType.COMPILED).size() != 1) {
+        def urls = lib.getRoots(JpsOrderRootType.COMPILED).collect { it.url }
+        projectBuilder.warning("Non-single entry module library $name: $urls");
+      }
+      File file = lib.getFiles(JpsOrderRootType.COMPILED)[0]
+      return file.name
+    }
+    return name
+  }
+
+  void generateLicensesTable(String filePath, Set<String> usedModulesNames) {
+    projectBuilder.info("Generating licenses table")
+    projectBuilder.info("Used modules: $usedModulesNames")
+    Set<JpsModule> usedModules = project.modules.findAll { usedModulesNames.contains(it.name) }
+    Map<String, String> usedLibraries = [:]
+    usedModules.each { JpsModule module ->
+      JpsJavaExtensionService.dependencies(module).includedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME).getLibraries().each { item ->
+        usedLibraries[getLibraryName(item)] = module.name
+      }
+    }
+
+    Map<LibraryLicense, String> licenses = [:]
+    licensesList.findAll {it.license != LibraryLicense.JETBRAINS_OWN}.each { LibraryLicense lib ->
+      if (usedModulesNames.contains(lib.attachedTo)) {
+        licenses[lib] = lib.attachedTo
+      }
+      else {
+        lib.libraryNames.each {
+          String module = usedLibraries[it]
+          if (module != null) {
+            licenses[lib] = module
+          }
+        }
+      }
+    }
+
+    projectBuilder.info("Used libraries:")
+    List<String> lines = []
+    licenses.entrySet().each {
+      LibraryLicense lib = it.key
+      String moduleName = it.value
+      def name = lib.url != null ? "[$lib.name|$lib.url]" : lib.name
+      def license = lib.licenseUrl != null ? "[$lib.license|$lib.licenseUrl]" : lib.license
+      projectBuilder.info(" $lib.name (in module $moduleName)")
+      lines << "|$name| ${lib.version ?: ""}|$license|".toString()
+    }
+    //projectBuilder.info("Unused libraries:")
+    //licensesList.findAll {!licenses.containsKey(it)}.each {LibraryLicense lib ->
+    //  projectBuilder.info(" $lib.name")
+    //}
+
+    lines.sort(true, String.CASE_INSENSITIVE_ORDER)
+    File file = new File(filePath)
+    file.parentFile.mkdirs()
+    FileWriter out = new FileWriter(file)
+    try {
+      out.println("|| Software || Version || License ||")
+      lines.each {
+        out.println(it)
+      }
+    }
+    finally {
+      out.close()
+    }
+  }
+
+  void checkLibLicenses() {
+    def libraries = new HashSet<JpsLibrary>()
+    def lib2Module = new HashMap<JpsLibrary, JpsModule>();
+    Set<String> nonPublicModules = ["buildScripts", "build"] as Set
+    project.modules.findAll { !nonPublicModules.contains(it.name) }.each { JpsModule module ->
+      JpsJavaExtensionService.dependencies(module).includedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME).getLibraries().each {
+        lib2Module[it] = module
+        libraries << it
+      }
+    }
+
+    def libWithLicenses = licensesList.collectMany { it.libraryNames } as Set<String>
+
+    List<String> withoutLicenses = []
+    libraries.each { JpsLibrary lib ->
+      def name = getLibraryName(lib)
+      if (!libWithLicenses.contains(name)) {
+        withoutLicenses << "$name (used in module ${lib2Module[lib].name})".toString()
+      }
+    }
+
+    if (!withoutLicenses.isEmpty()) {
+      def errorMessage = []
+      errorMessage << "Licenses aren't specified for ${withoutLicenses.size()} libraries:"
+      withoutLicenses.sort(true, String.CASE_INSENSITIVE_ORDER)
+      withoutLicenses.each { errorMessage << it }
+      errorMessage << "If a library is packaged into IDEA installation information about its license must be added to libLicenses.gant file"
+      errorMessage << "If a library is used in tests only change its scope to 'Test'"
+      errorMessage << "If a library is used for compilation only change its scope to 'Provided'"
+      projectBuilder.error(errorMessage.join("\n"))
+    }
+  }
+}
+
diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant
deleted file mode 100644 (file)
index 2096fd1..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright 2000-2016 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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.JpsModule
-
-class LibraryLicense {
-  String name, url, version
-  List<String> libraryNames
-  String license, licenseUrl
-  String attachedTo
-}
-
-List<LibraryLicense> licensesList = []
-List<String> jetbrainsLibraries = []
-Map<String, String> predefinedLicenseUrls = ["Apache 2.0": "http://www.apache.org/licenses/LICENSE-2.0"]
-
-binding.setVariable("libraryLicense", {Map args ->
-  if (args.libraryNames == null) {
-    args.libraryNames = [args.libraryName?:args.name]
-    args.remove("libraryName")
-  }
-  if (args.licenseUrl == null) {
-    args.licenseUrl = predefinedLicenseUrls[args.license]
-  }
-  licensesList << new LibraryLicense(args)
-})
-
-binding.setVariable("jetbrainsLibrary", {String name ->
-  jetbrainsLibraries << name
-})
-
-def String getLibraryName(JpsLibrary lib) {
-  def name = lib.name
-  if (name.startsWith("#")) {
-    if (lib.getRoots(JpsOrderRootType.COMPILED).size() != 1) {
-      def urls = lib.getRoots(JpsOrderRootType.COMPILED).collect {it.url}
-      projectBuilder.warning("Non-single entry module library $name: $urls");
-    }
-    File file = lib.getFiles(JpsOrderRootType.COMPILED)[0]
-    return file.name
-  }
-  return name
-}
-
-binding.setVariable("checkLibLicenses", {
-  def libraries = new HashSet<JpsLibrary>()
-  def lib2Module = new HashMap<JpsLibrary, JpsModule>();
-  Set<String> nonPublicModules = ["buildScripts", "build"] as Set
-  allModules().findAll {!nonPublicModules.contains(it.name)}.each {JpsModule module ->
-    JpsJavaExtensionService.dependencies(module).includedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME).getLibraries().each {
-      lib2Module[it] = module
-      libraries << it
-    }
-  }
-
-  def libWithLicenses = licensesList.collect {it.libraryNames}.flatten() as Set
-  libWithLicenses.addAll(jetbrainsLibraries)
-
-  List<String> withoutLicenses = []
-  libraries.each {JpsLibrary lib ->
-    def name = getLibraryName(lib)
-    if (!libWithLicenses.contains(name)) {
-      withoutLicenses << "$name (used in module ${lib2Module[lib].name})".toString()
-    }
-  }
-
-  if (!withoutLicenses.isEmpty()) {
-    def errorMessage = []
-    errorMessage << "Licenses aren't specified for ${withoutLicenses.size()} libraries:"
-    withoutLicenses.sort(true, String.CASE_INSENSITIVE_ORDER)
-    withoutLicenses.each { errorMessage << it}
-    errorMessage << "If a library is packaged into IDEA installation information about its license must be added to libLicenses.gant file"
-    errorMessage << "If a library is used in tests only change its scope to 'Test'"
-    errorMessage << "If a library is used for compilation only change its scope to 'Provided'"
-    projectBuilder.error(errorMessage.join("\n"))
-  }
-});
-
-binding.setVariable("generateLicensesTable", {String filePath, Set<String> usedModulesNames ->
-  projectBuilder.info("Generating licenses table")
-  projectBuilder.info("Used modules: $usedModulesNames")
-  Set<JpsModule> usedModules = allModules().findAll {usedModulesNames.contains(it.name)}
-  Map<String, String> usedLibraries = [:]
-  usedModules.each {JpsModule module ->
-    JpsJavaExtensionService.dependencies(module).includedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME).getLibraries().each {item ->
-      usedLibraries[getLibraryName(item)] = module.name
-    }
-  }
-
-  Map<LibraryLicense, String> licenses = [:]
-  licensesList.each {LibraryLicense lib ->
-    if (usedModulesNames.contains(lib.attachedTo)) {
-      licenses[lib] = lib.attachedTo
-    }
-    else {
-      lib.libraryNames.each {
-        String module = usedLibraries[it]
-        if (module != null) {
-          licenses[lib] = module
-        }
-      }
-    }
-  }
-
-  projectBuilder.info("Used libraries:")
-  List<String> lines = []
-  licenses.entrySet().each {
-    LibraryLicense lib = it.key
-    String moduleName = it.value
-    def name = lib.url != null ? "[$lib.name|$lib.url]" : lib.name
-    def license = lib.licenseUrl != null ? "[$lib.license|$lib.licenseUrl]" : lib.license
-    projectBuilder.info(" $lib.name (in module $moduleName)")
-    lines << "|$name| ${lib.version?:""}|$license|".toString()
-  }
-  //projectBuilder.info("Unused libraries:")
-  //licensesList.findAll {!licenses.containsKey(it)}.each {LibraryLicense lib ->
-  //  projectBuilder.info(" $lib.name")
-  //}
-
-  lines.sort(true, String.CASE_INSENSITIVE_ORDER)
-  File file = new File(filePath)
-  file.parentFile.mkdirs()
-  FileWriter out = new FileWriter(file)
-  try {
-    out.println("|| Software || Version || License ||")
-    lines.each {
-      out.println(it)
-    }
-  }
-  finally {
-    out.close()
-  }
-  notifyArtifactBuilt(filePath)
-})
-
-libraryLicense(name: "aether-api-0.9.0.M2.jar", version: "0.9.0.M2", libraryNames: ["aether-api-0.9.0.M2.jar"], license: "Eclipse Public License v1.0", url: "http://www.eclipse.org/aether/", licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html")
-libraryLicense(name: "aether-api", version: "1.13.1", libraryNames: ["aether-api-1.13.1.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Alloy L&F", libraryName: "alloy.jar", version: "1.4.4", license: "link (company license)", url: "http://lookandfeel.incors.com/", licenseUrl: "http://lookandfeel.incors.com/display_licence.php?back=purchase.php&selMenu=Purchase")
-libraryLicense(name: "Android Builder Model", libraryName: "builder-model", license: "Apache 2.0", url: "http://source.android.com/")
-libraryLicense(name: "Android Builder", libraryName: "android-builder", license: "Apache 2.0", url: "http://source.android.com/")
-libraryLicense(name: "Android Gradle model", libraryName: "android-gradle-model", version: "0.4-SNAPSHOT", license: "Apache 2.0", url: "https://android.googlesource.com/platform/tools/build/+/master/gradle-model/")
-libraryLicense(name: "Android SDK Tools JPS", libraryName: "android-sdk-tools-jps", license: "Apache 2.0", url: "http://source.android.com/")
-libraryLicense(name: "Android SDK Tools", libraryName: "android-sdk-tools", license: "Apache 2.0", url: "http://source.android.com/")
-libraryLicense(name: "Ant", version: "1.9", license: "Apache 2.0", url: "http://ant.apache.org/", licenseUrl: "http://ant.apache.org/license.html")
-libraryLicense(name: "ANTLR 4 Runtime", libraryName: "antlr-runtime-4.1.jar", version: "4.1", license: "BSD", url: "http://www.antlr.org", licenseUrl: "http://www.antlr.org/license.html")
-libraryLicense(name: "Antlr", libraryName: "antlr.jar", version: "3.4", license: "BSD", url: "http://www.antlr.org", licenseUrl: "http://www.antlr.org/license.html")
-libraryLicense(name: "Apache Commons BeanUtils", libraryName: "commons-beanutils.jar", version: "1.6", license: "Apache 2.0", url: "http://commons.apache.org/beanutils/")
-libraryLicense(name: "Apache Commons Codec", libraryName: "commons-codec", version: "1.8", license: "Apache 2.0", url: "http://commons.apache.org/codec/", licenseUrl: "http://www.apache.org/licenses/")
-libraryLicense(name: "Apache Commons Compress", libraryName: "commons-compress", version: "1.10", license: "Apache 2.0", url: "http://commons.apache.org/proper/commons-compress/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Apache Commons Discovery", libraryName: "commons-discovery-0.4.jar", version: "0.4", license: "Apache 2.0", url: "http://jakarta.apache.org/commons/discovery/", licenseUrl: "http://www.apache.org/licenses/")
-libraryLicense(name: "Apache Commons HTTPClient", libraryName: "http-client-3.1", version: "3.1&nbsp; (with patch by JetBrains)", license: "Apache 2.0", url: "http://hc.apache.org/httpclient-3.x")
-libraryLicense(name: "Apache Commons IO", libraryName: "commons-io-1.4.jar", version: "1.4", license: "Apache 2.0", url: "http://commons.apache.org/io/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt")
-libraryLicense(name: "Apache Commons Logging", libraryName: "commons-logging", version: "1.1.1", license: "Apache 2.0", url: "http://commons.apache.org/logging/")
-libraryLicense(name: "Apache Commons Net", libraryName: "commons-net", version: "3.3", license: "Apache 2.0", url: "http://commons.apache.org/net/")
-libraryLicense(name: "Apache Lucene", libraryName: "lucene-core-2.4.1.jar", version: "2.4.1", license: "Apache 2.0", url: "http://lucene.apache.org/java")
-libraryLicense(name: "Apache Sanselan", libraryName: "Sanselan", version: "0.98", license: "Apache 2.0", url: "https://commons.apache.org/proper/commons-imaging/")
-libraryLicense(name: "Apache XML Graphics Commons", libraryName: "xmlgraphics-commons-1.3.1.jar", version: "1.3.1", license: "Apache 2.0", url: "http://xmlgraphics.apache.org/commons/", licenseUrl:"http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "ASM Bytecode Manipulation Framework", libraryName: "ASM", version: "6.0-ALPHA (with patches by JetBrains)", license: "BSD", url: "http://asm.objectweb.org/", licenseUrl: "http://asm.objectweb.org/license.html")
-libraryLicense(name: "assertJ", version: "3", license: "Apache 2.0", url: "https://github.com/joel-costigliola/assertj-core")
-libraryLicense(name: "Automaton", libraryName: "automaton.jar", version: "1.11", license: "BSD", url: "http://www.brics.dk/automaton/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
-libraryLicense(name: "Axis", libraryName: "axis-1.4", version: "1.4", license: "Apache 2.0", url: "http://ws.apache.org/axis/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.html")
-libraryLicense(name: "bouncy-castle", version: "1.48", license: "MIT License", url: "http://bouncycastle.org", licenseUrl: "http://bouncycastle.org/licence.html")
-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")
-libraryLicense(name: "classworlds", libraryName: "classworlds-1.1.jar", version: "1.1", license: "codehaus", url: "https://github.com/codehaus/classworlds", licenseUrl: "https://github.com/codehaus/classworlds/blob/master/classworlds/LICENSE.txt")
-libraryLicense(name: "coverage.py", attachedTo: "python-helpers", version: "3.7.1", license: "Apache 2.0", url: "http://coverage.readthedocs.org/")
-libraryLicense(name: "Cucumber-Core", libraryName: "cucumber-core", version: "1.2.4", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
-libraryLicense(name: "Cucumber-Groovy", libraryName: "cucumber-groovy", version: "1.2.4", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
-libraryLicense(name: "Cucumber-Java", libraryName: "cucumber-java", version: "1.2.4", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
-libraryLicense(name: "data-binding", libraryName: "data-binding.jar", license: "Apache 2.0", url: "http://source.android.com/")
-libraryLicense(name: "Diffutils", libraryName: "Diffutils", version: "1.2.1", license: "The Apache Software License, Version 2.0", url: "https://code.google.com/archive/p/java-diff-utils/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "docutils", attachedTo: "python-helpers", version: "0.8", license: "BSD", url: "http://docutils.sourceforge.net/")
-libraryLicense(name: "DTDParser", version: "1.13", license: "LGPL", url: "http://sourceforge.net/projects/dtdparser/", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1")
-libraryLicense(name: "Eclipse JDT Core", libraryName: "Eclipse", version: "4.2.1", license: "CPL 1.0", url: "http://www.eclipse.org/jdt/core/index.php")
-libraryLicense(name: "EditorConfig Java Core", libraryName: "editorconfig-core-java.jar", version: "1.0", license: "Apache 2.0", url: "https://github.com/editorconfig/editorconfig-core-java/", licenseUrl: "https://github.com/editorconfig/editorconfig-core-java/blob/master/LICENSE")
-libraryLicense(name: "epydoc", attachedTo: "python-helpers", version: "3.0.1", license: "MIT", url: "http://epydoc.sourceforge.net/")
-libraryLicense(name: "Fest", libraryName: "fest", version: "", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://code.google.com/p/fest/")
-libraryLicense(name: "FreeMarker", attachedTo: "coverage", version: "2.3.15", license: "BSD", url: "http://freemarker.sourceforge.net/")
-libraryLicense(name: "FreeMarker", libraryName: "freemarker-2.3.20", version: "2.3.20", license: "BSD", url: "http://freemarker.sourceforge.net/")
-libraryLicense(name: "fxg-utils", libraryName: "fxg-utils", version: "4.9.1", license: "Apache 2.0", url: "http://flex.apache.org", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Gant", version: "1.9.8", libraryName: "gant-1.9.11_groovy-2.3.0.jar", license: "Apache 2.0", url: "https://github.com/codehaus/gant", licenseUrl: "https://github.com/codehaus/gant/blob/master/LICENCE.txt")
-libraryLicense(name: "Gherkin", libraryName: "Gherkin", version: "2.12.2", license: "MIT", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/cucumber/gherkin")
-libraryLicense(name: "Google Feedback", libraryName: "GoogleFeedback.jar", version: "", license: "TBD")
-libraryLicense(name: "gradle-tooling-api-2.13.jar", version: "2.13", license: "Apache 2.0", url: "http://gradle.org/", licenseUrl: "http://gradle.org/license")
-libraryLicense(name: "Gradle", version: "2.13", license: "Apache 2.0", url: "http://gradle.org/", licenseUrl: "http://gradle.org/license")
-libraryLicense(name: "GradleGuava", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "GradleJnaPosix", version: "1.0.3", license: "LGPL 2.1", url: "http://www.jruby.org/", licenseUrl: "http://www.gnu.org/licenses/lgpl-2.1.txt")
-libraryLicense(name: "Groovy", version: "2.4.6", license: "Apache 2.0", url: "http://groovy-lang.org/")
-libraryLicense(name: "Gson", version: "2.2.4", libraryName: "gson", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/")
-libraryLicense(name: "Guava", libraryName: "guava-tools", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html")
-libraryLicense(name: "Guava", version: "17.0", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html")
-libraryLicense(name: "hamcrest", version: "1.3", license: "BSD", url: "http://hamcrest.org/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "HttpComponents HttpClient", libraryName: "http-client", version: "4.3.2", license: "Apache 2.0", url: "http://hc.apache.org/httpcomponents-client-ga/index.html")
-libraryLicense(name: "imgscalr", libraryName: "imgscalr", version: "4.2", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/thebuzzmedia/imgscalr")
-libraryLicense(name: "batik", libraryName: "batik", version: "1.7.1", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://xmlgraphics.apache.org/batik/")
-libraryLicense(name: "xmlgraphics-commons", libraryName: "xmlgraphics-commons", version: "1.5", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://xmlgraphics.apache.org/commons/")
-libraryLicense(name: "xml-apis-ext", libraryName: "xml-apis-ext", version: "1.3", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "http://xerces.apache.org/xml-commons/components/external")
-libraryLicense(name: "ImageIO", libraryName: "com.twelvemonkeys.imageio:imageio-tiff:3.2.1", version: "3.2.1", license: "BSD", url: "https://github.com/haraldk/TwelveMonkeys", licenseUrl: "https://github.com/haraldk/TwelveMonkeys#license")
-libraryLicense(name: "ini4j", libraryName: "ini4j-0.5.2-patched", version: "0.5.2 (with a patch by JetBrains)", license: "Apache 2.0", url: "http://ini4j.sourceforge.net/", attachedTo: "git4idea")
-libraryLicense(name: "ISO RELAX", libraryName: "isorelax.jar", license: "MIT License", url: "http://sourceforge.net/projects/iso-relax/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
-libraryLicense(name: "Jakarta ORO", libraryName: "OroMatcher", version: "2.0.8", license: "Apache", url: "http://jakarta.apache.org/oro/", licenseUrl: "http://svn.apache.org/repos/asf/jakarta/oro/trunk/LICENSE")
-libraryLicense(name: "Java-WebSocket", libraryName: "java_websocket.jar", version: "1.4.0 Trunk", license: "MIT", url: "https://github.com/TooTallNate/Java-WebSocket", licenseUrl:"https://github.com/TooTallNate/Java-WebSocket/blob/master/LICENSE")
-libraryLicense(name: "JavaCVS", attachedTo: "javacvs-src", version: "no version number available (with patches by JetBrains)", license: "Sun Public License", url: "https://versioncontrol.netbeans.org/javacvs/library/", licenseUrl: "https://netbeans.org/about/legal/license.html")
-libraryLicense(name: "JavaHelp", version: "2.0_02", license: "included as license/javahelp_license.html in IntelliJ IDEA distribution", url: "http://java.sun.com/products/javahelp/")
-libraryLicense(name: "javawriter", libraryName: "javawriter", license: "Apache 2.0", url: "https://github.com/square/javawriter")
-libraryLicense(name: "JAXB", libraryName: "JAXB", version: "2.2.4-1", license: "CDDL 1.1", url: "http://jaxb.java.net/", licenseUrl: "http://glassfish.java.net/public/CDDL+GPL_1_1.html")
-libraryLicense(name: "Jaxen", version: "", license: "modified Apache", url: "http://www.jaxen.org/", licenseUrl: "http://www.jaxen.org/license.html")
-libraryLicense(name: "jayatana", libraryName: "jayatana", version: "1.2.4", license: "MIT License", url: "https://code.google.com/p/java-swing-ayatana/", licenseUrl: "http://opensource.org/licenses/mit-license.php")
-libraryLicense(name: "JCIP Annotations", libraryName: "jcip", license: "Creative Commons Attribution License", url: "http://www.jcip.net", licenseUrl: "http://creativecommons.org/licenses/by/2.5")
-libraryLicense(name: "JDOM", version: "1.1 (with patches by JetBrains)", license: "modified Apache", url: "http://www.jdom.org/", licenseUrl: "http://www.jdom.org/docs/faq.html#a0030")
-libraryLicense(name: "JediTerm", libraryName: "jediterm-pty", version: "2.2", license: "LGPL 2", url: "https://github.com/JetBrains/jediterm", licenseUrl: "https://github.com/JetBrains/jediterm/blob/master/COPYING")
-libraryLicense(name: "JEuclid", libraryName: "jeuclid-core-3.1.9.jar", version: "3.1.9", license: "Apache 2.0", url: "http://jeuclid.sourceforge.net", licenseUrl:"http://sourceforge.net/p/jeuclid/code/ci/default/tree/LICENSE.txt")
-libraryLicense(name: "JGit", libraryName: "jackson", version: "2.5.1", license: "Apache 2.0", licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://github.com/FasterXML/jackson")
-libraryLicense(name: "JGit", libraryName: "jgit", version: "4.0", license: "Eclipse Distribution License 1.0", licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://eclipse.org/jgit/")
-libraryLicense(name: "JGoodies Common", libraryName: "jgoodies-common", version: "1.2.1", license: "BSD ", url: "http://www.jgoodies.com/freeware/libraries/looks/", licenseUrl: "https://opensource.org/licenses/bsd-license.html")
-libraryLicense(name: "JGoodies Forms", libraryName: "jgoodies-forms", version: "1.1-preview 2006-05-04 11:55:37", license: "BSD ", url: "http://www.jgoodies.com/freeware/libraries/forms/", licenseUrl: "https://opensource.org/licenses/bsd-license.html")
-libraryLicense(name: "JGoodies Looks", libraryName: "jgoodies-looks", version: "2.4.2", license: "BSD ", url: "http://www.jgoodies.com/freeware/libraries/looks/", licenseUrl: "https://opensource.org/licenses/bsd-license.html")
-libraryLicense(name: "jgraphx", libraryName: "jgraphx-3.4.0.1", version: "3.4.0.1", license: "BSD", url: "https://github.com/jgraph/jgraphx")
-libraryLicense(name: "JNA", libraryName: "jna", version: "4.1.0", license: "LGPL 2.1", url: "https://github.com/java-native-access/jna", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1.php")
-libraryLicense(name: "jsch-agent-proxy for svnkit trilead", libraryName: "jsch.agentproxy.svnkit-trilead-ssh2.jar", version: "0.0.7", license: "BSD", url: "https://github.com/ymnk/jsch-agent-proxy", licenseUrl: "https://github.com/ymnk/jsch-agent-proxy/blob/master/LICENSE.txt")
-libraryLicense(name: "jsch-agent-proxy", libraryName: "jsch-agent-proxy", version: "0.0.7", license: "BSD", url: "https://github.com/ymnk/jsch-agent-proxy", licenseUrl: "https://github.com/ymnk/jsch-agent-proxy/blob/master/LICENSE.txt")
-libraryLicense(name: "JSch", libraryName: "JSch", version: "0.1.53", license: "BSD", url: "http://www.jcraft.com/jsch/", licenseUrl: "http://www.jcraft.com/jsch/LICENSE.txt")
-libraryLicense(name: "json-path", libraryName: "json-path-0.8.0.jar", version: "0.8.0", license: "Apache 2.0", url: "http://code.google.com/p/json-path/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "json-smart", libraryName: "json-smart-1.1.1.jar", version: "1.1.1", license: "Apache 2.0", url: "http://code.google.com/p/json-smart/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "jsr305", libraryName: "jsr305", version: "snapshot", license: "BSD", url: "http://code.google.com/p/jsr-305/", licenseUrl: "http://code.google.com/p/jsr-305/source/browse/trunk/ri/LICENSE")
-libraryLicense(name: "Jsr305", version: "1.3.9", license: "New BSD", url: "http://code.google.com/p/jsr-305/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "JUnit", libraryName: "JUnit3", version: "3.8.1", license: "CPL 1.0", url: "http://junit.org/")
-libraryLicense(name: "JUnit", libraryName: "JUnit4", version: "4.11", license: "CPL 1.0", url: "http://junit.org/")
-libraryLicense(name: "junit5_rt", libraryName: "junit5_rt", version: "5.0.0", license: "Eclipse Public License 1.0", url: "http://junit.org/")
-libraryLicense(name: "jzlib", libraryName: "jzlib", version: "1.1.1", license: "BSD", url: "http://www.jcraft.com/jzlib/", licenseUrl: "http://www.jcraft.com/jzlib/LICENSE.txt")
-libraryLicense(name: "Kryo", libraryName: "Kryo", version: "2.22", license: "New BSD License", url: "https://github.com/EsotericSoftware/kryo", licenseUrl: "https://github.com/EsotericSoftware/kryo/blob/master/license.txt")
-libraryLicense(name: "kXML2", libraryName: "kxml2", version: "2.3.0", license: "BSD", url: "http://sourceforge.net/projects/kxml/")
-libraryLicense(name: "Lobo evolution", libraryName: "Loboevolution.jar", version: "0.98.6 (with patches by JetBrains)", license: "MIT", url: "http://sourceforge.net/projects/loboevolution/", licenseUrl: "http://opensource.org/licenses/mit-license.php")
-libraryLicense(name: "Log4j", libraryName: "Log4J", version: "1.2.17", license: "Apache 2.0", url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Lombok AST", libraryName: "lombok-ast", version: "0.2.1", license: "MIT", url: "http://projectlombok.org/", licenseUrl: "http://opensource.org/licenses/mit-license.php")
-libraryLicense(name: "markdown4j", libraryName: "markdown4j-2.2", version: "2.2", license: "New BSD", url: "https://code.google.com/p/markdown4j/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "markdownj", attachedTo: "tasks-core", version: "", license: "BSD", url: "https://github.com/myabc/markdownj", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
-libraryLicense(name: "markdownj", libraryName: "markdownj", version: "0.4.2", license: "New BSD", url: "https://github.com/myabc/markdownj", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "maven-2.2.1-uber", version: "2.2.1", libraryNames: ["maven-2.2.1-uber.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "maven-artifact", version: "3.0.5", libraryNames: ["maven-artifact-3.0.5.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "maven-core", version: "3.0.5", libraryNames: ["maven-core-3.0.5.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Maven", version: "2.2.1", license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Maven3", libraryNames: ["Maven3", "maven-dependency-tree-1.2.jar", "archetype-catalog-2.2.jar", "archetype-common-2.2.jar"], version: "3.0.5", license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "mercurial_prompthooks", attachedTo: "hg4idea", version: "", license: "GPLv2 (used as hg extension called from hg executable)", url: "https://github.com/willemv/mercurial_prompthooks", licenseUrl: "https://github.com/willemv/mercurial_prompthooks/blob/master/LICENSE.txt")
-libraryLicense(name: "Microba", libraryName: "microba", version: "0.4.2", license: "BSD", url: "http://microba.sourceforge.net/", licenseUrl: "http://microba.sourceforge.net/license.txt")
-libraryLicense(name: "MigLayout", libraryName: "miglayout-swing", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/", licenseUrl: "http://www.miglayout.com/mavensite/license.html")
-libraryLicense(name: "minlog", libraryName: "minlog-1.2.jar", version: "1.2", license: "BSD", url: "https://github.com/EsotericSoftware/minlog", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "NanoXML", version: "2.2.3", license: "zlib/libpng", url: "http://mvnrepository.com/artifact/be.cyberelf.nanoxml/nanoxml/2.2.3", licenseUrl: "http://www.opensource.org/licenses/zlib-license.html")
-libraryLicense(name: "nekohtml", libraryName: "nekohtml", version: "1.9.14", license: "Apache 2.0", url: "http://nekohtml.sourceforge.net/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0.txt")
-libraryLicense(name: "Netty", libraryName: "Netty", version: "4.1.0.Beta3", license: "Apache 2.0", url: "http://netty.io", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Objenesis", libraryName: "objenesis-1.2.jar", version: "1.2", license: "Apache 2.0", url: "http://objenesis.org/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "opentest4j", libraryName: "opentest4j", version: "1.0.0", license: "Apache 2.0", url: "https://github.com/ota4j-team/opentest4j", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "pep8.py", attachedTo: "python-helpers", version: "1.6.2", license: "MIT", url: "http://pep8.readthedocs.org/")
-libraryLicense(name: "PicoContainer", libraryName: "picocontainer", version: "1.2", license: "BSD", url: "https://github.com/codehaus/picocontainer", licenseUrl: "https://opensource.org/licenses/bsd-license.php")
-libraryLicense(name: "plexus-archiver", libraryName: "plexus-archiver-2.4.4.jar", version: "2.4.4", license: "Apache 2.0", url: "https://github.com/codehaus-plexus/plexus-archiver", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "plexus-classworlds", libraryName: "plexus-classworlds-2.4.jar", version: "2.4", license: "Apache 2.0", url: "https://github.com/codehaus-plexus/plexus-classworlds", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "plexus-component-annotations", version: "1.5.5", libraryNames: ["plexus-component-annotations-1.5.5.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "plexus-util", version: "2.0.6", license: "Apache 2.0", url: "http://maven.apache.org/", libraryNames:['plexus-utils-2.0.6.jar'], licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Plexus Utils", libraryName: "plexus-utils-1.5.5.jar", version: "1.5.5", license: "Apache 2.0", url: "http://plexus.codehaus.org/plexus-utils")
-libraryLicense(name: "pockets", attachedTo: "python-helpers", version: "0.2.4", license: "BSD", url: "http://pockets.readthedocs.org/")
-libraryLicense(name: "protobuf", version: "2.5.0", license: "New BSD", url: "http://code.google.com/p/protobuf/", licenseUrl: "https://github.com/google/protobuf/blob/master/LICENSE")
-libraryLicense(name: "proxy-vole", libraryName: "proxy-vole", version: "20131209", license: "New BSD License", url: "http://code.google.com/p/proxy-vole/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "pty4j", libraryName: "pty4j", version: "0.7.1", license: "Eclipse Public License v1.0", url: "https://github.com/traff/pty4j")
-libraryLicense(name: "PureJavaComm", libraryName: "purejavacomm", version: "0.0.16", license: "BSD", url: "http://www.sparetimelabs.com/purejavacomm")
-libraryLicense(name: "ReflectASM", libraryName: "reflectasm-1.0.7.jar", version: "1.0.7", license: "BSD", url: "https://github.com/EsotericSoftware/reflectasm", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
-libraryLicense(name: "Relax NG Object Model", libraryName: "rngom-20051226-patched.jar", license: "MIT", url: "http://java.net/projects/rngom/", licenseUrl: "http://www.opensource.org/licenses/mit-license.php")
-libraryLicense(name: "Rhino JavaScript Engine", libraryName: "rhino-js-1_7R4", version: "1.7R4", license: "MPL 1.1", url: "http://www.mozilla.org/rhino/", licenseUrl: "http://www.mozilla.org/MPL/MPL-1.1.html")
-libraryLicense(name: "RMI Stubs", attachedTo: "xslt-debugger-engine", license: "Apache 2.0", url: "https://confluence.jetbrains.com/display/CONTEST/XSLT-Debugger", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "Saxon-6.5.5", version: "6.5.5", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/", licenseUrl: "http://www.mozilla.org/MPL/")
-libraryLicense(name: "Saxon-9HE", version: "9", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/", licenseUrl: "http://www.mozilla.org/MPL/")
-libraryLicense(name: "SceneBuilderKit", version: "8.1.1", license: "BSD", url: "http://gluonhq.com/open-source/scene-builder/", licenseUrl: "http://www.oracle.com/technetwork/licenses/bsd-license-1835287.html")
-libraryLicense(name: "Sequence", libraryName: "sequence-library.jar", version: "bundled with SVNKit", license: "BSD (see LICENSE.txt in sequence-library.jar)", url:"http://www.syntevo.com")
-libraryLicense(name: "six.py", attachedTo: "python-helpers", version: "1.9.0", license: "MIT", url: "http://pythonhosted.org/six/")
-libraryLicense(name: "Slf4j", version: "1.7.10", license: "MIT License", url: "http://slf4j.org/", licenseUrl: "http://slf4j.org/license.html")
-libraryLicense(name: "Snappy-Java", libraryName: "Snappy-Java", version: "0.3.1", license: "Apache 2.0", url: "https://github.com/dain/snappy", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "SnuggleTeX", version: "1.3 (with patches by JetBrains)", license: "BSD", url: "http://snuggletex.sourceforge.net/", licenseUrl:"http://snuggletex.sourceforge.net/maven/license.html")
-libraryLicense(name: "Sonatype Nexus Indexer Artifact", libraryName: "nexus-indexer-artifact-1.0.1.jar", version: "1.0.1", license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/", licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html")
-libraryLicense(name: "Sonatype Nexus: Indexer", libraryName: "nexus-indexer-1.2.3.jar", version: "1.2.3", license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/", licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html")
-libraryLicense(name: "Sonatype Nexus: Indexer", libraryName: "nexus-indexer-3.0.4.jar", version: "3.0.4", license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/", licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html")
-libraryLicense(name: "Spantable", libraryName: "spantable.jar", version: "patched", license: "LGPL 2.1", licenseUrl: "http://www.gnu.org/licenses/lgpl.html", url: "https://android.googlesource.com/platform/prebuilts/tools/+/master/common/spantable/")
-libraryLicense(name: "sphinxcontrib-napoleon", attachedTo: "python-helpers", version: "0.3.11", license: "BSD", url: "http://sphinxcontrib-napoleon.readthedocs.org/")
-libraryLicense(name: "sqljet", version: "bundled with SVNKit", libraryName: "sqljet.jar", license: "link (commercial license)", url: "http://sqljet.com", licenseUrl: "http://svnkit.com/license.html")
-libraryLicense(name: "svnkit-javahl", version: "bundled with SVNKit", libraryName: "svnkit-javahl.jar", license: "link (commercial license)", url: "http://www.svnkit.com/", licenseUrl: "http://svnkit.com/license.html")
-libraryLicense(name: "SVNKit", libraryName: "svnkit.jar", version: "1.8.12", license: "link (commercial license)", url: "http://www.svnkit.com/", licenseUrl: "http://svnkit.com/license.html")
-libraryLicense(name: "swingx", libraryName: "swingx", version: "1.6.2", license: "LGPL 2.1", url: "http://java.net/downloads/swingx/", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1.php")
-libraryLicense(name: "TestNG", version: "6.9 snapshot", license: "Apache 2.0", url: "http://testng.org/doc/", licenseUrl: "https://github.com/cbeust/testng/blob/master/LICENSE.txt")
-libraryLicense(name: "Trilead SSH", libraryName: "trilead-ssh2", version: "build 213 and 217", license: "BSD style (see LICENSE.txt in trilead.jar)", url: "http://www.trilead.com/SSH_Library/")
-libraryLicense(name: "Twitter4J", libraryName: "twitter4j-core-4.0.4.jar", version: "4.0.4", license: "Apache 2.0", url: "http://twitter4j.org/", licenseUrl: "http://twitter4j.org/en/index.html#license")
-libraryLicense(name: "Trove4j", version: "1.1 (with patches by JetBrains)", license: "LGPL", url: "http://trove4j.sourceforge.net/", licenseUrl: "http://trove4j.sourceforge.net/html/license.html")
-libraryLicense(name: "Velocity", version: "1.7", license: "Apache 2.0", url: "http://velocity.apache.org/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt")
-libraryLicense(name: "winp", version: "1.23", license: "MIT", url: "http://java.net/projects/winp", licenseUrl: "http://opensource.org/licenses/mit-license.php")
-libraryLicense(name: "Xalan", libraryName:"Xalan-2.7.1", version: "2.7.1", license: "Apache 2.0", url: "http://xml.apache.org/xalan-j/", licenseUrl: "http://xml.apache.org/xalan-j/")
-libraryLicense(name: "Xerces", version: "2.11", license: "Apache 2.0", url: "http://xerces.apache.org/xerces2-j/", licenseUrl: "http://xerces.apache.org/xerces2-j/")
-libraryLicense(name: "Xerial SQLite JDBC", libraryName: "sqlite", version: "3.6.20.1", license: "Apache 2.0", url: "https://github.com/xerial/sqlite-jdbc")
-libraryLicense(name: "XML-RPC", libraryName: "XmlRPC", version: "2.0", license: "Apache 2.0", url: "http://ws.apache.org/xmlrpc/xmlrpc2/", licenseUrl: "http://ws.apache.org/xmlrpc/xmlrpc2/license.html")
-libraryLicense(name: "XML Commons (xml-apis.jar, resolver.jar)", version: "", license: "Apache 2.0, W3C Software License , public domain", url: "http://xml.apache.org/commons/", licenseUrl: "http://xml.apache.org/commons/licenses.html")
-libraryLicense(name: "XMLBeans", libraryName: "XmlBeans", version: "2.3.0", license: "Apache 2.0", url: "http://xmlbeans.apache.org/", licenseUrl: "http://svn.jetbrains.org/idea/Trunk/bundled/WebServices/resources/lib/xmlbeans-2.3.0/xmlbeans.LICENSE")
-libraryLicense(name: "XStream", libraryName: "XStream", version: "1.4.2", license: "BSD License", url: "https://github.com/codehaus/xstream", licenseUrl: "https://github.com/codehaus/xstream/blob/master/LICENSE.txt")
-libraryLicense(name: "XStream", version: "1.4.3", license: "BSD", url: "https://github.com/codehaus/xstream", licenseUrl: "https://github.com/codehaus/xstream/blob/master/LICENSE.txt")
-libraryLicense(name: "YourKit Java Profiler", libraryName: "yjp-controller-api-redist.jar", version: "8.0.x", license: "link (commercial license)", url: "http://yourkit.com/", licenseUrl: "http://www.yourkit.com/purchase/license.html")
-
-jetbrainsLibrary("Coverage")
-jetbrainsLibrary("CoverageReport")
-jetbrainsLibrary("intellij-markdown.jar")
-jetbrainsLibrary("JPS")
-jetbrainsLibrary("Maven Embedder")
-jetbrainsLibrary("tcServiceMessages")
-jetbrainsLibrary("optimizedFileManager.jar")
-jetbrainsLibrary("KotlinJavaRuntime")
index 6577be77132fed1ba03ce21c94652dc23b2f2c67..f5981e650af4dabfd70c1a7a8cd2b112d3c13221 100644 (file)
 package com.intellij.debugger.actions;
 
 import com.intellij.debugger.SourcePosition;
+import com.intellij.debugger.engine.SuspendContextImpl;
+import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
+import com.intellij.debugger.impl.DebuggerSession;
 import com.intellij.debugger.impl.DebuggerUtilsEx;
+import com.intellij.debugger.jdi.MethodBytecodeUtil;
+import com.intellij.debugger.jdi.StackFrameProxyImpl;
 import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.fileEditor.TextEditor;
+import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.util.DocumentUtil;
 import com.intellij.util.Range;
 import com.intellij.util.containers.OrderedSet;
+import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
+import com.sun.jdi.Location;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.org.objectweb.asm.Label;
+import org.jetbrains.org.objectweb.asm.MethodVisitor;
+import org.jetbrains.org.objectweb.asm.Opcodes;
 
 import java.util.Collections;
 import java.util.List;
@@ -39,6 +54,8 @@ import java.util.Stack;
  * Date: 22.11.11
  */
 public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
+  private static final Logger LOG = Logger.getInstance(JavaSmartStepIntoHandler.class);
+
   @Override
   public boolean isAvailable(final SourcePosition position) {
     final PsiFile file = position.getFile();
@@ -46,8 +63,37 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
   }
 
   @Override
+  public boolean doSmartStep(SourcePosition position, DebuggerSession session, TextEditor fileEditor) {
+    session.getProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(session.getContextManager().getContext()) {
+      @Override
+      public void threadAction(@NotNull SuspendContextImpl suspendContext) {
+        List<SmartStepTarget> targets = ApplicationManager.getApplication().runReadAction(
+          (Computable<List<SmartStepTarget>>)() -> findSmartStepTargets(position, suspendContext));
+        DebuggerUIUtil.invokeLater(() -> {
+          if (targets.isEmpty()) {
+            doStepInto(session, Registry.is("debugger.single.smart.step.force"), null);
+          }
+          else {
+            handleTargets(position, session, fileEditor, targets);
+          }
+        });
+      }
+
+      @Override
+      public Priority getPriority() {
+        return Priority.NORMAL;
+      }
+    });
+    return true;
+  }
+
   @NotNull
-  public List<SmartStepTarget> findSmartStepTargets(final SourcePosition position) {
+  @Override
+  public List<SmartStepTarget> findSmartStepTargets(SourcePosition position) {
+    throw new IllegalStateException("Should not be used");
+  }
+
+  protected List<SmartStepTarget> findSmartStepTargets(final SourcePosition position, @Nullable SuspendContextImpl suspendContext) {
     final int line = position.getLine();
     if (line < 0) {
       return Collections.emptyList(); // the document has been changed
@@ -82,7 +128,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
         }
         element = parent;
       }
-      while(true);
+      while (true);
 
       //noinspection unchecked
       final List<SmartStepTarget> targets = new OrderedSet<>();
@@ -222,10 +268,42 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
 
       Range<Integer> lines =
         new Range<>(doc.getLineNumber(textRange.get().getStartOffset()), doc.getLineNumber(textRange.get().getEndOffset()));
-      for (SmartStepTarget target : targets) {
-        target.setCallingExpressionLines(lines);
+      targets.forEach(t -> t.setCallingExpressionLines(lines));
+
+      if (!targets.isEmpty()) {
+        StackFrameProxyImpl frameProxy = suspendContext != null ? suspendContext.getFrameProxy() : null;
+        if (frameProxy != null) {
+          try {
+            Location location = frameProxy.location();
+            MethodBytecodeUtil.visit(location.declaringType(), location.method(), location.codeIndex(), new MethodVisitor(Opcodes.ASM5) {
+              boolean myLineMatch = false;
+
+              @Override
+              public void visitLineNumber(int line, Label start) {
+                myLineMatch = lines.isWithin(line - 1);
+              }
+
+              @Override
+              public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
+                if (myLineMatch) {
+                  targets.removeIf(t -> {
+                    if (t instanceof MethodSmartStepTarget) {
+                      return DebuggerUtilsEx.methodMatches(((MethodSmartStepTarget)t).getMethod(),
+                                                           owner.replace("/", "."), name, desc, suspendContext.getDebugProcess());
+                    }
+                    return false;
+                  });
+                }
+              }
+            });
+          }
+          catch (Exception e) {
+            LOG.info(e);
+          }
+        }
+
+        return targets;
       }
-      return targets;
     }
     return Collections.emptyList();
   }
index e436fa0c2a95c5618f62e39e44093aa5313353a2..4f8a20cf9190187fd54bfabf39a351107cc76137 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.debugger.actions;
 
 import com.intellij.debugger.DebuggerManagerEx;
 import com.intellij.debugger.SourcePosition;
+import com.intellij.debugger.engine.MethodFilter;
 import com.intellij.debugger.engine.SuspendContextImpl;
 import com.intellij.debugger.impl.DebuggerContextImpl;
 import com.intellij.debugger.impl.DebuggerSession;
@@ -51,8 +52,12 @@ public class JvmSmartStepIntoActionHandler extends DebuggerActionHandler {
         }
       }
     }
+    doStepInto(session, Registry.is("debugger.single.smart.step.force"), null);
+  }
+
+  static void doStepInto(DebuggerSession session, boolean force, MethodFilter filter) {
     session.sessionResumed();
-    session.stepInto(Registry.is("debugger.single.smart.step.force"), null);
+    session.stepInto(force, filter);
   }
 
   public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
index f7925d52729c289b4151ef7e4ad9de23774fb7d4..2c09c96dffbcb4ff624ada8760af686872077e2f 100644 (file)
@@ -57,21 +57,22 @@ public abstract class JvmSmartStepIntoHandler {
    * @return false to continue for another handler or for default action (step into)
    */
   public boolean doSmartStep(SourcePosition position, final DebuggerSession session, TextEditor fileEditor) {
-    final List<SmartStepTarget> targets = findSmartStepTargets(position);
+    return handleTargets(position, session, fileEditor, findSmartStepTargets(position));
+  }
+
+  protected final boolean handleTargets(SourcePosition position,
+                                        DebuggerSession session,
+                                        TextEditor fileEditor,
+                                        List<SmartStepTarget> targets) {
     if (!targets.isEmpty()) {
-      final SmartStepTarget firstTarget = targets.get(0);
+      SmartStepTarget firstTarget = targets.get(0);
       if (targets.size() == 1) {
-        session.sessionResumed();
-        session.stepInto(Registry.is("debugger.single.smart.step.force"), createMethodFilter(firstTarget));
+        doStepInto(session, Registry.is("debugger.single.smart.step.force"), firstTarget);
       }
       else {
-        final Editor editor = fileEditor.getEditor();
-        final PsiMethodListPopupStep popupStep = new PsiMethodListPopupStep(editor, targets, new PsiMethodListPopupStep.OnChooseRunnable() {
-          public void execute(SmartStepTarget chosenTarget) {
-            session.sessionResumed();
-            session.stepInto(true, createMethodFilter(chosenTarget));
-          }
-        });
+        Editor editor = fileEditor.getEditor();
+        PsiMethodListPopupStep popupStep =
+          new PsiMethodListPopupStep(editor, targets, chosenTarget -> doStepInto(session, true, chosenTarget));
         ListPopupImpl popup = new ListPopupImpl(popupStep);
         DebuggerUIUtil.registerExtraHandleShortcuts(popup, XDebuggerActions.STEP_INTO, XDebuggerActions.SMART_STEP_INTO);
         popup.setAdText(DebuggerUIUtil.getSelectionShortcutsAdText(XDebuggerActions.STEP_INTO, XDebuggerActions.SMART_STEP_INTO));
@@ -95,6 +96,10 @@ public abstract class JvmSmartStepIntoHandler {
     return false;
   }
 
+  protected void doStepInto(DebuggerSession session, boolean force, SmartStepTarget target) {
+    JvmSmartStepIntoActionHandler.doStepInto(session, force, createMethodFilter(target));
+  }
+
   private static void highlightTarget(PsiMethodListPopupStep popupStep, SmartStepTarget target) {
     final PsiElement highlightElement = target.getHighlightElement();
     if (highlightElement != null) {
index 7c271cec3d41f8d33d178ec141c138f66c415000..680bca874f009bb9e7d09ef18f5c7a3d85bce753 100644 (file)
@@ -918,6 +918,23 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
     return false;
   }
 
+  public static boolean methodMatches(@NotNull PsiMethod psiMethod,
+                                      String className,
+                                      String name,
+                                      String signature,
+                                      DebugProcessImpl process) {
+    PsiClass containingClass = psiMethod.getContainingClass();
+    try {
+      return containingClass != null && Objects.equals(containingClass.getQualifiedName(), className) &&
+             JVMNameUtil.getJVMMethodName(psiMethod).equals(name) &&
+             JVMNameUtil.getJVMSignature(psiMethod).getName(process).equals(signature);
+    }
+    catch (EvaluateException e) {
+      LOG.debug(e);
+      return false;
+    }
+  }
+
   @Nullable
   public static PsiElement getContainingMethod(@Nullable PsiElement elem) {
     return PsiTreeUtil.getContextOfType(elem, PsiMethod.class, PsiLambdaExpression.class, PsiClassInitializer.class);
index 57227d1e40d4f049f52d7b5ba6e03eda5ad34e7e..e4422331e055d1ba4100d804a0f201a44a306ba2 100644 (file)
@@ -25,7 +25,6 @@ import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
 import com.intellij.ui.components.JBList;
-import com.intellij.util.PlatformIcons;
 
 import javax.swing.*;
 
@@ -72,7 +71,7 @@ public class ClassesOrderRootTypeUIFactory implements OrderRootTypeUIFactory {
       return new PathCellRenderer() {
         @Override
         protected Icon getItemIcon(Object value) {
-          return isJrtRoot(value) ? PlatformIcons.JAR_ICON : super.getItemIcon(value);
+          return isJrtRoot(value) ? AllIcons.Nodes.JavaModuleRoot : super.getItemIcon(value);
         }
       };
     }
index ee77447420f7ba769747f21a992c59d2c03eed7a..f3896e54cccdd8f8ed13411f8b26ab798749f83a 100644 (file)
@@ -134,7 +134,7 @@ public class ConfigFileInfoSetImpl implements ConfigFileInfoSet {
       final int id = Comparing.compare(o1.getMetaData().getId(), o2.getMetaData().getId());
       return id != 0? id : Comparing.compare(o1.getUrl(), o2.getUrl());
     });
-    sortedConfigFiles.addAll(myConfigFiles.collectValues());
+    sortedConfigFiles.addAll(myConfigFiles.values());
     for (ConfigFileInfo configuration : sortedConfigFiles) {
       final Element child = new Element(ELEMENT_NAME);
       final ConfigFileMetaData metaData = configuration.getMetaData();
index eb25115f00cb75f48b1cde8faeb94d821396f544..56c6cf8ac3e9631eb0fed0110ba333247b73523f 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.codeInsight.intention;
 
 import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
-import com.intellij.codeInspection.IntentionAndQuickFixAction;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
 import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
@@ -271,9 +270,7 @@ public abstract class QuickFixFactory {
   public abstract IntentionAction createWrapLongWithMathToIntExactFix(@Nullable PsiType type, @NotNull PsiExpression expression);
 
   @NotNull
-  public IntentionAction createWrapWithOptionalFix(@Nullable PsiType type, @NotNull PsiExpression expression) {
-    throw new UnsupportedOperationException();
-  }
+  public abstract IntentionAction createWrapWithOptionalFix(@Nullable PsiType type, @NotNull PsiExpression expression);
 
   public abstract IntentionAction createNotIterableForEachLoopFix(PsiExpression expression);
 }
\ No newline at end of file
index c214f2fa2ae8fe02f81d158421b8ff0d801bbe24..6093e21abb823f9f6f43f83881f48335ed8ce3d6 100644 (file)
@@ -1613,6 +1613,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
     super.visitModule(module);
     if (!myHolder.hasErrorResults()) myHolder.add(checkFeature(module, Feature.MODULES));
     if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkFileName(module, myFile));
+    if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkModuleDuplicates(module, myFile));
     if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkFileDuplicates(module, myFile));
     if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkFileLocation(module, myFile));
   }
index d59741e420203d9d50a63290e794c93516878bc1..13faebfeb79909fb959818e3d3180390006a0540 100644 (file)
 package com.intellij.codeInsight.daemon.impl.analysis;
 
 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.GoToSymbolFix;
 import com.intellij.codeInsight.daemon.impl.quickfix.MoveFileFix;
 import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
 import com.intellij.codeInsight.intention.QuickFixFactory;
@@ -29,7 +31,10 @@ import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiJavaModule;
+import com.intellij.psi.PsiManager;
+import com.intellij.psi.impl.java.stubs.index.JavaModuleNameIndex;
 import com.intellij.psi.search.FilenameIndex;
+import com.intellij.psi.search.ProjectScope;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -51,6 +56,23 @@ public class ModuleHighlightUtil {
     return null;
   }
 
+  @Nullable
+  static HighlightInfo checkModuleDuplicates(@NotNull PsiJavaModule element, @NotNull PsiFile file) {
+    String name = element.getModuleName();
+    Project project = file.getProject();
+    Collection<PsiJavaModule> others = JavaModuleNameIndex.getInstance().get(name, project, ProjectScope.getAllScope(project));
+    if (others.size() > 1) {
+      String message = JavaErrorMessages.message("module.name.duplicate", name);
+      HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element.getNameElement()).description(message).create();
+      others.stream().filter(m -> m != element).findFirst().ifPresent(
+        duplicate -> QuickFixAction.registerQuickFixAction(info, new GoToSymbolFix(duplicate, JavaErrorMessages.message("module.open.duplicate.text")))
+      );
+      return info;
+    }
+
+    return null;
+  }
+
   @Nullable
   static HighlightInfo checkFileDuplicates(@NotNull PsiJavaModule element, @NotNull PsiFile file) {
     VirtualFile vFile = file.getVirtualFile();
@@ -62,8 +84,11 @@ public class ModuleHighlightUtil {
           FilenameIndex.getVirtualFilesByName(project, MODULE_INFO_FILE, new ModulesScope(Collections.singleton(module), project));
         if (others.size() > 1) {
           String message = JavaErrorMessages.message("module.file.duplicate");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(range(element)).description(message).create();
-          //todo show duplicates quick fix
+          HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(range(element)).description(message).create();
+          others.stream().map(f -> PsiManager.getInstance(project).findFile(f)).filter(f -> f != file).findFirst().ifPresent(
+            duplicate -> QuickFixAction.registerQuickFixAction(info, new GoToSymbolFix(duplicate, JavaErrorMessages.message("module.open.duplicate.text")))
+          );
+          return info;
         }
       }
     }
@@ -79,7 +104,7 @@ public class ModuleHighlightUtil {
       if (root != null && !root.equals(vFile.getParent())) {
         String message = JavaErrorMessages.message("module.file.wrong.location");
         HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.WARNING).range(range(element)).description(message).create();
-        QuickFixAction.registerQuickFixAction(info, new MoveFileFix(vFile, root));
+        QuickFixAction.registerQuickFixAction(info, new MoveFileFix(vFile, root, QuickFixBundle.message("move.file.to.source.root.text")));
         return info;
       }
     }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/GoToSymbolFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/GoToSymbolFix.java
new file mode 100644 (file)
index 0000000..9cfcbdd
--- /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.intention.IntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.NavigatablePsiElement;
+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 GoToSymbolFix implements IntentionAction {
+  private final SmartPsiElementPointer<NavigatablePsiElement> myPointer;
+  private final String myMessage;
+
+  public GoToSymbolFix(@NotNull NavigatablePsiElement symbol, @NotNull @Nls String message) {
+    myPointer = SmartPointerManager.getInstance(symbol.getProject()).createSmartPsiElementPointer(symbol);
+    myMessage = message;
+  }
+
+  @Nls
+  @NotNull
+  @Override
+  public String getText() {
+    return myMessage;
+  }
+
+  @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 {
+    NavigatablePsiElement e = myPointer.getElement();
+    if (e != null && e.isValid()) {
+      e.navigate(true);
+    }
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return false;
+  }
+}
\ No newline at end of file
index e38b044ddf7c7269b27c94da9c093a1d7f896bde..8fda18a24b52140fc5e454d44a1027f42e3095ca 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.intellij.codeInsight.daemon.impl.quickfix;
 
-import com.intellij.codeInsight.daemon.QuickFixBundle;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
@@ -30,17 +29,19 @@ import java.io.IOException;
 public class MoveFileFix implements IntentionAction {
   private final VirtualFile myFile;
   private final VirtualFile myTarget;
+  private final String myMessage;
 
-  public MoveFileFix(@NotNull VirtualFile file, @NotNull VirtualFile target) {
+  public MoveFileFix(@NotNull VirtualFile file, @NotNull VirtualFile target, @NotNull @Nls String message) {
     myFile = file;
     myTarget = target;
+    myMessage = message;
   }
 
   @Nls
   @NotNull
   @Override
   public String getText() {
-    return QuickFixBundle.message("move.file.to.source.root.text");
+    return myMessage;
   }
 
   @Nls
index 8f334717440f222af8b299996c2340f682fa2a4c..7b89801484c55c84052e0bfa4894c4e33f0b8ad4 100644 (file)
@@ -379,7 +379,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
     }
     if (element != null) {
       for (EntryPoint extension : myExtensions) {
-        if (extension.isEntryPoint(owner, element)) {
+        if (extension.isSelected() && extension.isEntryPoint(owner, element)) {
           return true;
         }
       }
@@ -416,7 +416,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
       if (entryPointsManager.isEntryPoint(element)) return true;
     }
     for (EntryPoint extension : myExtensions) {
-      if (extension.isEntryPoint(element)) {
+      if (extension.isSelected() && extension.isEntryPoint(element)) {
         return true;
       }
     }
index c9c8a47b8461b704c29e74964a835dae12c83032..692761d7d9dab06c0de971e2cdc20fd0eeafd6e1 100644 (file)
@@ -31,13 +31,14 @@ import com.intellij.openapi.extensions.impl.ExtensionPointImpl;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.JDOMExternalizableStringList;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
-import com.intellij.psi.PsiDocCommentOwner;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiManager;
-import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.*;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.ui.UIUtil;
+import com.intellij.util.xmlb.SkipDefaultsSerializationFilter;
+import com.intellij.util.xmlb.XmlSerializer;
+import com.intellij.util.xmlb.annotations.*;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -50,6 +51,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
   @NonNls private static final String[] STANDARD_ANNOS = {
     "javax.ws.rs.*",
   };
+  private static final String PATTERN_SUFFIX = ".*";
 
   // null means uninitialized
   private volatile List<String> ADDITIONAL_ANNOS;
@@ -72,6 +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 Set<RefElement> myTemporaryEntryPoints;
   private static final String VERSION = "2.0";
   @NonNls private static final String VERSION_ATTR = "version";
@@ -137,6 +140,13 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
     }
     catch (Throwable ignored) {
     }
+
+    getPatterns().clear();
+    for (Element pattern : element.getChildren("pattern")) {
+      final ClassPattern classPattern = new ClassPattern();
+      XmlSerializer.deserializeInto(classPattern, pattern);
+      getPatterns().add(classPattern);
+    }
   }
 
   @Override
@@ -144,6 +154,11 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
   public Element getState()  {
     Element element = new Element("state");
     writeExternal(element, myPersistentEntryPoints, ADDITIONAL_ANNOTATIONS);
+    if (!getPatterns().isEmpty()) {
+      for (ClassPattern pattern : getPatterns()) {
+        element.addContent(XmlSerializer.serialize(pattern, new SkipDefaultsSerializationFilter()));
+      }
+    }
     return element;
   }
 
@@ -179,6 +194,16 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
             ((RefElementImpl)refElement).setPermanentEntry(entryPoint.isPersistent());
           }
         }
+
+        for (ClassPattern pattern : myPatterns) {
+          final RefEntity refClass = manager.getReference(RefJavaManager.CLASS, pattern.pattern);
+          if (refClass != null) {
+            for (RefMethod constructor : ((RefClass)refClass).getConstructors()) {
+              ((RefMethodImpl)constructor).setEntry(true);
+              ((RefMethodImpl)constructor).setPermanentEntry(true);
+            }
+          }
+        }
       });
     }
   }
@@ -194,6 +219,21 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
   @Override
   public void addEntryPoint(@NotNull RefElement newEntryPoint, boolean isPersistent) {
     if (!newEntryPoint.isValid()) return;
+    if (isPersistent) {
+      if (newEntryPoint instanceof RefMethod && ((RefMethod)newEntryPoint).isConstructor() || newEntryPoint instanceof RefClass) {
+        final ClassPattern classPattern = new ClassPattern();
+        classPattern.pattern = new SmartRefElementPointerImpl(newEntryPoint, true).getFQName();
+        getPatterns().add(classPattern);
+
+        final EntryPointsManager entryPointsManager = getInstance(newEntryPoint.getElement().getProject());
+        if (this != entryPointsManager) {
+          entryPointsManager.addEntryPoint(newEntryPoint, true);
+        }
+
+        return;
+      }
+    }
+
     if (newEntryPoint instanceof RefClass) {
       RefClass refClass = (RefClass)newEntryPoint;
 
@@ -250,8 +290,8 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
 
     if (key != null) {
       myPersistentEntryPoints.remove(key);
-      ((RefElementImpl)anEntryPoint).setEntry(false);
     }
+    ((RefElementImpl)anEntryPoint).setEntry(false);
 
     if (anEntryPoint.isPermanentEntry() && anEntryPoint.isValid()) {
       final Project project = anEntryPoint.getElement().getProject();
@@ -260,6 +300,17 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
         entryPointsManager.removeEntryPoint(anEntryPoint);
       }
     }
+
+    if (anEntryPoint instanceof RefMethod && ((RefMethod)anEntryPoint).isConstructor() || anEntryPoint instanceof RefClass) {
+      final RefClass aClass = anEntryPoint instanceof RefClass ? (RefClass)anEntryPoint : ((RefMethod)anEntryPoint).getOwnerClass();
+      final String qualifiedName = aClass.getQualifiedName();
+      for (Iterator<ClassPattern> iterator = getPatterns().iterator(); iterator.hasNext(); ) {
+        if (Comparing.equal(iterator.next().pattern, qualifiedName)) {
+          //todo if inheritance or pattern?
+          iterator.remove();
+        }
+      }
+    }
   }
 
   @NotNull
@@ -323,6 +374,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
 
   public void addAllPersistentEntries(EntryPointsManagerBase manager) {
     myPersistentEntryPoints.putAll(manager.myPersistentEntryPoints);
+    myPatterns.addAll(manager.getPatterns());
   }
 
   public static void convert(Element element, final Map<String, SmartRefElementPointer> persistentEntryPoints) {
@@ -382,7 +434,74 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
       return true;
     }
 
+    if (element instanceof PsiClass) {
+      final String qualifiedName = ((PsiClass)element).getQualifiedName();
+      if (qualifiedName != null) {
+        for (ClassPattern pattern : getPatterns()) {
+          if (isAcceptedByPattern((PsiClass)element, qualifiedName, pattern, new HashSet<>())) {
+            return true;
+          }
+        }
+      }
+    }
+
     return AnnotationUtil.checkAnnotatedUsingPatterns(owner, ADDITIONAL_ANNOTATIONS) ||
            AnnotationUtil.checkAnnotatedUsingPatterns(owner, getAdditionalAnnotations());
   }
+
+  private static boolean isAcceptedByPattern(@NotNull PsiClass element, String qualifiedName, ClassPattern pattern, Set<PsiClass> visited) {
+    if (qualifiedName == null) {
+      return false;
+    }
+
+    if (qualifiedName.equals(pattern.pattern)) {
+      return true;
+    }
+
+    if (pattern.pattern.endsWith(PATTERN_SUFFIX) && qualifiedName.startsWith(StringUtil.trimEnd(pattern.pattern, PATTERN_SUFFIX))) {
+      return true;
+    }
+
+    if (pattern.hierarchically) {
+      for (PsiClass superClass : element.getSupers()) {
+        final String superClassQualifiedName = superClass.getQualifiedName();
+        if (visited.add(superClass) && isAcceptedByPattern(superClass, superClassQualifiedName, pattern, visited)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  public List<ClassPattern> getPatterns() {
+    return myPatterns;
+  }
+
+  @Tag("pattern")
+  public static class ClassPattern {
+    @Attribute("value")
+    public String pattern;
+    @Attribute("hierarchically")
+    public boolean hierarchically = false;
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      ClassPattern otherPattern = (ClassPattern)o;
+
+      if (hierarchically != otherPattern.hierarchically) return false;
+      if (!pattern.equals(otherPattern.pattern)) return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int result = pattern.hashCode();
+      result = 31 * result + (hierarchically ? 1 : 0);
+      return result;
+    }
+  }
 }
index 73a591880951a94476614d476a078bada0655176..2bdf06be8cc5f14c36cb176dc79706dce2ae23af 100644 (file)
@@ -372,6 +372,9 @@ public class RefJavaManagerImpl extends RefJavaManager {
 
         }
 
+        @Override
+        public void configureEntryClassPatterns() {}
+
         @Override
         public JButton createConfigureAnnotationsBtn() {
           return null;
index 4c8fef3b7ce10e07d8de0d08a820bebcf83ad8e2..b2e8b67ad3de0270a661c1957e83fcd186da4afb 100644 (file)
@@ -28,7 +28,6 @@ import com.intellij.openapi.editor.highlighter.HighlighterIterator;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -193,6 +192,9 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
     char charAt = editor.getDocument().getCharsSequence().charAt(offset);
     if (charAt != ';') return false;
 
+    HighlighterIterator hi = ((EditorEx)editor).getHighlighter().createIterator(offset);
+    if (hi.atEnd() || hi.getTokenType() != JavaTokenType.SEMICOLON) return false;
+
     EditorModificationUtil.moveCaretRelatively(editor, 1);
     return true;
   }
index 3cf9258166cec679cf6339248875a76ed7a4e729..1fba84acfba53433bf74f24728ec13a28abf265f 100644 (file)
@@ -128,10 +128,13 @@ public class UnusedDeclarationInspection extends UnusedDeclarationInspectionBase
       gc.gridy++;
       add(myNonJavaCheckbox, gc);
 
-      JButton configureAnnotations = EntryPointsManagerImpl.createConfigureAnnotationsButton();
+      final JButton configureClassPatternsButton = EntryPointsManagerImpl.createConfigureClassPatternsButton();
       gc.fill = GridBagConstraints.NONE;
       gc.gridy++;
-      gc.insets.top = 10;
+      add(configureClassPatternsButton, gc);
+
+      JButton configureAnnotations = EntryPointsManagerImpl.createConfigureAnnotationsButton();
+      gc.gridy++;
       gc.weighty = 1;
 
       add(configureAnnotations, gc);
diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/ConfigureClassPatternsDialog.java b/java/java-impl/src/com/intellij/codeInspection/ex/ConfigureClassPatternsDialog.java
new file mode 100644 (file)
index 0000000..0499faf
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * 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.codeInspection.ex;
+
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.ui.*;
+import com.intellij.ui.table.JBTable;
+import com.intellij.util.ui.ItemRemovable;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+
+class ConfigureClassPatternsDialog extends DialogWrapper {
+
+  private final List<EntryPointsManagerBase.ClassPattern> myModifiedPatterns;
+  private final List<EntryPointsManagerBase.ClassPattern> myPatterns;
+  private final Project myProject;
+  public ConfigureClassPatternsDialog(List<EntryPointsManagerBase.ClassPattern> patterns, Project project) {
+    super(project);
+    myModifiedPatterns = new ArrayList<>(patterns);
+    myPatterns = patterns;
+    myProject = project;
+    init();
+    setTitle("Configure Class Patterns");
+  }
+  @Override
+  protected JComponent createCenterPanel() {
+    final JBTable table = createTableForPatterns();
+    final ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(table)
+      .setAddAction(new AnActionButtonRunnable() {
+        @Override
+        public void run(AnActionButton button) {
+          myModifiedPatterns.add(new EntryPointsManagerBase.ClassPattern());
+          AbstractTableModel model = (AbstractTableModel)table.getModel();
+          final int row = myModifiedPatterns.size() - 1;
+          model.fireTableRowsInserted(row, row);
+          table.setRowSelectionInterval(row, row);
+          table.editCellAt(row, 1);
+        }
+      }).setRemoveAction(new AnActionButtonRunnable() {
+        @Override
+        public void run(AnActionButton button) {
+          TableUtil.removeSelectedItems(table);
+          table.repaint();
+        }
+      })
+      .setRemoveActionUpdater(new AnActionButtonUpdater() {
+        @Override
+        public boolean isEnabled(AnActionEvent e) {
+          return table.getSelectedRow() >= 0;
+        }
+      })
+      .setButtonComparator("Add", "Remove");
+    JPanel panel = new JPanel(new BorderLayout());
+    panel.add(SeparatorFactory.createSeparator("Mark class as reachable if name matches", null), BorderLayout.NORTH);
+    panel.add(toolbarDecorator.createPanel(), BorderLayout.CENTER);
+    return panel;
+  }
+
+  @Override
+  protected void doOKAction() {
+    myPatterns.clear();
+    myPatterns.addAll(myModifiedPatterns);
+    DaemonCodeAnalyzer.getInstance(myProject).restart();
+    super.doOKAction();
+  }
+
+  private JBTable createTableForPatterns() {
+    TableModel dataModel = new MyTableModel();
+
+    final JBTable result = new JBTable(dataModel);
+    result.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+    TableCellEditor editor = result.getDefaultEditor(String.class);
+    if (editor instanceof DefaultCellEditor) {
+      ((DefaultCellEditor)editor).setClickCountToStart(1);
+    }
+
+    final TableColumn column = result.getTableHeader().getColumnModel().getColumn(0);
+    column.setResizable(false);
+    final int width = 15 + result.getTableHeader().getFontMetrics(result.getTableHeader().getFont()).stringWidth(result.getColumnName(0));
+    column.setMaxWidth(width);
+    column.setMinWidth(width);
+
+    return result;
+  }
+
+  private class MyTableModel extends AbstractTableModel implements ItemRemovable {
+    private final String[] myNames;
+
+    public MyTableModel() {
+      myNames = new String[] {"With Subclasses",  "Class"};
+    }
+
+    public int getColumnCount() {
+      return 2;
+    }
+
+    public int getRowCount() {
+      return myModifiedPatterns.size();
+    }
+
+    @Nullable
+    public Object getValueAt(int row, int col) {
+      if (row < 0) return null;
+      final EntryPointsManagerBase.ClassPattern classPattern = myModifiedPatterns.get(row);
+      if (classPattern == null) return null;
+      if (col == 0) {
+        return classPattern.hierarchically;
+      }
+      return classPattern.pattern;
+    }
+
+    public String getColumnName(int column) {
+      return myNames[column];
+    }
+
+    public Class getColumnClass(int col) {
+      if (col == 0) {
+        return Boolean.class;
+      }
+      if (col == 1) {
+        return String.class;
+      }
+      throw new IllegalArgumentException(String.valueOf(col));
+    }
+
+    public boolean isCellEditable(int row, int col) {
+      return true;
+    }
+
+    public void setValueAt(Object aValue, int row, int col) {
+      EntryPointsManagerBase.ClassPattern classPattern = myModifiedPatterns.get(row);
+      if (classPattern == null) return;
+      if (col == 0) {
+        classPattern.hierarchically = (boolean)aValue;
+      }
+      else {
+        classPattern.pattern = (String)aValue;
+      }
+      fireTableRowsUpdated(row, row);
+    }
+
+    @Override
+    public void removeRow(int idx) {
+      myModifiedPatterns.remove(idx);
+    }
+  }
+}
index f80a4ff7cdca25ff7c437250696cdf96aa1e52df..f7fde0b5b6cac7a8b8f5eb9aa35b552bd7ac5c72 100644 (file)
@@ -70,6 +70,11 @@ public class EntryPointsManagerImpl extends EntryPointsManagerBase implements Pe
     }.show();
   }
 
+  @Override
+  public void configureEntryClassPatterns() {
+    new ConfigureClassPatternsDialog(getPatterns(), myProject).show();
+  }
+
   @Override
   public JButton createConfigureAnnotationsBtn() {
     return createConfigureAnnotationsButton();
@@ -85,4 +90,15 @@ public class EntryPointsManagerImpl extends EntryPointsManagerBase implements Pe
     });
     return configureAnnotations;
   }
-}
+
+  public static JButton createConfigureClassPatternsButton() {
+    final JButton configureAnnotations = new JButton("Configure class patterns...");
+    configureAnnotations.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        getInstance(ProjectUtil.guessCurrentProject(configureAnnotations)).configureEntryClassPatterns();
+      }
+    });
+    return configureAnnotations;
+  }
+}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/ide/util/gotoByName/JavaModuleNavigationContributor.kt b/java/java-impl/src/com/intellij/ide/util/gotoByName/JavaModuleNavigationContributor.kt
new file mode 100644 (file)
index 0000000..4b689f9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.ide.util.gotoByName
+
+import com.intellij.navigation.ChooseByNameContributor
+import com.intellij.navigation.NavigationItem
+import com.intellij.openapi.project.Project
+import com.intellij.psi.impl.java.stubs.index.JavaModuleNameIndex
+import com.intellij.psi.search.ProjectScope
+import com.intellij.util.ArrayUtil
+
+class JavaModuleNavigationContributor : ChooseByNameContributor {
+  private val index = JavaModuleNameIndex.getInstance()
+
+  override fun getNames(project: Project, includeNonProjectItems: Boolean): Array<out String> {
+    val result = index.getAllKeys(project)
+    return if (result.isEmpty()) ArrayUtil.EMPTY_STRING_ARRAY else result.toTypedArray()
+  }
+
+  override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array<out NavigationItem> {
+    val scope = if (includeNonProjectItems) ProjectScope.getAllScope(project) else ProjectScope.getProjectScope(project)
+    val result = index.get(name, project, scope)
+    return if (result.isEmpty()) NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY else result.toTypedArray()
+  }
+}
\ No newline at end of file
index 87e662318e102e2035aacbb1b66b03483f8e632c..c0ac4022be1b9244c35044d55d0f3b4d75c0caed 100644 (file)
@@ -17,15 +17,15 @@ package com.intellij.lang.java;
 
 import com.intellij.lang.Language;
 import com.intellij.openapi.project.DumbService;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
+import com.intellij.psi.impl.source.PsiClassReferenceType;
 import com.intellij.refactoring.util.RefactoringDescriptionLocation;
 import com.intellij.usageView.UsageViewShortNameLocation;
 import com.intellij.xml.breadcrumbs.BreadcrumbsInfoProvider;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import static com.intellij.openapi.util.text.StringUtil.htmlEmphasize;
+import static com.intellij.openapi.util.text.StringUtil.*;
 import static com.intellij.psi.PsiNameHelper.getShortClassName;
 
 /**
@@ -47,12 +47,13 @@ public class JavaBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider {
   @Override
   public String getElementInfo(@NotNull PsiElement e) {
     if (e instanceof PsiLambdaExpression) {
-      PsiType type = DumbService.isDumb(e.getProject()) ? null : ((PsiFunctionalExpression)e).getFunctionalInterfaceType();
-      return type == null ? "->" : "-> " + getShortClassName(type.getCanonicalText());
+      boolean isDumb = DumbService.isDumb(e.getProject());
+      PsiType type = isDumb ? null : ((PsiFunctionalExpression)e).getFunctionalInterfaceType();
+      return type == null ? "->" : "-> " + getTypeText(type, false);
     }
     else if (e instanceof PsiAnonymousClass) {
       String name = ((PsiAnonymousClass)e).getBaseClassReference().getReferenceName();
-      return "new " + StringUtil.notNullize(name, "class");
+      return "new " + notNullize(name, "class");
     }
     String description = ElementDescriptionUtil.getElementDescription(e, UsageViewShortNameLocation.INSTANCE);
     String suffix = e instanceof PsiParameterListOwner? "()" : null;
@@ -73,8 +74,7 @@ public class JavaBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider {
     StringBuilder sb = new StringBuilder(e.isConstructor() ? "constructor" : "method");
     PsiType type = e.getReturnType();
     if (type != null) {
-      String shortClassName = getShortClassName(type.getCanonicalText(false));
-      sb.append(" ").append(htmlEmphasize(shortClassName));
+      sb.append(" ").append(htmlEmphasize(getTypeText(type, isDumb)));
     }
     sb.append(" ").append(htmlEmphasize(e.getName()));
     appendParameters(e, sb, false, isDumb);
@@ -87,8 +87,7 @@ public class JavaBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider {
     StringBuilder sb = new StringBuilder("lambda");
     PsiType functionalInterfaceType = isDumb ? null : e.getFunctionalInterfaceType();
     if (functionalInterfaceType != null) {
-      String shortClassName = getShortClassName(functionalInterfaceType.getCanonicalText(false));
-      sb.append(" ").append(htmlEmphasize(shortClassName));
+      sb.append(" ").append(htmlEmphasize(getTypeText(functionalInterfaceType, false)));
     }
     appendParameters(e, sb, true, isDumb);
     return sb.toString();
@@ -104,15 +103,25 @@ public class JavaBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider {
       String typeStr;
       if (isDumb) {
         PsiTypeElement typeElement = parameters[i].getTypeElement();
-        typeStr = typeElement == null ? "" : typeElement.getText();
+        typeStr = typeElement == null ? "" : getShortClassName(typeElement.getText());
       }
       else {
-        typeStr = parameters[i].getType().getCanonicalText(false);
+        typeStr = getTypeText(parameters[i].getType(), false);
       }
-      String str = getShortClassName(typeStr);
-      if (StringUtil.isEmpty(str)) str = StringUtil.notNullize(parameters[i].getName());
+      String str = isEmpty(typeStr)? notNullize(parameters[i].getName()) : getShortClassName(typeStr);
       sb.append(htmlEmphasize(str));
     }
     sb.append(")");
   }
+
+  @NotNull
+  private static String getTypeText(@Nullable PsiType type, boolean isDumb) {
+    // todo PsiTypeVisitor ?
+    String result;
+    if (type == null) result = "";
+    else if (!isDumb || type instanceof PsiPrimitiveType) result = type.getCanonicalText(false);
+    else if (type instanceof PsiClassReferenceType) result = ((PsiClassReferenceType)type).getReference().getReferenceName();
+    else result = "";
+    return getShortClassName(notNullize(result));
+  }
 }
index 91b6a723b6c053d5977061dddce7879f673daa5c..ca617621ca3037062b4fb8b9e3209c1f3d018fb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -44,12 +44,11 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class JavaFormattingModelBuilder implements FormattingModelBuilder {
-
   private static final Logger LOG = Logger.getInstance("#com.intellij.lang.java.JavaFormattingModelBuilder");
 
   @Override
   @NotNull
-    public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
+  public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
     final FileElement fileElement = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
     LOG.assertTrue(fileElement != null, "File element should not be null for " + element);
     CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
@@ -93,11 +92,11 @@ public class JavaFormattingModelBuilder implements FormattingModelBuilder {
       return current.getTextRange();
     }
   }
-  
+
   /**
    * Checks if previous non-white space leaf of the given node is error element and combines formatting range relevant for it
    * with the range of the given node.
-   * 
+   *
    * @param node  target node
    * @return      given node range if there is no error-element before it; combined range otherwise
    */
@@ -117,7 +116,7 @@ public class JavaFormattingModelBuilder implements FormattingModelBuilder {
     }
     else {
       return new TextRange(range.getStartOffset(), node.getTextRange().getEndOffset());
-    } 
+    }
   }
 
   @Nullable
@@ -126,10 +125,10 @@ public class JavaFormattingModelBuilder implements FormattingModelBuilder {
     while (result != null) {
       PsiElement psi = result.getPsi();
       if (psi instanceof PsiExpression && !(psi.getParent() instanceof PsiExpression)) {
-        return result;
+        break;
       }
       result = result.getTreeParent();
     }
     return result;
   }
-}
+}
\ No newline at end of file
index 7f6a002c2ebfb783c6619385361e33f2eef8b4c9..ca4428fa171e66ffa6b0f0532fac2199b387bbab 100644 (file)
@@ -49,7 +49,6 @@ import static com.intellij.psi.formatter.java.JavaFormatterUtil.getWrapType;
 import static com.intellij.psi.formatter.java.MultipleFieldDeclarationHelper.findLastFieldInGroup;
 
 public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlock, ReservedWrapsProvider {
-
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.formatter.java.AbstractJavaBlock");
 
   @NotNull protected final CommonCodeStyleSettings mySettings;
@@ -173,18 +172,20 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
                                 @NotNull AlignmentStrategy alignmentStrategy,
                                 int startOffset) {
     Indent actualIndent = indent == null ? getDefaultSubtreeIndent(child, getJavaIndentOptions(settings)) : indent;
-    final IElementType elementType = child.getElementType();
+    IElementType elementType = child.getElementType();
     Alignment alignment = alignmentStrategy.getAlignment(elementType);
+    PsiElement childPsi = child.getPsi();
 
-    if (child.getPsi() instanceof PsiWhiteSpace) {
+    if (childPsi instanceof PsiWhiteSpace) {
       String text = child.getText();
       int start = CharArrayUtil.shiftForward(text, 0, " \t\n");
       int end = CharArrayUtil.shiftBackward(text, text.length() - 1, " \t\n") + 1;
       LOG.assertTrue(start < end);
-      return new PartialWhitespaceBlock(child, new TextRange(start + child.getStartOffset(), end + child.getStartOffset()),
-                                        wrap, alignment, actualIndent, settings, javaSettings);
+      TextRange range = new TextRange(start + child.getStartOffset(), end + child.getStartOffset());
+      return new PartialWhitespaceBlock(child, range, wrap, alignment, actualIndent, settings, javaSettings);
     }
-    if (child.getPsi() instanceof PsiClass) {
+
+    if (childPsi instanceof PsiClass) {
       return new CodeBlockBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
     }
     if (child.getElementType() == JavaElementType.METHOD) {
@@ -228,8 +229,8 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
 
   @NotNull
   public static Block newJavaBlock(@NotNull ASTNode child,
-                                      @NotNull CommonCodeStyleSettings settings,
-                                      @NotNull JavaCodeStyleSettings javaSettings) {
+                                   @NotNull CommonCodeStyleSettings settings,
+                                   @NotNull JavaCodeStyleSettings javaSettings) {
     final Indent indent = getDefaultSubtreeIndent(child, getJavaIndentOptions(settings));
     return newJavaBlock(child, settings, javaSettings, indent, null, AlignmentStrategy.getNullStrategy());
   }
@@ -602,7 +603,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
     return child;
   }
 
-  private boolean isInsideMethodCall(@NotNull PsiElement element) {
+  private static boolean isInsideMethodCall(@NotNull PsiElement element) {
     PsiElement e = element.getParent();
     int parentsVisited = 0;
     while (e != null && !(e instanceof PsiStatement) && parentsVisited < 5) {
@@ -816,7 +817,6 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
    * @return        alignment to use for the given node
    * @see CodeStyleSettings#ALIGN_GROUP_FIELD_DECLARATIONS
    */
-  @Nullable
   private boolean shouldAlignFieldInColumns(@NotNull ASTNode child) {
     // The whole idea of variable declarations alignment is that complete declaration blocks which children are to be aligned hold
     // reference to the same AlignmentStrategy object, hence, reuse the same Alignment objects. So, there is no point in checking
@@ -940,7 +940,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
     return prev;
   }
 
-  private boolean isInsideMethodCallParenthesis(ASTNode child) {
+  private static boolean isInsideMethodCallParenthesis(ASTNode child) {
     ASTNode currentPredecessor = child.getTreeParent();
     if (currentPredecessor != null) {
       currentPredecessor = currentPredecessor.getTreeParent();
@@ -1054,9 +1054,8 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
     }
 
     final int braceStyle = getBraceStyle();
-    return braceStyle == CommonCodeStyleSettings.NEXT_LINE_SHIFTED ?
-           createNormalIndent(baseChildrenIndent - 1, enforceParentIndent)
-           : createNormalIndent(baseChildrenIndent, enforceParentIndent);
+    final int shift = braceStyle == CommonCodeStyleSettings.NEXT_LINE_SHIFTED ? 1 : 0;
+    return createNormalIndent(baseChildrenIndent - shift, enforceParentIndent);
   }
 
   protected static Indent createNormalIndent(final int baseChildrenIndent) {
@@ -1278,6 +1277,6 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
   public SyntheticCodeBlock createCodeBlockBlock(final List<Block> localResult, final Indent indent, final int childrenIndent) {
     final SyntheticCodeBlock result = new SyntheticCodeBlock(localResult, null, getSettings(), myJavaSettings, indent, null);
     result.setChildAttributes(new ChildAttributes(getCodeBlockInternalIndent(childrenIndent), null));
-    return result;  
+    return result;
   }
-}
+}
\ No newline at end of file
index e80774e7d312f89a3588ab156455e377115d2b79..a1d9e1ff7feda4349f155ee94fd7590699845492 100644 (file)
@@ -41,9 +41,6 @@ class ChainMethodCallsBlockBuilder {
   private final Alignment myBlockAlignment;
   private final Indent myBlockIndent;
 
-  private Wrap myWrap;
-  private Alignment myChainedCallsAlignment;
-
   public ChainMethodCallsBlockBuilder(Alignment alignment,
                                       Wrap wrap,
                                       Indent indent,
@@ -68,26 +65,28 @@ class ChainMethodCallsBlockBuilder {
   private List<Block> buildBlocksFrom(List<ASTNode> nodes) {
     List<ChainedCallChunk> methodCall = splitMethodCallOnChunksByDots(nodes);
 
-    myWrap = null;
-    myChainedCallsAlignment = null;
+    Wrap wrap = null;
+    Alignment chainedCallsAlignment = null;
 
-    List<Block> blocks = new ArrayList<Block>();
+    List<Block> blocks = new ArrayList<>();
 
     for (int i = 0; i < methodCall.size(); i++) {
       ChainedCallChunk currentCallChunk = methodCall.get(i);
       if (isMethodCall(currentCallChunk) || isComment(currentCallChunk)) {
-        if (myWrap == null)
-          myWrap = createCallChunkWrap(i, methodCall);
-        if (myChainedCallsAlignment == null)
-          myChainedCallsAlignment = createCallChunkAlignment(i, methodCall);
+        if (wrap == null) {
+          wrap = createCallChunkWrap(i, methodCall); 
+        }
+        if (chainedCallsAlignment == null) {
+          chainedCallsAlignment = createCallChunkAlignment(i, methodCall);
+        }
       }
       else {
-        myWrap = null;
-        myChainedCallsAlignment = null;
+        wrap = null;
+        chainedCallsAlignment = null;
       }
 
       CallChunkBlockBuilder builder = new CallChunkBlockBuilder(mySettings, myJavaSettings);
-      blocks.add(builder.create(currentCallChunk.nodes, myWrap, myChainedCallsAlignment));
+      blocks.add(builder.create(currentCallChunk.nodes, wrap, chainedCallsAlignment));
     }
 
     return blocks;
@@ -118,24 +117,29 @@ class ChainMethodCallsBlockBuilder {
            && !chunkIsFirstInChainMethodCall(currentMethodChunk, methodCall);
   }
 
-  private boolean chunkIsFirstInChainMethodCall(@NotNull ChainedCallChunk callChunk, @NotNull List<ChainedCallChunk> methodCall) {
+  private static boolean chunkIsFirstInChainMethodCall(@NotNull ChainedCallChunk callChunk, @NotNull List<ChainedCallChunk> methodCall) {
     return !methodCall.isEmpty() && callChunk == methodCall.get(0);
   }
 
   @NotNull
-  private List<ChainedCallChunk> splitMethodCallOnChunksByDots(@NotNull List<ASTNode> nodes) {
-    List<ChainedCallChunk> result = new ArrayList<ChainedCallChunk>();
+  private static List<ChainedCallChunk> splitMethodCallOnChunksByDots(@NotNull List<ASTNode> nodes) {
+    List<ChainedCallChunk> result = new ArrayList<>();
 
-    List<ASTNode> current = new ArrayList<ASTNode>();
+    List<ASTNode> current = new ArrayList<>();
     for (ASTNode node : nodes) {
       if (node.getElementType() == JavaTokenType.DOT || node.getPsi() instanceof PsiComment) {
-        result.add(new ChainedCallChunk(current));
-        current = new ArrayList<ASTNode>();
+        if (!current.isEmpty()) {
+          result.add(new ChainedCallChunk(current));
+        }
+        current = new ArrayList<>();
       }
       current.add(node);
     }
-
-    result.add(new ChainedCallChunk(current));
+    
+    if (!current.isEmpty()) {
+      result.add(new ChainedCallChunk(current));
+    }
+    
     return result;
   }
 
@@ -146,7 +150,7 @@ class ChainMethodCallsBlockBuilder {
            : null;
   }
 
-  private boolean isMethodCall(@NotNull ChainedCallChunk callChunk) {
+  private static boolean isMethodCall(@NotNull ChainedCallChunk callChunk) {
     List<ASTNode> nodes = callChunk.nodes;
     return nodes.size() >= 3 && nodes.get(2).getElementType() == JavaElementType.EXPRESSION_LIST;
   }
index 845f8bf3a60339e222739f4c489533cf2f05722f..a65f3ea799068c52c14fb48061ca33e2d729a725 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -92,17 +92,16 @@ public class CodeBlockBlock extends AbstractJavaBlock {
 
   @Override
   protected List<Block> buildChildren() {
-    final ArrayList<Block> result = new ArrayList<Block>();
+    final List<Block> result = new ArrayList<Block>();
     Alignment childAlignment = createChildAlignment();
     Wrap childWrap = createChildWrap();
 
     buildChildren(result, childAlignment, childWrap);
 
     return result;
-
   }
 
-  private void buildChildren(final ArrayList<Block> result, final Alignment childAlignment, final Wrap childWrap) {
+  private void buildChildren(final List<Block> result, final Alignment childAlignment, final Wrap childWrap) {
     ASTNode child = myNode.getFirstChildNode();
 
     int state = BEFORE_FIRST;
@@ -140,11 +139,11 @@ public class CodeBlockBlock extends AbstractJavaBlock {
   }
 
   @Nullable
-  private ASTNode processCaseAndStatementAfter(final ArrayList<Block> result,
+  private ASTNode processCaseAndStatementAfter(final List<Block> result,
                                                ASTNode child,
                                                final Alignment childAlignment,
                                                final Wrap childWrap, final Indent indent) {
-    final ArrayList<Block> localResult = new ArrayList<Block>();
+    final List<Block> localResult = new ArrayList<Block>();
     processChild(localResult, child, AlignmentStrategy.getNullStrategy(), null, Indent.getNoneIndent());
     child = child.getTreeNext();
     Indent childIndent = Indent.getNormalIndent();
@@ -179,7 +178,9 @@ public class CodeBlockBlock extends AbstractJavaBlock {
     return JavaElementType.BREAK_STATEMENT == elementType || JavaElementType.RETURN_STATEMENT == elementType;
   }
 
-  private SyntheticCodeBlock createCaseSectionBlock(final ArrayList<Block> localResult, final Alignment childAlignment, final Indent indent,
+  private SyntheticCodeBlock createCaseSectionBlock(final List<Block> localResult,
+                                                    final Alignment childAlignment,
+                                                    final Indent indent,
                                                     final Wrap childWrap) {
     final SyntheticCodeBlock result = new SyntheticCodeBlock(localResult, childAlignment, getSettings(), myJavaSettings, indent, childWrap) {
       @Override
@@ -286,4 +287,4 @@ public class CodeBlockBlock extends AbstractJavaBlock {
       }
     }
   }
-}
+}
\ No newline at end of file
index dabcbfc8f99182fc51892b76c6694399b6e811ec..375d91b8f441f1196c9fad6b62cea60f1bf08cb5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
       myResult = Spacing.getReadOnlySpacing();
       return;
     }
-    
+
     init(child);
     mySettings = settings;
     myJavaSettings = javaSettings;
@@ -108,24 +108,22 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
         myResult = Spacing.createSpacing(0, Integer.MAX_VALUE, 0,  true, mySettings.KEEP_BLANK_LINES_IN_CODE);
       }
     }
-    else {
+    else if (myParent != null) {
+      myParent.accept(this);
 
-      if (myParent != null) {
-        myParent.accept(this);
-        if (myResult == null) {
-          final ASTNode prev = getPrevElementType(myChild2);
-          if (prev != null && prev.getElementType() == JavaTokenType.END_OF_LINE_COMMENT) {
-            myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
-          }
-          else if (!canStickChildrenTogether(myChild1, myChild2)) {
-            myResult = Spacing.createSpacing(1, Integer.MIN_VALUE, 0, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
-          }
-          else if (myChild1.getElementType() == JavaTokenType.C_STYLE_COMMENT){
-            myResult = null;
-          }
-          else if (!shouldKeepSpace(myParent)){
-            myResult = Spacing.createSpacing(0, 0, 0, true, mySettings.KEEP_BLANK_LINES_IN_CODE);
-          }
+      if (myResult == null) {
+        final ASTNode prev = getPrevElementType(myChild2);
+        if (prev != null && prev.getElementType() == JavaTokenType.END_OF_LINE_COMMENT) {
+          myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
+        }
+        else if (!canStickChildrenTogether(myChild1, myChild2)) {
+          myResult = Spacing.createSpacing(1, Integer.MIN_VALUE, 0, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
+        }
+        else if (myChild1.getElementType() == JavaTokenType.C_STYLE_COMMENT) {
+          myResult = null;
+        }
+        else if (!shouldKeepSpace(myParent)) {
+          myResult = Spacing.createSpacing(0, 0, 0, true, mySettings.KEEP_BLANK_LINES_IN_CODE);
         }
       }
     }
@@ -287,10 +285,10 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     final int space = mySettings.SPACE_BEFORE_METHOD_LBRACE ? 1 : 0;
     final int methodBraceStyle = mySettings.METHOD_BRACE_STYLE;
 
-    if (methodBraceStyle == CommonCodeStyleSettings.END_OF_LINE) {
+    if (methodBraceStyle == END_OF_LINE) {
       return createNonLFSpace(space, null, false);
     }
-    else if (methodBraceStyle == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED) {
+    else if (methodBraceStyle == NEXT_LINE_IF_WRAPPED) {
       TextRange headerRange = new TextRange(getMethodHeaderStartOffset(method), getMethodHeaderEndOffset(method));
       return createNonLFSpace(space, headerRange, false);
     }
@@ -315,10 +313,10 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     final int space = mySettings.SPACE_BEFORE_CLASS_LBRACE ? 1 : 0;
     final int classBraceStyle = mySettings.CLASS_BRACE_STYLE;
 
-    if (classBraceStyle == CommonCodeStyleSettings.END_OF_LINE || shouldHandleAsSimpleClass(aClass)) {
+    if (classBraceStyle == END_OF_LINE || shouldHandleAsSimpleClass(aClass)) {
       return createNonLFSpace(space, null, false);
     }
-    else if (classBraceStyle == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED) {
+    else if (classBraceStyle == NEXT_LINE_IF_WRAPPED) {
       final PsiIdentifier nameIdentifier = aClass.getNameIdentifier();
       final int startOffset = nameIdentifier == null ? myParent.getTextRange().getStartOffset() : nameIdentifier.getTextRange().getStartOffset();
       TextRange range = new TextRange(startOffset, myChild1.getTextRange().getEndOffset());
@@ -331,10 +329,10 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
   private Spacing getSpaceBeforeLBrace(@NotNull ASTNode lBraceBlock, boolean spaceBeforeLbrace, @Nullable TextRange nextLineIfWrappedOptionRange) {
     int space = spaceBeforeLbrace ? 1 : 0;
 
-    if (mySettings.BRACE_STYLE == CommonCodeStyleSettings.END_OF_LINE) {
+    if (mySettings.BRACE_STYLE == END_OF_LINE) {
       return createNonLFSpace(space, null, false);
     }
-    else if (mySettings.BRACE_STYLE == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED) {
+    else if (mySettings.BRACE_STYLE == NEXT_LINE_IF_WRAPPED) {
       return createNonLFSpace(space, nextLineIfWrappedOptionRange, false);
     }
     else if (shouldHandleAsSimpleBlock(lBraceBlock)) {
@@ -356,7 +354,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
       }
 
       PsiElement betweenBraces = lBrace.getNextSibling();
-      if (betweenBraces == rBrace || isWhiteSpaceWithoutLinefeeds(betweenBraces) && betweenBraces.getNextSibling() == rBrace) {
+      if (betweenBraces == rBrace || isWhiteSpaceWithoutLineFeeds(betweenBraces) && betweenBraces.getNextSibling() == rBrace) {
         return true;
       }
     }
@@ -364,13 +362,13 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     return false;
   }
 
-  private static boolean isWhiteSpaceWithoutLinefeeds(@Nullable PsiElement betweenBraces) {
+  private static boolean isWhiteSpaceWithoutLineFeeds(@Nullable PsiElement betweenBraces) {
     return betweenBraces instanceof PsiWhiteSpace && !betweenBraces.textContains('\n');
   }
 
   private boolean shouldHandleAsSimpleBlock(@NotNull ASTNode node) {
     if (!mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE) return false;
-    
+
     PsiElement prev = node.getPsi().getPrevSibling();
     if (prev instanceof PsiWhiteSpace && prev.textContains('\n')) {
       return false;
@@ -398,7 +396,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
   private static boolean isEndOfLineCommentAfterLBrace(@NotNull ASTNode node) {
     if (node.getPsi() instanceof PsiComment) {
       PsiElement ws = node.getPsi().getPrevSibling();
-      if (isWhiteSpaceWithoutLinefeeds(ws)) {
+      if (isWhiteSpaceWithoutLineFeeds(ws)) {
         PsiElement beforeWs = ws.getPrevSibling();
         if (beforeWs instanceof PsiJavaToken && ((PsiJavaToken)beforeWs).getTokenType() == JavaTokenType.LBRACE) {
           return true;
@@ -418,6 +416,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     return true;
   }
 
+  @SuppressWarnings("StatementWithEmptyBody")
   private void processClassBody() {
     if (myChild1 instanceof JspJavaComment || myChild2 instanceof JspJavaComment) {
       myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, 0);
@@ -473,7 +472,6 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     }
 
     else if (myRole2 == ChildRole.FIELD) {
-
       if (myRole1 == ChildRole.COMMA) {
         createSpaceProperty(true, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
       }
@@ -650,8 +648,8 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
         ElementType.IMPORT_STATEMENT_BASE_BIT_SET.contains(myChild2.getElementType())) {
       if (myImportHelper == null) myImportHelper = new ImportHelper(mySettings.getRootSettings());
       int emptyLines = myImportHelper.getEmptyLinesBetween(
-        SourceTreeToPsiMap.<PsiImportStatementBase>treeToPsiNotNull(myChild1),
-        SourceTreeToPsiMap.<PsiImportStatementBase>treeToPsiNotNull(myChild2)
+        SourceTreeToPsiMap.treeToPsiNotNull(myChild1),
+        SourceTreeToPsiMap.treeToPsiNotNull(myChild2)
       ) + 1;
       myResult = Spacing.createSpacing(0, 0, emptyLines,
                                        mySettings.KEEP_LINE_BREAKS,
@@ -767,7 +765,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
 
     if (myRole2 == ChildRole.TRY_BLOCK) {
       TextRange dependentRange = null;
-      if (myChild1 instanceof PsiResourceList && mySettings.BRACE_STYLE == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED) {
+      if (myChild1 instanceof PsiResourceList && mySettings.BRACE_STYLE == NEXT_LINE_IF_WRAPPED) {
           dependentRange = myChild1.getTextRange();
       }
       myResult = getSpaceBeforeLBrace(myChild2, mySettings.SPACE_BEFORE_TRY_LBRACE, dependentRange);
@@ -789,23 +787,12 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
       createSpaceInCode(mySettings.SPACE_WITHIN_FOR_PARENTHESES);
     }
     else if (myRole1 == ChildRole.FOR_ITERATION_PARAMETER && myRole2 == ChildRole.COLON ||
-             myRole1 == ChildRole.COLON && myRole2 == ChildRole.FOR_ITERATED_VALUE)
-    {
+             myRole1 == ChildRole.COLON && myRole2 == ChildRole.FOR_ITERATED_VALUE) {
       createSpaceInCode(true);
     }
     else if (myRole2 == ChildRole.LOOP_BODY) {
-      if (myChild2.getElementType() == JavaElementType.BLOCK_STATEMENT) {
-        myResult = getSpaceBeforeLBrace(myChild2, mySettings.SPACE_BEFORE_FOR_LBRACE, null);
-      }
-      else if (mySettings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE) {
-        myResult = Spacing.createDependentLFSpacing(1, 1, myParent.getTextRange(), false, mySettings.KEEP_BLANK_LINES_IN_CODE);
-      }
-      else {
-        myResult = Spacing.createSpacing(0, 0, 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
-      }
-
+      processLoopBody();
     }
-
   }
 
   @Override
@@ -969,7 +956,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     else if (myChild2.getElementType() == JavaElementType.BLOCK_STATEMENT || myChild2.getElementType() == JavaElementType.CODE_BLOCK) {
       boolean space = myRole2 == ChildRole.ELSE_BRANCH ? mySettings.SPACE_BEFORE_ELSE_LBRACE
                                                        : mySettings.SPACE_BEFORE_IF_LBRACE;
-      
+
       TextRange dependentRange = null;
       if (myRole2 == ChildRole.THEN_BRANCH) {
         PsiExpression condition = statement.getCondition();
@@ -1139,8 +1126,8 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     else if (myRole1 == ChildRole.MODIFIER_LIST && myRole2 == ChildRole.PACKAGE_KEYWORD) {
       myResult = Spacing.createSpacing(1, 1, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
     }
-    else if (myRole2 == ChildRole.TYPE 
-             && myChild1.getLastChildNode() != null 
+    else if (myRole2 == ChildRole.TYPE
+             && myChild1.getLastChildNode() != null
              && myChild1.getLastChildNode().getElementType() == JavaElementType.ANNOTATION) {
       createSpaceProperty(true, mySettings.KEEP_LINE_BREAKS, 0);
     }
@@ -1303,7 +1290,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
   @Override
   public void visitLambdaExpression(PsiLambdaExpression expression) {
     boolean spaceAroundArrow = mySettings.SPACE_AROUND_LAMBDA_ARROW;
-    
+
     if (myRole1 == ChildRole.PARAMETER_LIST && myRole2 == ChildRole.ARROW) {
       createSpaceInCode(spaceAroundArrow);
     }
@@ -1312,7 +1299,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
         switch (mySettings.BRACE_STYLE) {
           case NEXT_LINE:
           case NEXT_LINE_SHIFTED:
-          case NEXT_LINE_SHIFTED2:  
+          case NEXT_LINE_SHIFTED2:
             int space = spaceAroundArrow ? 1 : 0;
             myResult = Spacing.createSpacing(space, space, 1, false, 0);
             break;
@@ -1379,15 +1366,19 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
       createSpaceInCode(mySettings.SPACE_AFTER_SEMICOLON);
     }
     else if (myRole2 == ChildRole.LOOP_BODY || myChild2.getElementType() == JavaElementType.CODE_BLOCK) {
-      if (myChild2.getElementType() == JavaElementType.BLOCK_STATEMENT) {
-        myResult = getSpaceBeforeLBrace(myChild2, mySettings.SPACE_BEFORE_FOR_LBRACE, null);
-      }
-      else if (mySettings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE) {
-        myResult = Spacing.createDependentLFSpacing(1, 1, myParent.getTextRange(), false, mySettings.KEEP_BLANK_LINES_IN_CODE);
-      }
-      else {
-        myResult = Spacing.createSpacing(0, 0, 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
-      }
+      processLoopBody();
+    }
+  }
+
+  protected void processLoopBody() {
+    if (myChild2.getElementType() == JavaElementType.BLOCK_STATEMENT) {
+      myResult = getSpaceBeforeLBrace(myChild2, mySettings.SPACE_BEFORE_FOR_LBRACE, null);
+    }
+    else if (mySettings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE) {
+      myResult = Spacing.createDependentLFSpacing(1, 1, myParent.getTextRange(), false, mySettings.KEEP_BLANK_LINES_IN_CODE);
+    }
+    else {
+      myResult = Spacing.createSpacing(0, 0, 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
     }
   }
 
@@ -1491,8 +1482,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
              || myRole2 == ChildRole.EXTENDS_KEYWORD
              || myRole1 == ChildRole.IMPLEMENTS_KEYWORD
              || myRole2 == ChildRole.IMPLEMENTS_KEYWORD
-             || myRole1 == ChildRole.THROWS_KEYWORD)
-    {
+             || myRole1 == ChildRole.THROWS_KEYWORD) {
       createSpaceInCode(true);
     }
   }
@@ -1675,7 +1665,6 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
                            : mySettings.SPACE_WITHIN_EMPTY_ARRAY_INITIALIZER_BRACES;
         createSpaceProperty(addSpace, mySettings.KEEP_BLANK_LINES_IN_CODE);
       }
-
     }
     else if (myRole2 == ChildRole.LBRACE) {
       createSpaceInCode(mySettings.SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE);
@@ -1715,13 +1704,12 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     }
   }
 
-
   @Override
   public void visitAssertStatement(PsiAssertStatement statement) {
     if (myChild1.getElementType() == JavaTokenType.ASSERT_KEYWORD) {
       createSpaceInCode(true);
     }
-    else if (myChild1.getElementType() == JavaTokenType.COLON){
+    else if (myChild1.getElementType() == JavaTokenType.COLON) {
       createSpaceInCode(mySettings.SPACE_AFTER_COLON);
     }
     else if (myChild2.getElementType() == JavaTokenType.COLON) {
@@ -1729,7 +1717,6 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     }
   }
 
-
   @Override
   public void visitParameter(PsiParameter parameter) {
     if (myRole1 == ChildRole.TYPE || myRole1 == ChildRole.MODIFIER_LIST) {
@@ -1757,8 +1744,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     return lastChild != null && lastChild.getElementType() == TokenType.WHITE_SPACE;
   }
 
-  private static final Map<Pair<IElementType, IElementType>, Boolean> myCanStickJavaTokensMatrix =
-    ContainerUtil.newConcurrentMap();
+  private static final Map<Pair<IElementType, IElementType>, Boolean> myCanStickJavaTokensMatrix = ContainerUtil.newConcurrentMap();
 
   public static boolean canStickChildrenTogether(final ASTNode child1, final ASTNode child2) {
     if (child1 == null || child2 == null) return true;
@@ -1770,8 +1756,9 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     LOG.assertTrue(token1 != null);
     LOG.assertTrue(token2 != null);
 
-    return !(token1.getElementType() instanceof IJavaElementType && token2.getElementType()instanceof IJavaElementType) ||
-           canStickJavaTokens(token1,token2);
+    return !(token1.getElementType() instanceof IJavaElementType) ||
+           !(token2.getElementType() instanceof IJavaElementType) ||
+           canStickJavaTokens(token1, token2);
   }
 
   private static boolean canStickJavaTokens(ASTNode token1, ASTNode token2) {
index e4989828d36317b2c51f3ab8f82e08a167188638..784da4e17cdd8dd602c74121542a4d424ac7ddc5 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.
@@ -27,6 +27,7 @@ import com.intellij.openapi.roots.SourceFolder;
 import com.intellij.openapi.roots.ui.configuration.SourceRootPresentation;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
 import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
 import com.intellij.psi.JavaDirectoryService;
 import com.intellij.psi.PsiDirectory;
@@ -61,6 +62,9 @@ public class JavaDirectoryIconProvider extends IconProvider implements DumbAware
       else if ((sourceFolder = ProjectRootsUtil.getModuleSourceRoot(vFile, project)) != null) {
         symbolIcon = SourceRootPresentation.getSourceRootIcon(sourceFolder);
       }
+      else if (JrtFileSystem.isModuleRoot(vFile)) {
+        symbolIcon = AllIcons.Nodes.JavaModuleRoot;
+      }
       else if (JavaDirectoryService.getInstance().getPackage(psiDirectory) != null) {
         symbolIcon = PlatformIcons.PACKAGE_ICON;
       }
@@ -76,4 +80,4 @@ public class JavaDirectoryIconProvider extends IconProvider implements DumbAware
 
     return null;
   }
-}
+}
\ No newline at end of file
index ec9dd94b0e43d83fd9e9115a28b4720256e167e4..0f08ad6a9bd85b1164cd6aae0f4c1671f87ec11b 100644 (file)
@@ -45,8 +45,10 @@ import com.intellij.usageView.UsageInfo;
 import com.intellij.util.*;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.MultiMap;
 import com.intellij.util.graph.DFSTBuilder;
 import com.intellij.util.graph.GraphGenerator;
+import gnu.trove.THashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.TestOnly;
@@ -278,14 +280,20 @@ public class TypeMigrationLabeler {
 
   class MigrationProducer {
     private final Map<UsageInfo, Object> myRemainConversions;
+    private final MultiMap<PsiTypeElement, TypeMigrationUsageInfo> myVariableMigration = new MultiMap<PsiTypeElement, TypeMigrationUsageInfo>() {
+      @NotNull
+      @Override
+      protected Map<PsiTypeElement, Collection<TypeMigrationUsageInfo>> createMap() {
+        return new THashMap<>();
+      }
+    };
 
     private MigrationProducer(Map<UsageInfo, Object> conversions) {
       myRemainConversions = conversions;
     }
 
     public void change(@NotNull final TypeMigrationUsageInfo usageInfo,
-                       @NotNull Consumer<PsiNewExpression> consumer,
-                       @NotNull TypeMigrationLabeler labeler) {
+                       @NotNull Consumer<PsiNewExpression> consumer) {
       final PsiElement element = usageInfo.getElement();
       if (element == null) return;
       final Project project = element.getProject();
@@ -321,6 +329,11 @@ public class TypeMigrationLabeler {
           }
         }
       }
+      else if ((element instanceof PsiField || element instanceof PsiLocalVariable) &&
+               isMultiVariableDeclaration((PsiVariable)element)) {
+        final PsiTypeElement typeElement = ((PsiVariable)element).getTypeElement();
+        myVariableMigration.putValue(typeElement, usageInfo);
+      }
       else {
         TypeMigrationReplacementUtil.migrateMemberOrVariableType(element, project, getTypeEvaluator().getType(usageInfo));
         if (usageInfo instanceof OverridenUsageInfo) {
@@ -332,9 +345,62 @@ public class TypeMigrationLabeler {
       }
     }
 
+    public void flush() {
+      for (Map.Entry<PsiTypeElement, Collection<TypeMigrationUsageInfo>> entry : myVariableMigration.entrySet()) {
+        final PsiTypeElement typeElement = entry.getKey();
+        if (!typeElement.isValid()) continue;
+        final Collection<TypeMigrationUsageInfo> migrations = entry.getValue();
+        if (migrations.size() != 1) {
+          MultiMap<PsiType, PsiVariable> variablesByMigrationType = new MultiMap<>();
+          for (TypeMigrationUsageInfo migration : migrations) {
+            final PsiElement var = migration.getElement();
+            if (var == null || !(var instanceof PsiLocalVariable || var instanceof PsiField)) {
+              continue;
+            }
+            final PsiType type = getTypeEvaluator().getType(migration);
+            variablesByMigrationType.putValue(type, (PsiVariable)var);
+          }
+          if (variablesByMigrationType.size() == 1) {
+            final Map.Entry<PsiType, Collection<PsiVariable>> migrationTypeAndVariables =
+              ContainerUtil.getFirstItem(variablesByMigrationType.entrySet());
+            LOG.assertTrue(migrationTypeAndVariables != null);
+            final PsiVariable[] variables = PsiTreeUtil.getChildrenOfType(typeElement.getParent().getParent(), PsiVariable.class);
+            if (variables != null && variables.length == migrationTypeAndVariables.getValue().size()) {
+              try {
+                PsiType migrationType = migrationTypeAndVariables.getKey();
+                final Project project = variables[0].getProject();
+                migrationType = TypeMigrationReplacementUtil.revalidateType(migrationType, project);
+                typeElement.replace(JavaPsiFacade.getElementFactory(project).createTypeElement(migrationType));
+              }
+              catch (IncorrectOperationException e) {
+                LOG.error(e);
+              }
+              continue;
+            }
+          }
+        }
+        for (TypeMigrationUsageInfo info : entry.getValue()) migrateMultiDeclarationVariable(info);
+      }
+    }
+
+    private void migrateMultiDeclarationVariable(TypeMigrationUsageInfo varUsageInfo) {
+      final PsiElement var = varUsageInfo.getElement();
+      if (var == null || !(var instanceof PsiLocalVariable || var instanceof PsiField)) return;
+      ((PsiVariable) var).normalizeDeclaration();
+      TypeMigrationReplacementUtil.migrateMemberOrVariableType(var, var.getProject(), getTypeEvaluator().getType(varUsageInfo));
+    }
+
     Object getConversion(UsageInfo info) {
       return myRemainConversions.remove(info);
     }
+
+    private boolean isMultiVariableDeclaration(PsiVariable variable) {
+      final PsiElement parent = variable.getParent();
+      LOG.assertTrue(parent != null);
+      final PsiVariable[] variables = PsiTreeUtil.getChildrenOfType(parent, PsiVariable.class);
+      LOG.assertTrue(variables != null);
+      return variables.length != 1;
+    }
   }
 
   void postProcessNewExpression(@NotNull PsiNewExpression expression) {
index 3e4ae14f1a7097f25a7170bcee99c0da2d5d56a1..42129652c07bc1ee8c9644b1fbae98ec4f962159 100644 (file)
@@ -228,11 +228,6 @@ public class TypeMigrationProcessor extends BaseRefactoringProcessor {
 
   @Override
   public void performRefactoring(@NotNull UsageInfo[] usages) {
-    for (PsiElement element : myRoot) {
-      if (element instanceof PsiVariable && ((PsiVariable)element).getTypeElement() != null) {
-        ((PsiVariable)element).normalizeDeclaration();
-      }
-    }
     change(usages, myLabeler, myProject);
   }
 
@@ -250,8 +245,8 @@ public class TypeMigrationProcessor extends BaseRefactoringProcessor {
           element instanceof PsiExpression ||
           element instanceof PsiReferenceParameterList) {
         producer.change((TypeMigrationUsageInfo)usage,
-                        expression -> newExpressionsToCheckDiamonds.add(smartPointerManager.createSmartPsiElementPointer(expression)),
-                        labeler);
+                        expression -> newExpressionsToCheckDiamonds.add(smartPointerManager.createSmartPsiElementPointer(expression))
+        );
       }
       else {
         nonCodeUsages.add(usage);
@@ -280,6 +275,8 @@ public class TypeMigrationProcessor extends BaseRefactoringProcessor {
         }
       }
     }
+
+    producer.flush();
   }
 
   public TypeMigrationLabeler getLabeler() {
index 6dde6d91f02195607adae2aaa59c26c2fed37918..d143164c30607b4592f8ca9f8706b951a042745c 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.psi.impl.source.tree.CompositeElement;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.typeMigration.usageInfo.TypeMigrationUsageInfo;
 import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Map;
@@ -114,11 +115,16 @@ public class TypeMigrationReplacementUtil {
     return expression;
   }
 
+  static PsiType revalidateType(@NotNull PsiType migrationType, @NotNull Project project) {
+    if (!migrationType.isValid()) {
+      migrationType = JavaPsiFacade.getElementFactory(project).createTypeByFQClassName(migrationType.getCanonicalText());
+    }
+    return migrationType;
+  }
+
   static void migrateMemberOrVariableType(final PsiElement element, final Project project, PsiType migratedType) {
     try {
-      if (!migratedType.isValid()) {
-        migratedType = JavaPsiFacade.getElementFactory(project).createTypeByFQClassName(migratedType.getCanonicalText());
-      }
+      migratedType = revalidateType(migratedType, project);
       final PsiTypeElement typeElement = JavaPsiFacade.getInstance(project).getElementFactory().createTypeElement(migratedType);
       if (element instanceof PsiMethod) {
         final PsiTypeElement returnTypeElement = ((PsiMethod)element).getReturnTypeElement();
index 3656ce32aba516b48366eb9db06f486495179bf8..37a2d2b332ecd70f550345b551a84e522632f9e1 100644 (file)
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
  *
  * @since 2016.3
  */
-public interface PsiJavaModule extends PsiElement {
+public interface PsiJavaModule extends NavigatablePsiElement {
   String MODULE_INFO_CLASS = "module-info";
   String MODULE_INFO_FILE = MODULE_INFO_CLASS + ".java";
 
index 38f44262e0628e455df4a2ec9dc84f86a65f3dc1..81f530496307416fcc6a563959f7ca20c34d2aed 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.
@@ -27,6 +27,7 @@ import com.intellij.psi.codeStyle.VariableKind;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -44,7 +45,8 @@ public class PropertyUtil {
   private PropertyUtil() {
   }
 
-  public static boolean isSimplePropertyGetter(@NotNull PsiMethod method) {
+  @Contract("null -> false")
+  public static boolean isSimplePropertyGetter(@Nullable PsiMethod method) {
     return hasGetterName(method) && method.getParameterList().getParametersCount() == 0;
   }
 
index 765db7903e6260b6223acbdb460b481be9aa90b6..1ffd1211b82fff070956f7415ac8dcc40b0e1f34 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -25,8 +25,11 @@ import org.jetbrains.annotations.NotNull;
  * @author yole
  */
 public class JavaHighlightUsagesDescriptionProvider implements ElementDescriptionProvider {
+  private static final int METHOD_FLAGS = PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS | PsiFormatUtilBase.SHOW_CONTAINING_CLASS;
+  private static final int VARIABLE_FLAGS = PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_CONTAINING_CLASS;
+
   @Override
-  public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
+  public String getElementDescription(@NotNull PsiElement element, @NotNull ElementDescriptionLocation location) {
     if (!(location instanceof HighlightUsagesDescriptionLocation)) return null;
 
     String elementName = null;
@@ -35,35 +38,29 @@ public class JavaHighlightUsagesDescriptionProvider implements ElementDescriptio
       if (elementName == null) {
         elementName = ((PsiClass)element).getName();
       }
-      elementName = (((PsiClass)element).isInterface() ?
-                     LangBundle.message("java.terms.interface") :
-                     LangBundle.message("java.terms.class")) + " " + elementName;
+      elementName = (LangBundle.message(((PsiClass)element).isInterface() ? "java.terms.interface" : "java.terms.class")) + ' ' + elementName;
     }
     else if (element instanceof PsiMethod) {
-      elementName = PsiFormatUtil.formatMethod((PsiMethod)element,
-                                               PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS |
-                                                                     PsiFormatUtilBase.SHOW_CONTAINING_CLASS,
-                                               PsiFormatUtilBase.SHOW_TYPE);
-      elementName = LangBundle.message("java.terms.method") + " " + elementName;
+      elementName = PsiFormatUtil.formatMethod((PsiMethod)element, PsiSubstitutor.EMPTY, METHOD_FLAGS, PsiFormatUtilBase.SHOW_TYPE);
+      elementName = LangBundle.message("java.terms.method") + ' ' + elementName;
     }
     else if (element instanceof PsiVariable) {
-      elementName = PsiFormatUtil.formatVariable((PsiVariable)element,
-                                                 PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_CONTAINING_CLASS,
-                                                 PsiSubstitutor.EMPTY);
+      elementName = PsiFormatUtil.formatVariable((PsiVariable)element, VARIABLE_FLAGS, PsiSubstitutor.EMPTY);
       if (element instanceof PsiField) {
-        elementName = LangBundle.message("java.terms.field") + " " + elementName;
+        elementName = LangBundle.message("java.terms.field") + ' ' + elementName;
       }
       else if (element instanceof PsiParameter) {
-        elementName = LangBundle.message("java.terms.parameter") + " " + elementName;
+        elementName = LangBundle.message("java.terms.parameter") + ' ' + elementName;
       }
       else {
-        elementName = LangBundle.message("java.terms.variable") + " " + elementName;
+        elementName = LangBundle.message("java.terms.variable") + ' ' + elementName;
       }
     }
     else if (element instanceof PsiPackage) {
       elementName = ((PsiPackage)element).getQualifiedName();
-      elementName = LangBundle.message("java.terms.package") + " " + elementName;
+      elementName = LangBundle.message("java.terms.package") + ' ' + elementName;
     }
+
     return elementName;
   }
-}
+}
\ No newline at end of file
index fc5d4902b564ed1b8de90fdc970f28c719466b1d..d5100fd2f30ad55154a53b396f8d071af65e9bb4 100644 (file)
  */
 package com.intellij.psi.impl.compiled;
 
-import com.intellij.psi.JavaElementVisitor;
-import com.intellij.psi.PsiElementVisitor;
-import com.intellij.psi.PsiJavaModule;
-import com.intellij.psi.PsiJavaModuleReference;
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.navigation.ItemPresentationProviders;
+import com.intellij.psi.*;
 import com.intellij.psi.impl.java.stubs.PsiJavaModuleStub;
 import com.intellij.psi.impl.source.SourceTreeToPsiMap;
 import com.intellij.psi.impl.source.tree.JavaElementType;
@@ -56,6 +55,22 @@ public class ClsJavaModuleImpl extends ClsRepositoryPsiElement<PsiJavaModuleStub
     setMirror(getNameElement(), SourceTreeToPsiMap.<PsiJavaModule>treeToPsiNotNull(element).getNameElement());
   }
 
+  @Override
+  public String getName() {
+    return getModuleName();
+  }
+
+  @Override
+  public ItemPresentation getPresentation() {
+    return ItemPresentationProviders.getItemPresentation(this);
+  }
+
+  @NotNull
+  @Override
+  public PsiElement getNavigationElement() {
+    return getNameElement();
+  }
+
   @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof JavaElementVisitor) {
index c6956a5715a492b6064888a3c9df452bc4af703e..f38b9673640ef4b1e93fbc0dabcba67ea8d52426 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
+import com.intellij.psi.impl.java.stubs.PsiJavaFileStub;
 import com.intellij.psi.util.PsiTreeUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -37,6 +38,11 @@ public class PsiJavaFileImpl extends PsiJavaFileBaseImpl {
   @Nullable
   @Override
   public PsiJavaModule getModuleDeclaration() {
+    PsiJavaFileStub stub = (PsiJavaFileStub)getStub();
+    if (stub != null) {
+      return stub.getModule();
+    }
+
     PsiElement element = getFirstChild();
     if (element instanceof PsiWhiteSpace || element instanceof PsiComment) {
       element = PsiTreeUtil.skipSiblingsForward(element, PsiWhiteSpace.class, PsiComment.class);
index 1682e574494e63798ed6f85efe958f9f45e090ff..36d754083fe4c0c7aeb48efb33aef51f75c97020 100644 (file)
 package com.intellij.psi.impl.source;
 
 import com.intellij.lang.ASTNode;
-import com.intellij.psi.JavaElementVisitor;
-import com.intellij.psi.PsiElementVisitor;
-import com.intellij.psi.PsiJavaModule;
-import com.intellij.psi.PsiJavaModuleReference;
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.navigation.ItemPresentationProviders;
+import com.intellij.psi.*;
 import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
 import com.intellij.psi.impl.java.stubs.PsiJavaModuleStub;
 import com.intellij.psi.util.PsiTreeUtil;
@@ -51,6 +50,22 @@ public class PsiJavaModuleImpl extends JavaStubPsiElement<PsiJavaModuleStub> imp
     return getNameElement().getReferenceText();
   }
 
+  @Override
+  public String getName() {
+    return getModuleName();
+  }
+
+  @Override
+  public ItemPresentation getPresentation() {
+    return ItemPresentationProviders.getItemPresentation(this);
+  }
+
+  @NotNull
+  @Override
+  public PsiElement getNavigationElement() {
+    return getNameElement();
+  }
+
   @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof JavaElementVisitor) {
index 71856ad311dffca1b7fb7d643ccf68636fc77bda..d751a3a753395a26341195b8adbd9857bc631b58 100644 (file)
@@ -140,7 +140,7 @@ public interface JavaElementType {
   IElementType ANNOTATION_ARRAY_INITIALIZER = new JavaCompositeElementType("ANNOTATION_ARRAY_INITIALIZER", PsiArrayInitializerMemberValueImpl.class);
   IElementType RECEIVER_PARAMETER = new JavaCompositeElementType("RECEIVER", PsiReceiverParameterImpl.class);
 
-  IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_NAME", PsiJavaModuleReferenceImpl.class);
+  IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_REFERENCE", PsiJavaModuleReferenceImpl.class);
   IElementType REQUIRES_STATEMENT = new JavaCompositeElementType("REQUIRES_STATEMENT", PsiRequiresStatementImpl.class);
   IElementType EXPORTS_STATEMENT = new JavaCompositeElementType("EXPORTS_STATEMENT", PsiExportsStatementImpl.class);
   IElementType USES_STATEMENT = new JavaCompositeElementType("USES_STATEMENT", PsiUsesStatementImpl.class);
diff --git a/java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaModulePresentationProvider.java b/java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaModulePresentationProvider.java
new file mode 100644 (file)
index 0000000..2b1adee
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.psi.presentation.java;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.navigation.ItemPresentationProvider;
+import com.intellij.psi.PsiJavaModule;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public class JavaModulePresentationProvider implements ItemPresentationProvider<PsiJavaModule> {
+  @Override
+  public ItemPresentation getPresentation(@NotNull final PsiJavaModule item) {
+    return new ItemPresentation() {
+      @Nullable
+      @Override
+      public String getPresentableText() {
+        return item.getModuleName();
+      }
+
+      @Nullable
+      @Override
+      public String getLocationString() {
+        return null;
+      }
+
+      @Nullable
+      @Override
+      public Icon getIcon(boolean unused) {
+        return AllIcons.Nodes.JavaModule;
+      }
+    };
+  }
+}
\ No newline at end of file
index 4ed5a48d9392f7af0686de877001ac7d27e6d471..fd6390c82c786ff5949559b3eab978839d050096 100644 (file)
@@ -392,9 +392,10 @@ underscore.identifier.error=As of Java 9, '_' is a keyword, and may not be used
 underscore.lambda.identifier=Use of '_' as a lambda parameter name is not allowed
 
 module.file.wrong.name=Module declaration should be in a file named 'module-info.java'
-module.illegal.name=Illegal module name
-module.file.duplicate=Multiple module declarations
+module.name.duplicate=Module ''{0}'' already exists in the project
+module.file.duplicate='module-info.java' already exists in the module
 module.file.wrong.location=Module declaration should be located in a module's source root
+module.open.duplicate.text=Go to duplicate
 
 feature.generics=Generics
 feature.annotations=Annotations
diff --git a/java/java-tests/testData/codeInsight/typing/semicolonInComment_after.java b/java/java-tests/testData/codeInsight/typing/semicolonInComment_after.java
new file mode 100644 (file)
index 0000000..6987afa
--- /dev/null
@@ -0,0 +1,2 @@
+// ;<caret>;
+class C {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/semicolonInComment_before.java b/java/java-tests/testData/codeInsight/typing/semicolonInComment_before.java
new file mode 100644 (file)
index 0000000..9569ba7
--- /dev/null
@@ -0,0 +1,2 @@
+// <caret>;
+class C {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/semicolonInStringLiteral_after.java b/java/java-tests/testData/codeInsight/typing/semicolonInStringLiteral_after.java
new file mode 100644 (file)
index 0000000..172a44a
--- /dev/null
@@ -0,0 +1,3 @@
+class C {
+  String s = ";<caret>;";
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/semicolonInStringLiteral_before.java b/java/java-tests/testData/codeInsight/typing/semicolonInStringLiteral_before.java
new file mode 100644 (file)
index 0000000..b8ea4df
--- /dev/null
@@ -0,0 +1,3 @@
+class C {
+  String s = "<caret>;";
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/parser-partial/modules/Name3.txt b/java/java-tests/testData/psi/parser-partial/modules/Name3.txt
new file mode 100644 (file)
index 0000000..fbc1cc5
--- /dev/null
@@ -0,0 +1,13 @@
+PsiJavaFile:Name3.java
+  PsiJavaModule:.A
+    PsiKeyword:module('module')
+    PsiWhiteSpace(' ')
+    PsiJavaModuleReference
+      PsiErrorElement:Identifier expected
+        <empty list>
+      PsiJavaToken:DOT('.')
+      PsiIdentifier:A('A')
+    PsiWhiteSpace(' ')
+    PsiJavaToken:LBRACE('{')
+    PsiWhiteSpace(' ')
+    PsiJavaToken:RBRACE('}')
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/moveInstanceMethod/IOOBE_MovingInvalidCode.java b/java/java-tests/testData/refactoring/moveInstanceMethod/IOOBE_MovingInvalidCode.java
new file mode 100644 (file)
index 0000000..3cc511d
--- /dev/null
@@ -0,0 +1,14 @@
+class A {
+}
+
+class B {
+}
+
+public class Main {
+    void user() {
+        method(, new B());
+    }
+
+    void <caret>method(A a, B b) {
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/moveInstanceMethod/IOOBE_MovingInvalidCode.java.after b/java/java-tests/testData/refactoring/moveInstanceMethod/IOOBE_MovingInvalidCode.java.after
new file mode 100644 (file)
index 0000000..8c40d6d
--- /dev/null
@@ -0,0 +1,14 @@
+class A {
+    void method(B b) {
+    }
+}
+
+class B {
+}
+
+public class Main {
+    void user() {
+                .method(new B());
+    }
+
+}
\ No newline at end of file
index 9da3d9d82d1f5d142949f506909c4b0a347a973d..f60db32cf61ed307137caa57d72f0f2e46a6f0ff 100644 (file)
@@ -101,7 +101,15 @@ public class JavaTypingTest extends LightPlatformCodeInsightFixtureTestCase {
   public void testInsertPairedBraceForLambdaBody() {
     doTest('{');
   }
-  
+
+  public void testSemicolonInStringLiteral() {
+    doTest(';');
+  }
+
+  public void testSemicolonInComment() {
+    doTest(';');
+  }
+
   private void doTest(char c) {
     myFixture.configureByFile(getTestName(true) + "_before.java");
     myFixture.type(c);
index 9f7135e892d557182a8d83b22bd393ce2c51f6c1..14f6f744c03714d4ced0aa73853a7c492b45f3a6 100644 (file)
@@ -29,22 +29,31 @@ class ModuleHighlightingTest : LightCodeInsightFixtureTestCase() {
     myFixture.checkHighlighting()
   }
 
+  fun testModuleDuplicate() {
+    additionalFile("""module M { }""")
+    doTest("""module <error descr="Module 'M' already exists in the project">M</error> { }""")
+  }
+
   fun testFileDuplicate() {
-    myFixture.configureFromExistingVirtualFile(runWriteAction {
-      val file = LightPlatformTestCase.getSourceRoot().createChildDirectory(this, "pkg").createChildData(this, "module-info.java")
-      VfsUtil.saveText(file, "module M { }")
-      file
-    })
-    myFixture.configureByText("module-info.java", """<error descr="Multiple module declarations">module M</error> { }""")
-    myFixture.checkHighlighting()
+    additionalFile("""module M.bis { }""")
+    doTest("""<error descr="'module-info.java' already exists in the module">module M</error> { }""")
   }
 
   fun testWrongFileLocation() {
-    myFixture.configureFromExistingVirtualFile(runWriteAction {
-      val file = LightPlatformTestCase.getSourceRoot().createChildDirectory(this, "pkg").createChildData(this, "module-info.java")
-      VfsUtil.saveText(file, """<warning descr="Module declaration should be located in a module's source root">module M</warning> { }""")
-      file
-    })
+    additionalFile("""<warning descr="Module declaration should be located in a module's source root">module M</warning> { }""")
+    myFixture.checkHighlighting()
+  }
+
+  //<editor-fold desc="Helpers.">
+  private fun additionalFile(text: String) = myFixture.configureFromExistingVirtualFile(runWriteAction {
+    val file = LightPlatformTestCase.getSourceRoot().createChildDirectory(this, "pkg").createChildData(this, "module-info.java")
+    VfsUtil.saveText(file, text)
+    file
+  })
+
+  private fun doTest(text: String) {
+    myFixture.configureByText("module-info.java", text)
     myFixture.checkHighlighting()
   }
+  //</editor-fold>
 }
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationClassPatternsTest.kt b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationClassPatternsTest.kt
new file mode 100644 (file)
index 0000000..6acb31f
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection
+import com.intellij.codeInspection.ex.EntryPointsManagerBase
+import com.intellij.codeInspection.ex.InspectionManagerEx
+import com.intellij.codeInspection.reference.RefClass
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+
+class UnusedDeclarationClassPatternsTest : LightCodeInsightFixtureTestCase() {
+
+  fun testClassPattern() {
+    val unusedDeclarationInspection = UnusedDeclarationInspection(true)
+    myFixture.enableInspections(unusedDeclarationInspection)
+    val classPattern = EntryPointsManagerBase.ClassPattern()
+    classPattern.hierarchically = true;
+    classPattern.pattern = "java.lang.Runnable"
+    val patterns = EntryPointsManagerBase.getInstance(project).patterns
+    try {
+      patterns.add(classPattern)
+      myFixture.configureByText("C.java", "public abstract class C implements Runnable {}")
+      myFixture.checkHighlighting()
+    }
+    finally {
+      patterns.remove(classPattern)
+      myFixture.disableInspections(unusedDeclarationInspection)
+    }
+  }
+
+  fun testNoClassPattern() {
+    val unusedDeclarationInspection = UnusedDeclarationInspection(true)
+    try {
+      myFixture.enableInspections(unusedDeclarationInspection)
+      myFixture.configureByText("C.java", "public abstract class <warning descr=\"Class 'C' is never used\">C</warning> implements Runnable {}")
+      myFixture.checkHighlighting()
+    }
+    finally {
+      myFixture.disableInspections(unusedDeclarationInspection)
+    }
+  }
+
+  fun testAddEntryPoint() {
+    val aClass = myFixture.addClass("public class Foo {}")
+    val entryPointsManager = EntryPointsManagerBase.getInstance(project)
+    val context = (InspectionManager.getInstance(project) as InspectionManagerEx).createNewGlobalContext(false)
+    try {
+      val refClass = context.refManager.getReference(aClass)
+      assertNotNull(refClass)
+      val patterns = entryPointsManager.patterns
+      assertEmpty(patterns)
+
+      //add class as entry point
+      entryPointsManager.addEntryPoint(refClass!!, true)
+      assertSize(1, patterns)
+      assertEquals("Foo", patterns[0].pattern)
+      assertEmpty(entryPointsManager.entryPoints)
+
+      //remove class entry point with constructors - ensure nothing is left in the entries
+      entryPointsManager.removeEntryPoint(refClass)
+      for (constructor in (refClass as RefClass).constructors) {
+        entryPointsManager.removeEntryPoint(constructor)
+      }
+
+      assertEmpty(patterns)
+      assertEmpty(entryPointsManager.entryPoints)
+    }
+    finally {
+      context.cleanup()
+    }
+  }
+}
\ No newline at end of file
index 513adcc8dd68ff4309940a4bccecf2ff1bdcd734..2c4ad310ede7d37e24778eeebd46881286b38325 100644 (file)
@@ -30,6 +30,7 @@ public class ModuleParserTest extends JavaParsingTestCase {
   public void testName0() { doParserTest("module A. { }"); }
   public void testName1() { doParserTest("module A..B { }"); }
   public void testName2() { doParserTest("module A B { }"); }
+  public void testName3() { doParserTest("module .A { }"); }
 
   public void testIncomplete0() { doParserTest("module"); }
   public void testIncomplete1() { doParserTest("module X"); }
diff --git a/java/java-tests/testSrc/com/intellij/navigation/ModuleNavigationTest.kt b/java/java-tests/testSrc/com/intellij/navigation/ModuleNavigationTest.kt
new file mode 100644 (file)
index 0000000..4db64d8
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.navigation
+
+import com.intellij.ide.util.gotoByName.GotoSymbolModel2
+import com.intellij.psi.PsiJavaFile
+import com.intellij.testFramework.LightProjectDescriptor
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+import org.assertj.core.api.Assertions.assertThat
+
+class ModuleNavigationTest : LightCodeInsightFixtureTestCase() {
+  override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_9
+
+  fun testNavigation() {
+    val file = myFixture.configureByText("module-info.java", "module my.mod.name { }")
+    (file as PsiJavaFile).moduleDeclaration!!.navigate(true)
+    assertThat(myFixture.editor.caretModel.offset).isEqualTo(file.text.indexOf("my.mod.name"))
+  }
+
+  fun testGoToSymbol() {
+    val file = myFixture.configureByText("module-info.java", "module my.mod.name { }")
+    val items = GotoSymbolModel2(myFixture.project).getElementsByName("my.mod.name", false, "my.mod")
+    assertThat(items).containsExactly((file as PsiJavaFile).moduleDeclaration!!)
+  }
+}
\ No newline at end of file
index 779c52bd5cd11e87c1d6bec7261bdc630f5bff8a..94d4a659674bb870abfe5bb4299c394f6c4e6dd7 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.psi.formatter.java;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.actions.ReformatCodeProcessor;
-import com.intellij.formatting.DiffInfoImpl;
 import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
@@ -44,7 +43,6 @@ import org.jetbrains.annotations.Nullable;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
-import java.util.Collection;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
@@ -95,7 +93,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
     void run(PsiFile psiFile, int startOffset, int endOffset);
   }
 
-  private static final Map<Action, TestFormatAction> ACTIONS = new EnumMap<Action, TestFormatAction>(Action.class);
+  private static final Map<Action, TestFormatAction> ACTIONS = new EnumMap<>(Action.class);
   static {
     ACTIONS.put(Action.REFORMAT, new TestFormatAction() {
       @Override
@@ -112,17 +110,15 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
     ACTIONS.put(Action.REFORMAT_WITH_CONTEXT, new TestFormatAction() {
       @Override
       public void run(PsiFile psiFile, int startOffset, int endOffset) {
-        Collection<TextRange> ranges = ContainerUtil.newArrayList(new TextRange(startOffset, endOffset));
-        CodeStyleManager.getInstance(getProject()).reformatTextWithContext(psiFile, ranges, null);
+        List<TextRange> ranges = ContainerUtil.newArrayList(new TextRange(startOffset, endOffset));
+        CodeStyleManager.getInstance(getProject()).reformatTextWithContext(psiFile, ranges);
       }
     });
     ACTIONS.put(Action.REFORMAT_WITH_INSERTED_LINE_CONTEXT, new TestFormatAction() {
       @Override
       public void run(PsiFile psiFile, int startOffset, int endOffset) {
-        TextRange range = new TextRange(startOffset, endOffset);
-        List<TextRange> ranges = ContainerUtil.newArrayList(range);
-        DiffInfo info = new DiffInfoImpl(ranges);
-        CodeStyleManager.getInstance(getProject()).reformatTextWithContext(psiFile, ranges, info);
+        List<TextRange> ranges = ContainerUtil.newArrayList(new TextRange(startOffset, endOffset));
+        CodeStyleManager.getInstance(getProject()).reformatTextWithContext(psiFile, new ChangedRangesInfo(ranges, ranges));
       }
     });
   }
index f9e630823f7880821b4b7035b0f0f24aa4f5bda8..9f93742199a5e2e8d2abe78a06643a8cb6a59586 100644 (file)
@@ -72,7 +72,7 @@ public class JavaSmartReformatPerformanceTest extends AbstractJavaFormatterTest
     return () -> CommandProcessor.getInstance().executeCommand(
       getProject(),
       () -> ApplicationManager.getApplication().runWriteAction(
-        () -> codeStyleManager.reformatTextWithContext(file, ranges, null)
+        () -> codeStyleManager.reformatTextWithContext(file, ranges)
       ),
       null,
       null);
index c84324b6dd295516e17db0623e4c64c78046b791..406d174934b42ea23769a33c737cbba9eeefa8d3 100644 (file)
@@ -59,6 +59,8 @@ public class MoveInstanceMethodTest extends LightRefactoringTestCase {
   public void testOverloadingMethods1() throws Exception { doTest(true, 0); }
 
   public void testPolyadicExpr() throws Exception { doTest(true, 0); }
+  
+  public void testIOOBE_MovingInvalidCode() throws Exception { doTest(true, 0); }
 
   public void testEscalateVisibility() throws Exception {
     doTest(true, 0, VisibilityUtil.ESCALATE_VISIBILITY);
index 5c4c5c003704a17b08f63691a763dbb05606a29f..45ca8ff4bfd1435de83bb81e00c1405379f7ac95 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.
@@ -102,6 +102,11 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
     debugProcess.getManagerThread().schedule(debugProcess.createStepOverCommand(context, false));
   }
 
+  protected void stepOut(SuspendContextImpl context) {
+    DebugProcessImpl debugProcess = context.getDebugProcess();
+    debugProcess.getManagerThread().schedule(debugProcess.createStepOutCommand(context));
+  }
+
   protected void waitBreakpoints() {
     myScriptRunnablesSema.down();
     waitFor(() -> myScriptRunnablesSema.waitFor());
@@ -129,7 +134,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
     myScriptRunnables.add(runnable);
   }
 
-  protected void doWhenPausedThenResume(final SuspendContextRunnable runnable) {
+  protected void onStop(final SuspendContextRunnable runnable, final SuspendContextRunnable then){
     onBreakpoint(new SuspendContextRunnable() {
       @Override
       public void run(SuspendContextImpl suspendContext) throws Exception {
@@ -137,12 +142,16 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
           runnable.run(suspendContext);
         }
         finally {
-          resume(suspendContext);
+          then.run(suspendContext);
         }
       }
     });
   }
 
+  protected void doWhenPausedThenResume(final SuspendContextRunnable runnable) {
+    onStop(runnable, this::resume);
+  }
+
   protected void addDefaultBreakpointListener() {
     if (myPauseScriptListener == null) {
       final DebugProcessImpl debugProcess = getDebugProcess();
index 0ab331916e3d71faa20d7f065b9e1a4230c40103..92e3a7d2c6ad250754c20c5f84e49043fbe4ee70 100644 (file)
@@ -201,7 +201,7 @@ public abstract class InspectionTestCase extends PsiTestCase {
 
       @Override
       public boolean isSelected() {
-        return false;
+        return true;
       }
 
       @Override
index 789257ea70e69c6f23cd342371d51a44aa850d23..d3d79e82219b299335fe15de13bf6f3f452d35aa 100644 (file)
@@ -25,11 +25,13 @@ import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Pair;
 import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiTypesUtil;
 import com.intellij.refactoring.typeMigration.TypeConversionDescriptor;
+import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.Nls;
@@ -131,8 +133,20 @@ public class MigrateAssertToMatcherAssertInspection extends LocalInspectionTool
       }
       LOG.assertTrue(templatePair != null);
       templatePair = buildFullTemplate(templatePair, method);
-      final PsiExpression replaced =
-        TypeConversionDescriptor.replaceExpression(methodCall, templatePair.getFirst(), templatePair.getSecond());
+      final PsiExpression replaced;
+      try {
+        replaced = TypeConversionDescriptor.replaceExpression(methodCall, templatePair.getFirst(), templatePair.getSecond());
+      }
+      catch (IncorrectOperationException e) {
+        LOG.error("Replacer can't can't match expression:\n" +
+                  methodCall.getText() +
+                  "\nwith replacement template:\n(" +
+                  templatePair.getFirst() +
+                  ", " +
+                  templatePair.getSecond() +
+                  ")");
+        throw e;
+      }
 
       if (myStaticallyImportMatchers) {
         for (PsiJavaCodeReferenceElement ref : ContainerUtil.reverse(new ArrayList<PsiJavaCodeReferenceElement>(PsiTreeUtil.findChildrenOfType(replaced, PsiJavaCodeReferenceElement.class)))) {
index 2bc7fb0f99e71489c60949381b7ed2502cb2c63c..332659dabb76e32a3ec9762fe9666faa4f75da62 100644 (file)
@@ -101,10 +101,18 @@ public abstract class BaseGuavaTypeConversionRule extends TypeConversionRule {
       final PsiAnonymousClass anonymousClass = ((PsiNewExpression)context).getAnonymousClass();
       return anonymousClass == null ? null : findConversionForAnonymous(anonymousClass, labeler.getSettings(GuavaConversionSettings.class));
     }
-    else if (context instanceof PsiReferenceExpression) {
-      final PsiElement resolvedElement = ((PsiReferenceExpression)context).resolve();
-      if (resolvedElement instanceof PsiVariable) {
-        return findConversionForVariableReference((PsiReferenceExpression)context, (PsiVariable)resolvedElement, context);
+    else if (context instanceof PsiMethodReferenceExpression) {
+      final PsiType methodReferenceType = context.getType();
+      if (methodReferenceType != null && to != null && to.isAssignableFrom(methodReferenceType)) {
+        return new TypeConversionDescriptorBase();
+      }
+    }
+    else {
+      if (context instanceof PsiReferenceExpression) {
+        final PsiElement resolvedElement = ((PsiReferenceExpression)context).resolve();
+        if (resolvedElement instanceof PsiVariable) {
+          return findConversionForVariableReference((PsiReferenceExpression)context, (PsiVariable)resolvedElement, context);
+        }
       }
     }
     return null;
index 14e9569629db6afca01db769fa94faec6967230c..05f46982a683be2a7eeddb667c51ab491ad0d13a 100644 (file)
@@ -286,6 +286,10 @@ public class GuavaInspectionTest extends JavaCodeInsightFixtureTestCase {
     doTestAllFile();
   }
 
+  public void testFunctionIsMethodReference() {
+    doTest();
+  }
+
   private void doTestNoQuickFixes(Class<? extends PsiElement>... highlightedElements) {
     myFixture.configureByFile(getTestName(true) + ".java");
 
index 464d76bf41cb555cddaa88ae95d36fd9d6ac9a74..a7dfbcbd464b0af4d27baa3ece253463e4ffa885 100644 (file)
--- a/