Merge branch 'master' into PY-9727
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Wed, 9 Dec 2015 20:20:27 +0000 (23:20 +0300)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Wed, 9 Dec 2015 20:20:27 +0000 (23:20 +0300)
491 files changed:
.idea/inspectionProfiles/idea_default.xml
.idea/modules.xml
RegExpSupport/src/org/intellij/lang/regexp/DefaultRegExpPropertiesProvider.java
bin/scripts/unix/idea.sh
build.xml
build/conf/classVersions.txt
build/scripts/dist.gant
build/scripts/download_kotlin.gant
build/scripts/layouts.gant
images/src/org/intellij/images/editor/impl/ImageEditorImpl.java
images/src/org/intellij/images/ui/ThumbnailComponentUI.java
java/compiler/forms-compiler/forms-compiler.iml
java/compiler/forms-compiler/testSrc/com/intellij/uiDesigner/core/TextAreasTest.java
java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java
java/debugger/impl/src/com/intellij/debugger/jdi/ThreadReferenceProxyImpl.java
java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
java/java-analysis-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/VariableTypeFromCallFix.java
java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java
java/java-impl/src/com/intellij/externalSystem/JavaProjectDataService.java
java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java
java/java-impl/src/com/intellij/ide/projectView/actions/MarkGeneratedSourceRootAction.java
java/java-impl/src/com/intellij/ide/projectView/actions/UnmarkGeneratedSourceRootAction.java
java/java-impl/src/com/intellij/ide/projectView/impl/JavaProjectViewDirectoryHelper.java
java/java-impl/src/com/intellij/internal/UsedIconsListingAction.java
java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
java/java-impl/src/com/intellij/refactoring/extractclass/ExtractEnumProcessor.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationRules.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationStatementProcessor.java
java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java
java/java-impl/src/com/intellij/unscramble/UnscrambleListener.java
java/java-psi-api/src/com/intellij/openapi/projectRoots/JdkVersionUtil.java
java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
java/java-psi-api/src/com/intellij/psi/PsiCapturedWildcardType.java
java/java-psi-api/src/com/intellij/psi/PsiIntersectionType.java
java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
java/java-psi-impl/src/com/intellij/psi/impl/JavaClassSupersImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/LocalVariableInitialization.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA130243.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57492.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IntersectionTypes.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/StopBoundsPromotionInsideNestedWildcards.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA139096.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA139222.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA146897.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypes.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypesIDEA139157.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypesIDEA139167.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/PolyConditionalExpressionWithTargetPrimitive.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/PotentialCompatibilityInCaseWhenNoMethodHasValidNumberOfParameters.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTernary2.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTernary2.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeTypeArgs/afterSuperType.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeTypeArgs/beforeSuperType.java
java/java-tests/testData/codeInsight/documentation/LinkBetweenMethods.html [new file with mode: 0644]
java/java-tests/testData/codeInsight/documentation/library-javadoc.jar
java/java-tests/testData/codeInsight/documentation/library-src.jar
java/java-tests/testData/codeInsight/documentation/library.jar
java/java-tests/testData/inspection/testOnly/insideField/expected.xml [new file with mode: 0644]
java/java-tests/testData/inspection/testOnly/insideField/src/A.java [new file with mode: 0644]
java/java-tests/testData/inspection/testOnly/insideField/src/C.java [new file with mode: 0644]
java/java-tests/testData/inspection/testOnly/insideField/test/D.java [new file with mode: 0644]
java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.after.java
java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
java/java-tests/testSrc/com/intellij/codeInspection/TestOnlyInspectionTest.java
java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
java/java-tests/testSrc/com/intellij/index/IndexTest.groovy
java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingProcessingOnDocumentModificationTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/IndentTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterWrapTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/TabIndentingTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/WrapperTest.java
java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java
java/testFramework/src/com/intellij/debugger/impl/OutputChecker.java
java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaModuleFixtureBuilderImpl.java
java/testFramework/src/com/siyeh/ig/LightInspectionTestCase.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/inspections/GuavaInspection.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/guava/FluentIterableConversionUtil.java
java/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.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/convertImmutableCollections_after.java
java/typeMigration/testData/refactoring/typeMigration/methodReturnTypeWithTypeParameter/after/Test.items [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/methodReturnTypeWithTypeParameter/after/test.java [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/methodReturnTypeWithTypeParameter/before/test.java [new file with mode: 0644]
jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
native/WinLauncher/WinLauncher/WinLauncher.vcxproj
platform/analysis-api/src/com/intellij/codeInspection/BatchQuickFix.java
platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedPackageSetReference.java
platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java
platform/bootstrap/src/com/intellij/idea/Main.java
platform/built-in-server/src/org/jetbrains/ide/AboutHttpService.java
platform/core-api/src/com/intellij/lang/folding/FoldingDescriptor.java
platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java
platform/core-api/src/com/intellij/openapi/progress/Task.java
platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
platform/core-api/src/com/intellij/psi/tree/TokenSet.java
platform/core-impl/src/com/intellij/concurrency/JobSchedulerImpl.java [moved from platform/platform-impl/src/com/intellij/concurrency/JobSchedulerImpl.java with 88% similarity]
platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java
platform/core-impl/src/com/intellij/openapi/fileEditor/impl/LoadTextUtil.java
platform/core-impl/src/com/intellij/psi/impl/DocumentCommitThread.java
platform/core-impl/src/com/intellij/psi/impl/source/tree/CompositeElement.java
platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java
platform/diff-impl/src/com/intellij/diff/tools/binary/TwosideBinaryDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffTool.java
platform/diff-impl/src/com/intellij/diff/tools/external/ExternalMergeTool.java
platform/diff-impl/src/com/intellij/diff/tools/util/DiffSplitter.java
platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffSettingsHolder.java
platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffViewerUtil.java
platform/diff-impl/src/com/intellij/diff/tools/util/side/TwosideContentPanel.java
platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java
platform/editor-ui-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java
platform/external-system-api/external-system-api.iml
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ModuleData.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/event/ExternalSystemProgressEventUnsupported.java [new file with mode: 0644]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/event/ExternalSystemProgressEventUnsupportedImpl.java [new file with mode: 0644]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataServiceImpl.java
platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy
platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemTestCase.java
platform/external-system-rt/external-system-rt.iml [new file with mode: 0644]
platform/external-system-rt/src/com/intellij/openapi/externalSystem/model/ExternalSystemException.java [moved from platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSystemException.java with 100% similarity]
platform/external-system-rt/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java [moved from platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java with 100% similarity]
platform/external-system-rt/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java [moved from platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java with 100% similarity]
platform/icons/src/windows/appIconOk512.png [deleted file]
platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java
platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
platform/lang-api/src/com/intellij/codeInsight/daemon/GutterIconDescriptor.java [new file with mode: 0644]
platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerProviderDescriptor.java
platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerProvider.java
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java
platform/lang-api/src/com/intellij/ide/actions/CreateElementActionBase.java
platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java
platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
platform/lang-api/src/com/intellij/psi/codeStyle/presentation/CodeStyleSettingPresentation.java
platform/lang-api/src/com/intellij/ui/FileColorManager.java
platform/lang-impl/src/com/intellij/application/options/editor/GutterIconsConfigurable.java
platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/UpdateFoldRegionsOperation.java
platform/lang-impl/src/com/intellij/codeInsight/hint/ShowParameterInfoHandler.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/PrefixChangeListener.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInspection/actions/CleanupInspectionIntention.java
platform/lang-impl/src/com/intellij/execution/impl/BeforeRunStepsPanel.java
platform/lang-impl/src/com/intellij/find/impl/FindManagerImpl.java
platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/UrlUtil.java
platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java
platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkSourceRootAction.java
platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java
platform/lang-impl/src/com/intellij/injected/editor/FoldingModelWindow.java
platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java
platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ModuleSourceRootEditHandler.java
platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/actions/ToggleSourcesStateAction.java
platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
platform/lang-impl/src/com/intellij/ui/tabs/FileColorManagerImpl.java
platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceUtil.java
platform/lang-impl/src/com/intellij/util/indexing/DeletedVirtualFileStub.java
platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java
platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java
platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java
platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java
platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java
platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java
platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java
platform/platform-api/src/com/intellij/openapi/actionSystem/ActionPlaces.java
platform/platform-api/src/com/intellij/openapi/roots/ui/LightFilePointer.java
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
platform/platform-api/src/com/intellij/openapi/ui/JBPopupMenu.java
platform/platform-api/src/com/intellij/openapi/wm/AppIconScheme.java
platform/platform-api/src/com/intellij/ui/CheckBoxList.java
platform/platform-api/src/com/intellij/ui/components/JBLabel.java
platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java
platform/platform-api/src/com/intellij/util/Alarm.java
platform/platform-api/src/com/intellij/util/ui/ButtonlessScrollBarUI.java
platform/platform-api/src/com/intellij/util/ui/RegionPainter.java
platform/platform-impl/src/com/intellij/application/options/pathMacros/PathMacroTable.java
platform/platform-impl/src/com/intellij/execution/process/KillableColoredProcessHandler.java
platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java
platform/platform-impl/src/com/intellij/ide/actions/CreateLauncherScriptAction.java
platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java
platform/platform-impl/src/com/intellij/idea/StartupUtil.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/external/ExternalToolContentExternalizer.java
platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorGutterComponentEx.java
platform/platform-impl/src/com/intellij/openapi/editor/ex/FoldingModelEx.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/ComplementaryFontsRegistry.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/FoldingModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/FontInfo.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorSizeManager.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorView.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/view/TextFragmentFactory.java
platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/project/impl/JBProtocolOpenProjectCommand.java
platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VfsRootAccess.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/RefreshWorker.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java
platform/platform-impl/src/com/intellij/platform/LocationNameFieldsBinding.java
platform/platform-impl/src/com/intellij/remote/AbstractRemoteProcessHandler.java
platform/platform-impl/src/com/intellij/remote/BaseRemoteProcessHandler.java
platform/platform-impl/src/com/intellij/remote/ColoredRemoteProcessHandler.java
platform/platform-impl/src/com/intellij/ui/AppIcon.java
platform/platform-impl/src/com/intellij/ui/stripe/ErrorStripe.java
platform/platform-impl/src/com/intellij/ui/stripe/ErrorStripePainter.java
platform/platform-impl/src/com/intellij/ui/stripe/ExtraErrorStripePainter.java
platform/platform-impl/src/com/intellij/ui/stripe/TranslucencyThumbPainter.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ui/stripe/Updater.java
platform/platform-impl/src/com/intellij/util/MergingBackgroundExecutor.java
platform/platform-impl/src/com/intellij/util/ui/table/JBListTable.java
platform/platform-impl/src/org/jetbrains/concurrency/promise.kt
platform/platform-resources-en/platform-resources-en.iml
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/ApplicationBundle.properties
platform/platform-resources-en/src/messages/LangBundle.properties
platform/platform-resources/src/idea/Keymap_MacClassic.xml
platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java
platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java
platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java
platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java
platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java [new file with mode: 0644]
platform/projectModel-api/src/com/intellij/openapi/project/ProjectUtilCore.java
platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/SimpleProjectRoot.java
platform/projectModel-impl/src/messages/ProjectBundle.properties
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.kt
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestsPresentationUtil.java
platform/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java
platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java
platform/testFramework/src/com/intellij/testFramework/ThreadTracker.java
platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java
platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java
platform/testFramework/src/com/intellij/testFramework/fixtures/TempDirTestFixture.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/BaseFixture.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/LightTempDirTestFixtureImpl.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/TempDirTestFixtureImpl.java
platform/testFramework/test-framework-java8/FixtureRule.kt
platform/testFramework/test-framework-java8/path.kt
platform/testRunner/src/com/intellij/execution/testframework/TrackRunningTestUtil.java
platform/usageView/src/com/intellij/usages/impl/GroupNode.java
platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java
platform/util-rt/src/com/intellij/openapi/diagnostic/LoggerRt.java
platform/util-rt/src/com/intellij/openapi/util/Condition.java
platform/util-rt/src/com/intellij/openapi/util/Conditions.java
platform/util-rt/src/com/intellij/openapi/util/Pair.java
platform/util-rt/src/com/intellij/openapi/util/io/FileFilters.java
platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java
platform/util-rt/src/com/intellij/security/CompositeX509TrustManager.java
platform/util-rt/src/com/intellij/util/Consumer.java
platform/util-rt/src/com/intellij/util/Functions.java
platform/util-rt/src/com/intellij/util/NotNullFunction.java
platform/util-rt/src/com/intellij/util/containers/Stack.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/execution/CommandLineUtil.java
platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java
platform/util/src/com/intellij/execution/process/ProcessInfo.java
platform/util/src/com/intellij/execution/process/ProcessListMac.java
platform/util/src/com/intellij/execution/process/ProcessListWin32.java
platform/util/src/com/intellij/execution/process/ProcessListWin32Internal.java
platform/util/src/com/intellij/execution/process/ProcessWaitFor.java
platform/util/src/com/intellij/openapi/application/PathManager.java
platform/util/src/com/intellij/openapi/util/IconLoader.java
platform/util/src/com/intellij/openapi/util/io/FileUtil.java
platform/util/src/com/intellij/openapi/util/io/UniqueNameBuilder.java
platform/util/src/com/intellij/ui/ColorUtil.java
platform/util/src/com/intellij/ui/mac/foundation/Foundation.java
platform/util/src/com/intellij/util/ConcurrencyUtil.java
platform/util/src/com/intellij/util/JBHiDPIScaledImage.java
platform/util/src/com/intellij/util/Restarter.java
platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutor.java
platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutorService.java
platform/util/src/com/intellij/util/io/BaseDataReader.java
platform/util/src/com/intellij/util/io/OutputReader.java
platform/util/src/com/intellij/util/io/RandomAccessDataFile.java
platform/util/src/com/intellij/util/lang/ClasspathCache.java
platform/util/src/com/intellij/util/lang/FileLoader.java
platform/util/src/com/intellij/util/lang/UrlClassLoader.java
platform/util/src/com/intellij/util/ui/ImageUtil.java
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/util/util.iml
platform/vcs-api/vcs-api-core/src/com/intellij/openapi/diff/impl/patch/UnifiedDiffWriter.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinHandler.java
platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/TodoCheckinHandler.java
platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SmartDeltaCompressor.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/EditBreakpointActionHandler.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/SuspiciousToArrayCallInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/UnnecessaryInitCauseInspectionBase.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/SimplifiableJUnitAssertionInspection.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableSearchUtils.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/threading/SynchronizationOnLocalVariableOrMethodParameterInspection.java
plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/simplifiable_junit_assertion/JUnit3TestCase.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/simplifiable_junit_assertion/JUnit3TestCase.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/simplifiable_junit_assertion/JUnit4TestCase.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/simplifiable_junit_assertion/JUnit4TestCase.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/junit/SimplifiableJUnit40AssertionInspection.java [deleted file]
plugins/InspectionGadgets/test/com/siyeh/igtest/junit/simplifiable_junit_assertion/SimplifiableJUnit40Assertion.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/junit/simplifiable_junit_assertion/SimplifiableJUnitAssertion.java [moved from plugins/InspectionGadgets/test/com/siyeh/igtest/junit/SimplifiableJUnitAssertionInspection.java with 59% similarity]
plugins/InspectionGadgets/test/com/siyeh/igtest/threading/synchronization_on_local_variable_or_method_parameter/SynchronizationOnLocalVariableOrMethodParameter.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/SuspiciousToArrayCallInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/junit/SimplifiableJUnitAssertionFixTest.java [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/junit/SimplifiableJUnitAssertionInspectionTest.java [new file with mode: 0644]
plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertToScientificNotationPredicate.java
plugins/ant/src/com/intellij/lang/ant/config/execution/AntBuildMessageView.java
plugins/coverage/src/com/intellij/coverage/PackageAnnotator.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsUtil.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/LogInformationWrapper.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/CvsApplicationLevelConfiguration.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/FormUtils.java
plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/command/status/StatusMessageParser.java
plugins/devkit/src/build/PrepareToDeployAction.java
plugins/devkit/src/dom/generator/Util.java
plugins/devkit/src/dom/impl/PluginPsiClassConverter.java
plugins/devkit/src/inspections/internal/UseJBColorInspection.java
plugins/devkit/src/inspections/quickfix/AbstractRegisterFix.java
plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java
plugins/eclipse/src/org/jetbrains/idea/eclipse/util/PathUtil.java
plugins/git4idea/src/git4idea/push/GitPushSpecParser.java
plugins/git4idea/tests/git4idea/test/RefParser.java
plugins/google-app-engine/source/com/intellij/appengine/facet/AppEngineSupportProvider.java
plugins/google-app-engine/source/com/intellij/appengine/facet/AppEngineWebIntegration.java
plugins/google-app-engine/source/com/intellij/appengine/facet/impl/AppEngineCommunityWebIntegration.java
plugins/gradle/gradle-tests.iml [new file with mode: 0644]
plugins/gradle/gradle.iml
plugins/gradle/lib/gradle-core-2.9.jar
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/ExecutionInfo.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/ExecutionNode.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleRunnerUtil.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/TaskExecutionView.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleTestsExecutionConsoleManager.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/DefaultProjectResolverContext.java [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverUtil.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/ProjectResolverContext.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/integrations/maven/codeInsight/actions/AddGradleDslDependencyActionTest.java
plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml
plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ModelsHolder.java
plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml
plugins/gradle/tooling-extension-impl/gradle-tooling-extension-tests.iml [new file with mode: 0644]
plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/VersionMatcherRule.java [moved from plugins/gradle/testSources/org/jetbrains/plugins/gradle/VersionMatcherRule.java with 95% similarity]
plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GroovyCodeStyleManagerImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertGStringToStringIntention.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTargetDialog.java
plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyFoldingTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/optimizeImports/OptimizeImportsTest.groovy
plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java
plugins/javaFX/common-javaFX-plugin/common-javaFX-plugin.iml
plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/AbstractJavaFxPackager.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenClassSearcher.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/psi/impl/PropertiesFileImpl.java
plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java
plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertiesUpdateManager.java
plugins/settings-repository/settings-repository.iml
plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/jql/psi/impl/JqlElementImpl.java
plugins/tasks/tasks-core/src/com/intellij/tasks/bugzilla/BugzillaTask.java
plugins/tasks/tasks-core/src/com/intellij/tasks/trac/TracRepository.java
plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InsertComponentProcessor.java
plugins/ui-designer/src/com/intellij/uiDesigner/make/PreviewNestedFormLoader.java
plugins/ui-designer/src/com/intellij/uiDesigner/radComponents/RadContainer.java
plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/SnapShooterConfigurationExtension.java
python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyExecutor.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyProjectComponent.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtils.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyCheckAction.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/run/StudyExecutor.java
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyToolWindow.java
python/helpers/pydev/pydev_monkey.py
python/ide/src/com/jetbrains/python/newProject/actions/ProjectSpecificSettingsStep.java
python/openapi/src/com/jetbrains/python/packaging/PyRequirement.java
python/psi-api/src/com/jetbrains/python/PythonStringUtil.java
python/pydevSrc/com/jetbrains/python/console/pydev/AbstractPyCodeCompletion.java
python/src/META-INF/python-core.xml
python/src/com/jetbrains/python/PythonHelpersLocator.java
python/src/com/jetbrains/python/buildout/BuildoutFacet.java
python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java [new file with mode: 0644]
python/src/com/jetbrains/python/codeInsight/PythonFormattedStringReferenceContributor.java [new file with mode: 0644]
python/src/com/jetbrains/python/codeInsight/PythonFormattedStringReferenceProvider.java [new file with mode: 0644]
python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java
python/src/com/jetbrains/python/codeInsight/completion/PyStringFormatCompletionContributor.java [new file with mode: 0644]
python/src/com/jetbrains/python/codeInsight/editorActions/PyTripleQuoteBackspaceDelegate.java [new file with mode: 0644]
python/src/com/jetbrains/python/documentation/docstrings/DocStringTypeReference.java
python/src/com/jetbrains/python/editor/BaseQuoteHandler.java
python/src/com/jetbrains/python/inspections/PyPep8NamingInspection.java
python/src/com/jetbrains/python/psi/impl/PyBaseElementImpl.java
python/src/com/jetbrains/python/psi/impl/references/PyReferenceImpl.java
python/src/com/jetbrains/python/refactoring/NameSuggesterUtil.java
python/src/com/jetbrains/python/remote/PyRemoteSourceItem.java
python/src/com/jetbrains/python/testing/AbstractPythonTestRunConfiguration.java
python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
python/testData/completion/formatFuncArgument.after.py [new file with mode: 0644]
python/testData/completion/formatFuncArgument.py [new file with mode: 0644]
python/testData/completion/formatString.after.py [new file with mode: 0644]
python/testData/completion/formatString.py [new file with mode: 0644]
python/testData/completion/formatStringFromRef.after.py [new file with mode: 0644]
python/testData/completion/formatStringFromRef.py [new file with mode: 0644]
python/testData/completion/formatStringFromStarArg.after.py [new file with mode: 0644]
python/testData/completion/formatStringFromStarArg.py [new file with mode: 0644]
python/testData/completion/formatStringOutsideBraces.after.py [new file with mode: 0644]
python/testData/completion/formatStringOutsideBraces.py [new file with mode: 0644]
python/testData/editing/closedTripleQuoteBackspace.after.py [new file with mode: 0644]
python/testData/editing/closedTripleQuoteBackspace.before.py [new file with mode: 0644]
python/testData/inspections/PyPep8NamingInspection/ignored/ignoreN801.py [new file with mode: 0644]
python/testData/inspections/PyPep8NamingInspection/ignored/ignoreN802.py [new file with mode: 0644]
python/testData/inspections/PyPep8NamingInspection/ignored/ignoreN803.py [new file with mode: 0644]
python/testData/inspections/PyPep8NamingInspection/ignored/ignoreN806.py [new file with mode: 0644]
python/testData/inspections/PyPep8NamingInspection/ignored/ignoreOnlyOneError.py [new file with mode: 0644]
python/testData/refactoring/rename/formatStringKeyword.py [new file with mode: 0644]
python/testData/refactoring/rename/formatStringKeyword_after.py [new file with mode: 0644]
python/testData/resolve/FormatArgsAndKWargs.py [new file with mode: 0644]
python/testData/resolve/FormatArgsAndKWargs1.py [new file with mode: 0644]
python/testData/resolve/FormatPositionalArgs.py [new file with mode: 0644]
python/testData/resolve/FormatStringKWArgs.py [new file with mode: 0644]
python/testData/resolve/PercentKeyWordArgs.py [new file with mode: 0644]
python/testData/resolve/PercentPositionalArgs.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/PyEditingTest.java
python/testSrc/com/jetbrains/python/PyResolveTest.java
python/testSrc/com/jetbrains/python/PythonCompletionTest.java
python/testSrc/com/jetbrains/python/inspections/PyPep8NamingInspectionTest.java
python/testSrc/com/jetbrains/python/refactoring/PyRenameTest.java
spellchecker/src/com/intellij/spellchecker/english.dic
spellchecker/testSrc/com/intellij/spellchecker/ui/SpellCheckingEditorCustomizationTest.java
test-log.xml
xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java
xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionData.java
xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java
xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaAction.java
xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java
xml/tests/src/com/intellij/codeInsight/XmlTagTest.java

index c19558d981912f97a2389cb47f8157e611fde15a..aabceb3d9fed5072b57fbeb64174a1410f03f4fe 100644 (file)
       <replaceConfiguration name="StringUtil.stripQuotesAroundValue" text="com.intellij.openapi.util.text.StringUtil.stripQuotesAroundValue($Parameter$)" recursive="false" caseInsensitive="false" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.openapi.util.text.StringUtil.unquoteString($Parameter$)">
         <constraint name="Parameter" within="" contains="" />
       </replaceConfiguration>
+      <replaceConfiguration name="can use StringUtil.trimStart" text="if ($s$.startsWith($e$)) {&#10;  $s$ = $s$.substring($e$.length());&#10;}" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$s$ = com.intellij.openapi.util.text.StringUtil.trimStart($s$, $e$);&#10;">
+        <constraint name="s" within="" contains="" />
+        <constraint name="e" within="" contains="" />
+        <constraint name="__context__" script="&quot;import com.intellij.psi.*&#10;import com.intellij.psi.search.GlobalSearchScope&#10;import com.intellij.psi.util.PsiUtil&#10;&#10;def stringUtil = JavaPsiFacade.getInstance(e.getProject()).findClass(&quot;com.intellij.openapi.util.text.StringUtil&quot;, GlobalSearchScope.allScope(e.getProject()));&#10;def strVirtualFile = PsiUtil.getVirtualFile(stringUtil);&#10;&#10;e.getParent().getParent().getParent() instanceof PsiIfStatement &amp;&amp;&#10;((PsiIfStatement)e.getParent().getParent().getParent()).getElseBranch() == null &amp;&amp;&#10;strVirtualFile != null &amp;&amp;  &#10;e.getContainingFile().getResolveScope().contains(strVirtualFile)&#10;&quot;" target="true" within="" contains="" />
+      </replaceConfiguration>
+      <replaceConfiguration name="can use StringUtil.trimEnd" text="if ($s$.endsWith($e$)) {&#10;  $s$ = $s$.substring(0, $s$.length() - $e$.length());&#10;}" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$s$ = com.intellij.openapi.util.text.StringUtil.trimEnd($s$, $e$);&#10;">
+        <constraint name="s" within="" contains="" />
+        <constraint name="e" within="" contains="" />
+        <constraint name="__context__" script="&quot;import com.intellij.psi.*&#10;import com.intellij.psi.search.GlobalSearchScope&#10;import com.intellij.psi.util.PsiUtil&#10;&#10;def stringUtil = JavaPsiFacade.getInstance(e.getProject()).findClass(&quot;com.intellij.openapi.util.text.StringUtil&quot;, GlobalSearchScope.allScope(e.getProject()));&#10;def strVirtualFile = PsiUtil.getVirtualFile(stringUtil);&#10;&#10;e instanceof PsiLiteralExpression &amp;&amp;&#10;e.getParent().getParent().getParent() instanceof PsiIfStatement &amp;&amp;&#10;((PsiIfStatement)e.getParent().getParent().getParent()).getElseBranch() == null &amp;&amp;&#10;strVirtualFile != null &amp;&amp;  &#10;e.getResolveScope().contains(strVirtualFile)&#10;&#10;&quot;" target="true" within="" contains="" />
+      </replaceConfiguration>
+      <replaceConfiguration name="can use StringUtil.trimStart() with constant" text="if ($s$.startsWith(&quot;$e$&quot;)) {&#10;  $s$ = $s$.substring($n$);&#10;}" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$s$ = com.intellij.openapi.util.text.StringUtil.trimStart($s$, &quot;$e$&quot;);&#10;">
+        <constraint name="s" within="" contains="" />
+        <constraint name="e" within="" contains="" />
+        <constraint name="n" within="" contains="" />
+        <constraint name="__context__" script="&quot;import com.intellij.psi.*&#10;import com.intellij.psi.search.GlobalSearchScope&#10;import com.intellij.psi.util.PsiUtil&#10;&#10;def stringUtil = JavaPsiFacade.getInstance(e.getProject()).findClass(&quot;com.intellij.openapi.util.text.StringUtil&quot;, GlobalSearchScope.allScope(e.getProject()));&#10;def strVirtualFile = PsiUtil.getVirtualFile(stringUtil);&#10;&#10;e instanceof PsiLiteralExpression &amp;&amp;&#10;n instanceof PsiLiteralExpression &amp;&amp;&#10;((PsiLiteralExpression)e).getValue() instanceof String &amp;&amp;&#10;((PsiLiteralExpression)n).getValue() instanceof Integer &amp;&amp;&#10;((String)((PsiLiteralExpression)e).getValue()).length() ==&#10;((Integer)((PsiLiteralExpression)n).getValue()).intValue() &amp;&amp;&#10;e.getParent().getParent().getParent() instanceof PsiIfStatement &amp;&amp;&#10;((PsiIfStatement)e.getParent().getParent().getParent()).getElseBranch() == null &amp;&amp;  &#10;strVirtualFile != null &amp;&amp;  &#10;e.getResolveScope().contains(strVirtualFile)&quot;" target="true" within="" contains="" />
+      </replaceConfiguration>
+      <replaceConfiguration name="can use StringUtil.trimEnd() with constant" text="if ($s$.endsWith(&quot;$e$&quot;)) {&#10;  $s$ = $s$.substring(0,$s$.length()-$n$);&#10;}" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$s$ = com.intellij.openapi.util.text.StringUtil.trimEnd($s$, &quot;$e$&quot;);&#10;">
+        <constraint name="s" within="" contains="" />
+        <constraint name="e" within="" contains="" />
+        <constraint name="n" within="" contains="" />
+        <constraint name="__context__" script="&quot;import com.intellij.psi.*&#10;import com.intellij.psi.search.GlobalSearchScope&#10;import com.intellij.psi.util.PsiUtil&#10;&#10;def stringUtil = JavaPsiFacade.getInstance(e.getProject()).findClass(&quot;com.intellij.openapi.util.text.StringUtil&quot;, GlobalSearchScope.allScope(e.getProject()));&#10;def strVirtualFile = PsiUtil.getVirtualFile(stringUtil);&#10;&#10;e instanceof PsiLiteralExpression &amp;&amp;&#10;n instanceof PsiLiteralExpression &amp;&amp;&#10;((PsiLiteralExpression)e).getValue() instanceof String &amp;&amp;&#10;((PsiLiteralExpression)n).getValue() instanceof Integer &amp;&amp;&#10;((String)((PsiLiteralExpression)e).getValue()).length() ==&#10;((Integer)((PsiLiteralExpression)n).getValue()).intValue() &amp;&amp;&#10;e.getParent().getParent().getParent() instanceof PsiIfStatement &amp;&amp;&#10;((PsiIfStatement)e.getParent().getParent().getParent()).getElseBranch() == null &amp;&amp;  &#10;strVirtualFile != null &amp;&amp;  &#10;e.getResolveScope().contains(strVirtualFile)&quot;" target="true" within="" contains="" />
+      </replaceConfiguration>
     </inspection_tool>
     <inspection_tool class="SeamAnnotationIncorrectSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
     <inspection_tool class="SeamAnnotationsInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
       <option name="ignoreSupers" value="true" />
     </inspection_tool>
     <inspection_tool class="TestMethodIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
-    <inspection_tool class="TestOnlyProblems" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="TestOnlyProblems" enabled="true" level="WARNING" enabled_by_default="true">
+      <scope name="test-framework" level="WARNING" enabled="false" />
+    </inspection_tool>
     <inspection_tool class="TextLabelInSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
     <inspection_tool class="ThisExpressionReferencesGlobalObjectJS" enabled="false" level="WARNING" enabled_by_default="false" />
     <inspection_tool class="ThreadDumpStack" enabled="true" level="WARNING" enabled_by_default="true">
index 77fc541298b19e2e84efa87eee06b54918086063..756f65a7ae815422223deda3f4767aa5739db09d 100644 (file)
@@ -88,6 +88,7 @@
       <module fileurl="file://$PROJECT_DIR$/platform/extensions/extensions.iml" filepath="$PROJECT_DIR$/platform/extensions/extensions.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/platform/external-system-api/external-system-api.iml" filepath="$PROJECT_DIR$/platform/external-system-api/external-system-api.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/platform/external-system-impl/external-system-impl.iml" filepath="$PROJECT_DIR$/platform/external-system-impl/external-system-impl.iml" group="platform" />
+      <module fileurl="file://$PROJECT_DIR$/platform/external-system-rt/external-system-rt.iml" filepath="$PROJECT_DIR$/platform/external-system-rt/external-system-rt.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" filepath="$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" group="java/compiler" />
       <module fileurl="file://$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" filepath="$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/plugins/git4idea/git4idea.iml" filepath="$PROJECT_DIR$/plugins/git4idea/git4idea.iml" group="plugins/VCS" />
       <module fileurl="file://$PROJECT_DIR$/plugins/google-app-engine/jps-plugin/google-app-engine-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/google-app-engine/jps-plugin/google-app-engine-jps-plugin.iml" group="plugins/GAE" />
       <module fileurl="file://$PROJECT_DIR$/plugins/gradle/gradle.iml" filepath="$PROJECT_DIR$/plugins/gradle/gradle.iml" group="plugins/gradle" />
       <module fileurl="file://$PROJECT_DIR$/plugins/gradle/jps-plugin/gradle-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/gradle/jps-plugin/gradle-jps-plugin.iml" group="plugins/gradle" />
+      <module fileurl="file://$PROJECT_DIR$/plugins/gradle/gradle-tests.iml" filepath="$PROJECT_DIR$/plugins/gradle/gradle-tests.iml" group="plugins/gradle" />
       <module fileurl="file://$PROJECT_DIR$/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml" filepath="$PROJECT_DIR$/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml" group="plugins/gradle" />
       <module fileurl="file://$PROJECT_DIR$/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml" filepath="$PROJECT_DIR$/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml" group="plugins/gradle" />
+      <module fileurl="file://$PROJECT_DIR$/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-tests.iml" filepath="$PROJECT_DIR$/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-tests.iml" group="plugins/gradle" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/jps-plugin/groovy-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/groovy/jps-plugin/groovy-jps-plugin.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" filepath="$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt-constants/groovy-rt-constants.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt-constants/groovy-rt-constants.iml" group="plugins/Groovy" />
index 520d9542668e273f13eb14b4571b9f8821079bea..1b94fc0c97c4f5de2654abdf241ff4e9184ce567 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.intellij.lang.regexp;
 
 import com.intellij.openapi.util.text.StringUtil;
@@ -134,22 +149,21 @@ public final class DefaultRegExpPropertiesProvider {
   }
 
   public boolean isValidCategory(@NotNull String category) {
-      if (category.startsWith("In")) {
-          try {
-              return Character.UnicodeBlock.forName(category.substring(2)) != null;
-          } catch (IllegalArgumentException e) {
-              return false;
-          }
+    if (category.startsWith("In")) {
+      try {
+        return Character.UnicodeBlock.forName(category.substring(2)) != null;
       }
-      if (category.startsWith("Is")) {
-          category = category.substring(2);
+      catch (IllegalArgumentException e) {
+        return false;
       }
-      for (String[] name : myPropertyNames) {
-          if (name[0].equals(category)) {
-              return true;
-          }
+    }
+    category = StringUtil.trimStart(category, "Is");
+    for (String[] name : myPropertyNames) {
+      if (name[0].equals(category)) {
+        return true;
       }
-      return false;
+    }
+    return false;
   }
 
   @Nullable
index ebdc9a2155005e3144c36c5632540d12323930e1..9b50bc4134781beb65c529fd6bac3f6efd699e70 100755 (executable)
@@ -194,7 +194,7 @@ unset IFS
 
 test $EC -ne 88 && exit $EC
 
-RESTARTER="$HOME/.@@system_selector@@/restart/restarter.sh"
+RESTARTER="$HOME/.@@system_selector@@/system/restart/restarter.sh"
 if [ -x "$RESTARTER" ]; then
   "$RESTARTER"
   "$RM" -f "$RESTARTER"
index bafc55b124a3e1221238c8cfa23a32618558c3fc..15656c8257672973306ad33b58b80bbe8544ddd9 100644 (file)
--- a/build.xml
+++ b/build.xml
     <isset property="product" />
   </condition>
 
+  <condition property="productPropertiesPath" value="${productPropertiesPath}" else="">
+    <isset property="productPropertiesPath" />
+  </condition>
+
   <property name="tmp.dir" value="${out.dir}/tmp"/>
 
   <target name="cleanup">
@@ -55,6 +59,7 @@
         <sysproperty key="buildNumber" value="${build.number}" />
         <sysproperty key="idea.test.patterns" value="${test.patterns}" />
         <sysproperty key="product" value="${product.name}" />
+        <jvmarg value="-DproductPropertiesPath=${productPropertiesPath}" />
         <sysproperty key="java.awt.headless" value="true"/>
         <sysproperty key="gant.script" value="@{script}"/>
         <sysproperty key="teamcity.build.tempDir" value="${tmp.dir}"/>
index ec0fc157ae0fcc3f606ad90b39773db1b97700f6..639a4e8503c7c43d5938ba34f6f35f0144456ed7 100644 (file)
@@ -33,6 +33,8 @@
 1.3 => lib/idea_rt.jar
 1.4 => lib/forms_rt.jar
 
+1.6 => lib/util.jar
+
 1.7 => lib/optimizedFileManager.jar
 
 1.5 => plugins/Groovy/lib/groovy_rt.jar
 1.5 => lib/annotations.jar
 1.8 => redist/annotations-java8.jar
 1.3 => plugins/junit/lib/junit-rt.jar
+
+1.6 => lib/external-system-rt.jar
+
+1.6 => plugins/gradle/lib/gradle-tooling-extension-api.jar
+1.6 => plugins/gradle/lib/gradle-tooling-extension-impl.jar
+
+1.4 => plugins/xpath/lib/rt/xslt-rt.jar
+1.5 => plugins/xslt-debugger/lib/xslt-debugger-engine.jar
+1.5 => plugins/xslt-debugger/lib/rt/xslt-debugger-engine-impl.jar
+
+1.6 => plugins/android/lib/android-rt.jar
index 19a9be603a250ab9a00a5b2f860888fb754dbc27..a9fe51f5f5ee5ddc991615101d14260d0f1cb85b 100644 (file)
@@ -62,7 +62,10 @@ loadProductProperties(home, snapshot)
 
 def loadProductProperties(String home, String buildNumber) {
   requireProperty("product", "idea")
-  def productPropertiesPath = "$home/build/scripts/" + p("product") + "_properties.gant"
+  requireProperty("productPropertiesPath", "")
+  if (productPropertiesPath.isEmpty()) {
+    productPropertiesPath = "$home/build/scripts/" + p("product") + "_properties.gant";
+  }
   if (!new File(productPropertiesPath).exists()) {
     throw new BuildException("No product specific properties file found at: " + productPropertiesPath)
   }
index 14e52d73646abc0e1575ed958e179e2393d8a670..58d9c0ab65e741e8c632a626c6cc56ec0fb27d64 100644 (file)
@@ -24,8 +24,25 @@ target('default': 'Ensures that build/kotlinc directory contains JARs from Kotli
   def communityHome = guessHome(this)
   def reasonToUpdate = getReasonToUpdate(communityHome, new File(communityHome, "build/kotlinc"))
   if (reasonToUpdate == null) {
-    projectBuilder.info("Compatible Kotlin plugin already installed, no update is required")
-    return
+    if (isDefined("workIdeaHome")) {
+      def workKotlinVersionFile = new File(workIdeaHome, "plugins/Kotlin/kotlinc/build.txt")
+      if (workKotlinVersionFile.exists()) {
+        try {
+          def currentKotlinVersionFile = new File(communityHome, "build/kotlinc/build.txt")
+          if (VersionComparatorUtil.compare(currentKotlinVersionFile.text, workKotlinVersionFile.text) < 0) {
+            reasonToUpdate = "a newer version is installed in $workIdeaHome"
+          }
+        }
+        catch (IOException e) {
+          reasonToUpdate = "cannot read Kotlin version: $e"
+        }
+      }
+    }
+
+    if (reasonToUpdate == null) {
+      projectBuilder.info("Compatible Kotlin plugin already installed, no update is required")
+      return
+    }
   }
 
   projectBuilder.info("Kotlin plugin will be updated: $reasonToUpdate")
index da1fbd1fd8750153dfb170f2da39d751369a7917..22b39bcc16de170ce803d938fd7ea6229fe5385b 100644 (file)
@@ -181,6 +181,8 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
 
       jar("extensions.jar") { module("extensions")}
 
+      jar("external-system-rt.jar") { module("external-system-rt")}
+
       jar([name: "idea.jar", duplicate: "preserve"]) {
         implementationModules.each { module it}
       }
index 6d05e7a8ae28bc968d69c1409ec24901a9ac51b3..fc758283fa4f4a143ef356273cb8e62563c1f62a 100644 (file)
  */
 package org.intellij.images.editor.impl;
 
+import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.newvfs.RefreshQueue;
 import org.intellij.images.editor.ImageDocument;
 import org.intellij.images.editor.ImageEditor;
 import org.intellij.images.editor.ImageZoomModel;
@@ -156,11 +158,12 @@ final class ImageEditorImpl implements ImageEditor {
   void contentsChanged(@NotNull VirtualFileEvent event) {
     if (file.equals(event.getFile())) {
       // Change document
-      file.refresh(true, false, new Runnable() {
+      Runnable postRunnable = new Runnable() {
         public void run() {
           setValue(file);
         }
-      });
+      };
+      RefreshQueue.getInstance().refresh(true, false, postRunnable, ModalityState.current(), file);
     }
   }
 }
index ddb4a663b2d5b0c7ab78d63f6aa7a811213a9443..49591b521988a1ce01c4bc4c94b14976689aef6a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 
 package org.intellij.images.ui;
 
+import com.intellij.ide.ui.UISettings;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.ui.JBColor;
 import com.intellij.util.ui.UIUtil;
@@ -59,6 +60,7 @@ public class ThumbnailComponentUI extends ComponentUI {
     public void paint(Graphics g, JComponent c) {
         ThumbnailComponent tc = (ThumbnailComponent) c;
         if (tc != null) {
+            UISettings.setupAntialiasing(g);
             paintBackground(g, tc);
 
             if (tc.isDirectory()) {
index 184ae5b4f830d0f11dcd86f699168a0c254e4961..f67e1bbb035514896d98da3ff93c4eca78116aef 100644 (file)
@@ -14,7 +14,5 @@
     <orderEntry type="library" scope="TEST" name="JUnit3" level="project" />
     <orderEntry type="library" name="jgoodies-forms" level="project" />
     <orderEntry type="module" module-name="instrumentation-util" exported="" />
-    <orderEntry type="module" module-name="util" scope="TEST" />
-    <orderEntry type="module" module-name="testFramework" scope="TEST" />
   </component>
 </module>
\ No newline at end of file
index 946f27760251e30cb2941a1d20d18342245b95b0..bdb3b31fcdad4699cec05f5c4e44095348db159b 100644 (file)
  */
 package com.intellij.uiDesigner.core;
 
-import com.intellij.openapi.Disposable;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.testFramework.TestLoggerFactory;
-import com.intellij.testFramework.UsefulTestCase;
-import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
 
 import javax.swing.*;
 import java.awt.*;
 
-public final class TextAreasTest extends UsefulTestCase {
-  {
-    Logger.setFactory(TestLoggerFactory.class);
-    TestLoggerFactory.enableDebugLogging(myTestRootDisposable,
-                                         new String[]{"#com.intellij.util.ui.UIUtil"});
-  }
-  private final Logger LOG = Logger.getInstance("#com.intellij.uiDesigner.core.TextAreasTest");
-
-  private String getTestStartedLogMessage(String testName) {
-    return "Starting " + getClass().getName() + "." + testName;
-  }
-
+public final class TextAreasTest extends TestCase {
   /**
    * label   |    label
    * text area (span 2)
    */
   public void test1() {
-    LOG.info(getTestStartedLogMessage("test1"));
-
     final JPanel panel = new JPanel(new GridLayoutManager(2,2, new Insets(0,0,0,0), 0, 0));
 
     final JLabel label1 = new JLabel();
@@ -63,19 +45,8 @@ public final class TextAreasTest extends UsefulTestCase {
       GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
       GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0));
 
-    LOG.info("textArea: " + textArea.toString());
-    LOG.info("LaF: " + UIManager.getLookAndFeel());
-    LOG.info("textArea.font: " + textArea.getFont());
-
-    UIDefaults uid = UIManager.getLookAndFeelDefaults();
-
-    LOG.info("UIDefaults: TextArea.font=" + uid.get("TextArea.font"));
-    LOG.info("UIDefaults: TextArea.margin=" + uid.get("TextArea.margin"));
-
-    LOG.info("textArea.getPreferredSize: " + textArea.getPreferredSize());
-
-    TestLoggerFactory.dumpLogToStdout(getTestStartedLogMessage("test1"));
-
+    assertFalse(UIManager.getLookAndFeel().getName().equals("Windows"));
+    // This check fails for Windows LaF due to its default TextArea settings, so it's not expected here. By default it's Metal on Windows.
     assertEquals(100, textArea.getPreferredSize().width);
 
     final Dimension initialPreferredSize = panel.getPreferredSize();
index 0883913855ae876d58e7c9f560dc3400d65abc31..926fc39375fb73f239d72bf9ce385756c2c1e9b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import com.intellij.compiler.ant.taskdefs.PathRef;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.ex.ProjectEx;
 import com.intellij.openapi.roots.*;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.util.ArrayUtil;
@@ -163,9 +164,7 @@ public class ModuleChunkClasspath extends Path {
                 // Module source entry?
                 for (String url : getCompilationClasses(module, ((GenerationOptionsImpl)genOptions), generateRuntimeClasspath,
                                                         generateTestClasspath, dependencyLevel == 0)) {
-                  if (url.endsWith(JarFileSystem.JAR_SEPARATOR)) {
-                    url = url.substring(0, url.length() - JarFileSystem.JAR_SEPARATOR.length());
-                  }
+                  url = StringUtil.trimEnd(url, JarFileSystem.JAR_SEPARATOR);
                   final String propertyRef = genOptions.getPropertyRefForUrl(url);
                   if (propertyRef != null) {
                     pathItems.add(new PathElementItem(propertyRef));
index 397b1eed45d6bc8074707d977f472226b8d044ab..c1775ce1900ece7122a40ae45d381e5469476371 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.debugger.engine.jdi.ThreadReferenceProxy;
 import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Comparing;
+import com.intellij.util.containers.ContainerUtil;
 import com.sun.jdi.*;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -84,7 +85,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
       }
       catch (IllegalThreadStateException ignored) {
         myName = "zombie";
-      }                    
+      }
     }
     return myName;
   }
@@ -219,13 +220,10 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
       //LOG.assertTrue(threadRef.isSuspended());
       checkValid();
 
-      if(myFrames == null) {
+      if (myFrames == null) {
         checkFrames(threadRef);
-  
-        myFrames = new ArrayList<StackFrameProxyImpl>(frameCount());
-        for (ListIterator<StackFrameProxyImpl> iterator = myFramesFromBottom.listIterator(frameCount()); iterator.hasPrevious();) {
-          myFrames.add(iterator.previous());
-        }
+
+        myFrames = ContainerUtil.reverse(new ArrayList<StackFrameProxyImpl>(myFramesFromBottom.subList(0, frameCount())));
       }
     }
     catch (ObjectCollectedException ignored) {
index 19c0880c6167ff73fd913b7c3cb93cd77e59c4dd..1fdce85e888348938df45b88b388dafb5a999bbf 100644 (file)
@@ -407,6 +407,12 @@ public class ProjectTypeStep extends ModuleWizardStep implements SettingsStep, D
         for (FrameworkSupportInModuleProvider provider : filtered) {
           for (FrameworkSupportInModuleProvider.FrameworkDependency depId : provider.getDependenciesFrameworkIds()) {
             FrameworkSupportInModuleProvider dependency = map.get(depId.getFrameworkId());
+            if (dependency == null) {
+              if (!depId.isOptional()) {
+                LOG.error("Cannot find provider '" + depId.getFrameworkId() + "' which is required for '" + provider.getId() + "'");
+              }
+              continue;
+            }
             set.add(dependency);
           }
         }
index 14203591b3a8ce80c99fd193fc1df1fb77dd370a..ce8720593f3c44fd1ed5ebc09ce562ba868abd66 100644 (file)
@@ -44,7 +44,6 @@ import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.javadoc.PsiDocComment;
 import com.intellij.psi.javadoc.PsiDocTagValue;
 import com.intellij.psi.util.*;
-import com.intellij.util.ArrayUtil;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.MostlySingularMultiMap;
 import gnu.trove.THashMap;
@@ -1339,16 +1338,6 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
       myHolder.add(HighlightUtil.checkUnhandledExceptions(expression, expression.getTextRange()));
     }
 
-    if (!myHolder.hasErrorResults() && method instanceof PsiTypeParameterListOwner) {
-      PsiTypeParameter[] typeParameters = ((PsiTypeParameterListOwner)method).getTypeParameters();
-      if (method instanceof PsiMethod) {
-        final PsiClass containingClass = ((PsiMethod)method).getContainingClass();
-        assert containingClass != null : method;
-        typeParameters = ArrayUtil.mergeArrays(typeParameters, containingClass.getTypeParameters());
-      }
-      myHolder.add(GenericsHighlightUtil.checkInferredTypeArguments(typeParameters, expression, result.getSubstitutor(), true));
-    }
-
     if (!myHolder.hasErrorResults()) {
       if (results.length == 0) {
         String description = null;
index d0001749ed062d2f6043b9c71340f3a2166bfdc2..d6c4c80abfd4bfca6b38550cd7bedb36d392a2d3 100644 (file)
@@ -54,7 +54,8 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool {
   @NotNull
   public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder h, boolean isOnTheFly) {
     return new JavaElementVisitor() {
-      @Override public void visitCallExpression(PsiCallExpression e) {
+      @Override
+      public void visitCallExpression(PsiCallExpression e) {
         validate(e, e.resolveMethod(), h);
       }
 
@@ -68,7 +69,7 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool {
 
       @Override
       public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
-        if (reference.getParent() instanceof PsiNewExpression 
+        if (reference.getParent() instanceof PsiNewExpression
             || reference.getParent() instanceof PsiAnonymousClass
             || PsiTreeUtil.getParentOfType(reference, PsiImportStatementBase.class) != null) {
           return;
@@ -82,6 +83,7 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool {
   private static void validate(@NotNull PsiElement reference, @Nullable PsiMember member, ProblemsHolder h) {
     if (member == null || !isAnnotatedAsTestOnly(member)) return;
     if (isInsideTestOnlyMethod(reference)) return;
+    if (isInsideTestOnlyField(reference)) return;
     if (isInsideTestClass(reference)) return;
     if (isUnderTestSources(reference)) return;
 
@@ -93,7 +95,7 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool {
                    member.hasModifierProperty(PsiModifier.PROTECTED) ? PsiModifier.PACKAGE_LOCAL :
                    PsiModifier.PRIVATE;
       }
-      
+
       LightModifierList modList = new LightModifierList(member.getManager(), JavaLanguage.INSTANCE, modifier);
       if (JavaResolveUtil.isAccessible(member, member.getContainingClass(), modList, reference, null, null)) {
         return;
@@ -123,13 +125,16 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool {
   }
 
   private static boolean isInsideTestOnlyMethod(PsiElement e) {
-    PsiMethod m = getTopLevelParentOfType(e, PsiMethod.class);
-    return isAnnotatedAsTestOnly(m);
+    return isAnnotatedAsTestOnly(getTopLevelParentOfType(e, PsiMethod.class));
+  }
+  
+  private static boolean isInsideTestOnlyField(PsiElement e) {
+    return isAnnotatedAsTestOnly(getTopLevelParentOfType(e, PsiField.class));
   }
 
   private static boolean isAnnotatedAsTestOnly(@Nullable PsiMember m) {
     if (m == null) return false;
-    return AnnotationUtil.isAnnotated(m, AnnotationUtil.TEST_ONLY, false, false) 
+    return AnnotationUtil.isAnnotated(m, AnnotationUtil.TEST_ONLY, false, false)
            || findVisibleForTestingAnnotation(m) != null
            || isAnnotatedAsTestOnly(m.getContainingClass());
   }
@@ -158,9 +163,9 @@ public class TestOnlyInspection extends BaseJavaBatchLocalInspectionTool {
   }
 
   private static void reportProblem(PsiElement e, PsiMember target, ProblemsHolder h) {
-    String message = target instanceof PsiClass
-                     ? InspectionsBundle.message("inspection.test.only.problems.test.only.class.reference")
-                     : InspectionsBundle.message("inspection.test.only.problems.test.only.method.call");
+    String message = InspectionsBundle.message(target instanceof PsiClass
+                                               ? "inspection.test.only.problems.test.only.class.reference"
+                                               : "inspection.test.only.problems.test.only.method.call");
     h.registerProblem(e, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
   }
 }
index 869a6d65d02f4cc08972084f2d7ab14e5382308f..eb520e2d769f0861f52565f9c96935fe41942028 100644 (file)
@@ -52,9 +52,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-public class JavaLineMarkerProvider implements LineMarkerProvider {
+public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor {
   private final DaemonCodeAnalyzerSettings myDaemonSettings;
   private final EditorColorsManager myColorsManager;
+  private final Option myLambdaOption = new Option("Lambda", AllIcons.Gutter.ImplementingFunctional);
 
   public JavaLineMarkerProvider(DaemonCodeAnalyzerSettings daemonSettings, EditorColorsManager colorsManager) {
     myDaemonSettings = daemonSettings;
@@ -79,7 +80,7 @@ public class JavaLineMarkerProvider implements LineMarkerProvider {
 
     final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(element);
     final PsiElement firstChild = element.getFirstChild();
-    if (interfaceMethod != null && firstChild != null) {
+    if (interfaceMethod != null && firstChild != null && myLambdaOption.isEnabled()) {
       return createSuperMethodLineMarkerInfo(firstChild, AllIcons.Gutter.ImplementingFunctional, Pass.UPDATE_ALL);
     }
 
@@ -293,6 +294,16 @@ public class JavaLineMarkerProvider implements LineMarkerProvider {
     }
   }
 
+  @Override
+  public String getName() {
+    return "Java line markers";
+  }
+
+  @Override
+  public Option[] getOptions() {
+    return new Option[] {myLambdaOption};
+  }
+
   private static class ArrowUpLineMarkerInfo extends MergeableLineMarkerInfo<PsiElement> {
     private ArrowUpLineMarkerInfo(@NotNull PsiElement element, @NotNull Icon icon, @NotNull MarkerType markerType, int passId) {
       super(element, element.getTextRange(), icon, passId, markerType.getTooltip(),
index 5566d086d1fc99576905dc2dfdfcbf2b501fe3e5..dce08333618c96dbd464acaa65255c11c54bbb2d 100644 (file)
@@ -349,7 +349,7 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle
                                                                            new PsiType[]{returnType},
                                                                            PsiUtil.getLanguageLevel(superClass));
 
-    final TypeMigrationRules rules = new TypeMigrationRules(TypeMigrationLabeler.getElementType(derivedClass));
+    final TypeMigrationRules rules = new TypeMigrationRules();
     final PsiSubstitutor compoundSubstitutor =
       TypeConversionUtil.getSuperClassSubstitutor(superClass, derivedClass, PsiSubstitutor.EMPTY).putAll(psiSubstitutor);
     rules.setMigrationRootType(JavaPsiFacade.getElementFactory(project).createType(baseClass, compoundSubstitutor));
index 06ce5718c2a4cba937c6e0b2147c1baf181fc447..46784f980f5cfcedb5e76068e460179826ac1181 100644 (file)
@@ -71,7 +71,7 @@ public class VariableTypeFromCallFix implements IntentionAction {
 
   @Override
   public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws IncorrectOperationException {
-    final TypeMigrationRules rules = new TypeMigrationRules(TypeMigrationLabeler.getElementType(myVar));
+    final TypeMigrationRules rules = new TypeMigrationRules();
     rules.setMigrationRootType(myExpressionType);
     rules.setBoundScope(PsiSearchHelper.SERVICE.getInstance(project).getUseScope(myVar));
 
index 6d013641eb966ef80ec9807eaa552f443f21b769..8b13d7f788a5b110b7fae2d5076c47ef83a4cc84 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.codeInsight.documentation.DocumentationManagerUtil;
 import com.intellij.javadoc.JavadocGeneratorRunProfile;
 import com.intellij.lang.ASTNode;
 import com.intellij.lang.LangBundle;
+import com.intellij.lang.java.JavaDocumentationProvider;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.JavaSdk;
@@ -328,24 +329,28 @@ public class JavaDocInfoGenerator {
     }
     if (targetElement == null) return null;
     
-    String rawFragment = null;
     if (fragment != null && targetElement instanceof PsiClass) {
       if (fragment.contains("-") || fragment.contains("(")) {
-        rawFragment = fragment;
-        fragment = null; // reference to a method
+        for (PsiMethod method : ((PsiClass)targetElement).getMethods()) {
+          Set<String> signatures = JavaDocumentationProvider.getHtmlMethodSignatures(method, true);
+          if (signatures.contains(fragment)) {
+            targetElement = method;
+            fragment = null;
+            break;
+          }
+        }
       }
       else  {
         for (PsiField field : ((PsiClass)targetElement).getFields()) {
           if (fragment.equals(field.getName())) {
-            rawFragment = fragment;
-            fragment = null; // reference to a field
+            targetElement = field;
+            fragment = null;
             break;
           }
         }
       }
     }
     return DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + JavaDocUtil.getReferenceText(targetElement.getProject(), targetElement) +
-           (rawFragment == null ? "" : ('#' + rawFragment)) +
            (fragment == null ? "" : DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL_REF_SEPARATOR + fragment);
   }
 
index c87a90646883d7f336781824b0130d837cbab89a..9bb62217944c1620983cf1e027cba5fdb3f94810 100644 (file)
@@ -386,8 +386,8 @@ public class EmptyMethodInspection extends GlobalJavaBatchInspectionTool {
     @Override
     public void applyFix(@NotNull final Project project,
                          @NotNull final CommonProblemDescriptor[] descriptors,
-                         final List<PsiElement> psiElementsToIgnore,
-                         final Runnable refreshViews) {
+                         @NotNull final List<PsiElement> psiElementsToIgnore,
+                         @Nullable final Runnable refreshViews) {
       for (CommonProblemDescriptor descriptor : descriptors) {
         RefElement refElement = (RefElement)myProcessor.getElement(descriptor);
         if (refElement.isValid() && refElement instanceof RefMethod) {
index 7a51aec785eb71cc074c83b7c27ce4faae2599d7..303c32367c8e8601aef5381f667a75b70dfe06ed 100644 (file)
@@ -66,7 +66,7 @@ public class JavaProjectDataService extends AbstractProjectDataService<JavaProje
     final DataNode<ProjectData> projectDataNode = ExternalSystemApiUtil.findParent(javaProjectDataNode, ProjectKeys.PROJECT);
 
     assert projectDataNode != null;
-    if (!ExternalSystemApiUtil.isOneToOneMapping(project, projectDataNode)) {
+    if (!ExternalSystemApiUtil.isOneToOneMapping(project, projectDataNode.getData())) {
       return;
     }
 
index 89b8849164c13d912fa1678c553527b13914f2c5..1e3336eaac6c15849ce905f5bc89738cd95f50d6 100644 (file)
@@ -102,6 +102,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
                                    "MODIFIER_LIST_WRAP",
                                    "KEEP_SIMPLE_BLOCKS_IN_ONE_LINE",
                                    "KEEP_SIMPLE_METHODS_IN_ONE_LINE",
+                                   "KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE",
                                    "KEEP_SIMPLE_CLASSES_IN_ONE_LINE",
                                    "KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE",
                                    "FOR_STATEMENT_WRAP",
@@ -393,6 +394,11 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
     "    do {\n" +
     "        x--;\n" +
     "    } while (x > 10); \n" +
+    "    try (MyResource r1 = getResource();\n" +
+    "      MyResource r2 = null) {\n" +
+    "      doSomething();\n" +
+    "    }\n" +
+    "    Runnable r = () -> {};\n" +
     "  }\n" +
     "    public static void test() \n" +
     "        throws Exception { \n" +
index 59d36b88ce70b4a6cd44ac203c7919d4d6580a52..5029f7d64ad644ca65b9c89e75c235365f1b574d 100644 (file)
@@ -22,6 +22,7 @@ import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleType;
 import com.intellij.openapi.roots.ContentEntry;
 import com.intellij.openapi.roots.SourceFolder;
+import com.intellij.openapi.roots.ui.configuration.ModuleSourceRootEditHandler;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
@@ -29,6 +30,8 @@ import org.jetbrains.jps.model.java.JavaSourceRootProperties;
 import org.jetbrains.jps.model.java.JavaSourceRootType;
 import org.jetbrains.jps.model.java.JpsJavaExtensionService;
 
+import java.util.Locale;
+
 /**
  * @author nik
  */
@@ -36,8 +39,13 @@ public class MarkGeneratedSourceRootAction extends MarkRootActionBase {
   public MarkGeneratedSourceRootAction() {
     Presentation presentation = getTemplatePresentation();
     presentation.setIcon(AllIcons.Modules.GeneratedSourceRoot);
-    presentation.setText("Generated Sources Root");
-    presentation.setDescription("Mark directory as a source root for generated files");
+
+    ModuleSourceRootEditHandler<JavaSourceRootProperties> handler = ModuleSourceRootEditHandler.getEditHandler(JavaSourceRootType.SOURCE);
+    if (handler == null) return;
+    
+    String typeName = handler.getFullRootTypeName();
+    presentation.setText("Generated " + typeName);
+    presentation.setDescription("Mark directory as a " + typeName.toLowerCase(Locale.getDefault()) + " for generated files");
   }
 
   @Override
@@ -68,7 +76,7 @@ public class MarkGeneratedSourceRootAction extends MarkRootActionBase {
   }
 
   @Override
-  protected void modifyRoots(VirtualFile vFile, ContentEntry entry) {
+  protected void modifyRoots(@NotNull VirtualFile vFile, @NotNull ContentEntry entry) {
     JavaSourceRootProperties properties = JpsJavaExtensionService.getInstance().createSourceRootProperties("", true);
     entry.addSourceFolder(vFile, JavaSourceRootType.SOURCE, properties);
   }
index 0af8706ab38c3e4b4b03772314e4984abc51479c..b19b2369808d7646cc3466c860b8fd71ff64e1e2 100644 (file)
@@ -20,12 +20,15 @@ import com.intellij.openapi.actionSystem.Presentation;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.roots.ContentEntry;
 import com.intellij.openapi.roots.SourceFolder;
+import com.intellij.openapi.roots.ui.configuration.ModuleSourceRootEditHandler;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
 import org.jetbrains.jps.model.java.JavaSourceRootProperties;
 import org.jetbrains.jps.model.java.JavaSourceRootType;
 
+import java.util.Locale;
+
 /**
  * @author nik
  */
@@ -33,8 +36,13 @@ public class UnmarkGeneratedSourceRootAction extends MarkRootActionBase {
   public UnmarkGeneratedSourceRootAction() {
     Presentation presentation = getTemplatePresentation();
     presentation.setIcon(AllIcons.Modules.SourceRoot);
-    presentation.setText("Unmark Generated Sources Root");
-    presentation.setDescription("Mark directory as an ordinary source root");
+
+    ModuleSourceRootEditHandler<JavaSourceRootProperties> handler = ModuleSourceRootEditHandler.getEditHandler(JavaSourceRootType.SOURCE);
+    if (handler == null) return;
+
+    String typeName = handler.getFullRootTypeName();
+    presentation.setText("Unmark Generated " + typeName);
+    presentation.setDescription("Mark directory as an ordinary " + typeName.toLowerCase(Locale.getDefault()));
   }
 
   @Override
@@ -49,7 +57,7 @@ public class UnmarkGeneratedSourceRootAction extends MarkRootActionBase {
   }
 
   @Override
-  protected void modifyRoots(VirtualFile vFile, ContentEntry entry) {
+  protected void modifyRoots(@NotNull VirtualFile vFile, @NotNull ContentEntry entry) {
     entry.addSourceFolder(vFile, JavaSourceRootType.SOURCE);
   }
 }
index c5ad4b06700fd650bc41f3ac7c6e70c17f996a22..a08df2d952783b62455ee0aeead0d283ae14dad7 100644 (file)
@@ -23,10 +23,12 @@ import com.intellij.ide.util.treeView.TreeViewUtil;
 import com.intellij.lang.LangBundle;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.impl.DirectoryIndex;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
 import com.intellij.psi.JavaDirectoryService;
 import com.intellij.psi.PsiDirectory;
 import com.intellij.psi.PsiPackage;
+import com.intellij.util.FontUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -41,13 +43,18 @@ public class JavaProjectViewDirectoryHelper extends ProjectViewDirectoryHelper {
     super(project, index);
   }
 
+  @Nullable
   @Override
-  public String getLocationString(@NotNull final PsiDirectory directory) {
+  public String getLocationString(@NotNull PsiDirectory directory, boolean includeUrl, boolean includeRootType) {
+    String result = null;
     PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
     if (ProjectRootsUtil.isSourceRoot(directory) && aPackage != null) {   //package prefix
-      return aPackage.getQualifiedName();
+      result = StringUtil.nullize(aPackage.getQualifiedName(), true);
     }
-    return super.getLocationString(directory);
+    String baseString = super.getLocationString(directory, includeUrl, includeRootType);
+    if (result == null) return baseString;
+    if (baseString == null) return result;
+    return result  + "," + FontUtil.spaceAndThinSpace() + baseString;
   }
 
   @Override
index 293819bf63be28755268be9d4b16058a18ab2594..65eb2d2c54bc128e851357169adfd7f4e26b1fe1 100644 (file)
@@ -29,6 +29,7 @@ import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ProjectFileIndex;
 import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -89,9 +90,7 @@ public class UsedIconsListingAction extends AnAction {
           String str = (String)value;
           if (str.startsWith("\"")) {
             str = str.substring(0);
-            if (str.endsWith("\"")) {
-              str = str.substring(0, str.length() - 1);
-            }
+            str = StringUtil.trimEnd(str, "\"");
           }
 
           if (!str.startsWith("/")) {
index dbfba1464c4cb0c6ad6e48238d75204ca200cd54..bbbcc1fecb565fc5abbd97a41bcd2562379a3aef 100644 (file)
@@ -637,13 +637,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
 
           final boolean useJava8Format = PsiUtil.isLanguageLevel8OrHigher(method);
 
-          final Set<String> signatures = new LinkedHashSet<String>();
-          signatures.add(formatMethodSignature(method, true, useJava8Format));
-          signatures.add(formatMethodSignature(method, false, useJava8Format));
-
-          signatures.add(formatMethodSignature(method, true, !useJava8Format));
-          signatures.add(formatMethodSignature(method, false, !useJava8Format));
-
+          final Set<String> signatures = getHtmlMethodSignatures(method, useJava8Format);
           for (String signature : signatures) {
             for (String classUrl : classUrls) {
               urls.add(classUrl + "#" + signature);
@@ -673,6 +667,16 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
     }
   }
 
+  public static Set<String> getHtmlMethodSignatures(PsiMethod method, boolean java8FormatFirst) {
+    final Set<String> signatures = new LinkedHashSet<String>();
+    signatures.add(formatMethodSignature(method, true, java8FormatFirst));
+    signatures.add(formatMethodSignature(method, false, java8FormatFirst));
+
+    signatures.add(formatMethodSignature(method, true, !java8FormatFirst));
+    signatures.add(formatMethodSignature(method, false, !java8FormatFirst));
+    return signatures;
+  }
+
   private static String formatMethodSignature(PsiMethod method, boolean raw, boolean java8Format) {
     int options = PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS;
     int parameterOptions = PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES;
index 595246bf1306115e17dd1cfa1e972e1c1dc89bda..27999a62ea6cc14d6821af1be5441789190f7336 100644 (file)
@@ -910,9 +910,16 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
     if (block.getParent() instanceof PsiMethod) {
       return shouldHandleAsSimpleMethod((PsiMethod)block.getParent());
     }
+    else if (block.getParent() instanceof PsiLambdaExpression) {
+      return shouldHandleAsSimpleLambda((PsiLambdaExpression)block.getParent());
+    }
     else {
       return shouldHandleAsSimpleBlock(block.getNode());
-   }
+    }
+  }
+
+  private boolean shouldHandleAsSimpleLambda(PsiLambdaExpression lambda) {
+    return mySettings.KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE && !lambda.textContains('\n');
   }
 
   @Override
index 3d75c880378eb73f68d9a06b8f8e76d7c95ccf56..5da87125af6d19747289fda1aef4c5e950e0fc73 100644 (file)
@@ -144,7 +144,7 @@ public class ExtractEnumProcessor {
         }
       }
 
-      final TypeMigrationRules rules = new TypeMigrationRules(myEnumConstants.get(0).getType());
+      final TypeMigrationRules rules = new TypeMigrationRules();
       rules.addConversionDescriptor(new EnumTypeConversionRule(myEnumConstants));
       rules.setMigrationRootType(
         JavaPsiFacade.getElementFactory(myProject).createType(myClass));
index e4cce35c88f4955e34bccb9f75baabb4dd3277a9..681e5a5a74af1c0bd49ca84e44efb21a544b0118 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiImplUtil;
+import com.intellij.psi.impl.source.PsiClassReferenceType;
 import com.intellij.psi.impl.source.PsiImmediateClassType;
 import com.intellij.psi.javadoc.PsiDocTagValue;
 import com.intellij.psi.search.PsiSearchScopeUtil;
@@ -37,11 +38,9 @@ import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.refactoring.typeMigration.usageInfo.OverridenUsageInfo;
 import com.intellij.refactoring.typeMigration.usageInfo.OverriderUsageInfo;
 import com.intellij.refactoring.typeMigration.usageInfo.TypeMigrationUsageInfo;
+import com.intellij.refactoring.util.RefactoringUtil;
 import com.intellij.usageView.UsageInfo;
-import com.intellij.util.Consumer;
-import com.intellij.util.Function;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Query;
+import com.intellij.util.*;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.graph.DFSTBuilder;
 import com.intellij.util.graph.GraphGenerator;
@@ -468,7 +467,16 @@ public class TypeMigrationLabeler {
     type = userDefinedType ? type : TypeEvaluator.substituteType(type, originalType, isContraVariantPosition);
 
     if (!userDefinedType) {
-      if (typeContainsTypeParameters(originalType)) return false;
+      final Set<PsiTypeParameter> collector;
+      final PsiType rootInitialType = getElementType(getCurrentRoot().getElement());
+      if (rootInitialType  instanceof PsiClassReferenceType) {
+        collector = new HashSet<PsiTypeParameter>();
+        final PsiJavaCodeReferenceElement reference = ((PsiClassReferenceType)rootInitialType).getReference();
+        RefactoringUtil.collectTypeParameters(collector, reference);
+      } else {
+        collector = Collections.emptySet();
+      }
+      if (typeContainsTypeParameters(originalType, collector)) return false;
     }
 
     if (type instanceof PsiCapturedWildcardType) {
@@ -571,14 +579,17 @@ public class TypeMigrationLabeler {
     }
   }
 
-  static boolean typeContainsTypeParameters(PsiType originalType) {
+  static boolean typeContainsTypeParameters(@Nullable PsiType originalType, @NotNull Set<PsiTypeParameter> excluded) {
     if (originalType instanceof PsiClassType) {
       final PsiClassType psiClassType = (PsiClassType)originalType;
       if (psiClassType.resolve() instanceof PsiTypeParameter) {
         return true;
       }
       for (PsiType paramType : psiClassType.getParameters()) {
-        if (paramType instanceof PsiClassType && ((PsiClassType)paramType).resolve() instanceof PsiTypeParameter) return true;
+        if (paramType instanceof PsiClassType) {
+          final PsiClass resolved = ((PsiClassType)paramType).resolve();
+          if (resolved instanceof PsiTypeParameter && !excluded.contains(resolved)) return true;
+        }
       }
     }
     return false;
index 64dd726d62a663c9ab953ee8f4036d45c22b128d..fb8b526611e982609c5289001b9a6c25a498f75a 100644 (file)
@@ -36,12 +36,10 @@ import java.util.LinkedList;
 public class TypeMigrationRules {
   private final LinkedList<TypeConversionRule> myConversionRules = new LinkedList<TypeConversionRule>();
 
-  private final PsiType myRootType;
   private PsiType myMigrationRootType;
   private SearchScope mySearchScope;
 
-  public TypeMigrationRules(final PsiType root) {
-    myRootType = root;
+  public TypeMigrationRules() {
     myConversionRules.add(new RootTypeConversionRule());
     myConversionRules.add(new DisjunctionTypeConversionRule());
     ContainerUtil.addAll(myConversionRules, Extensions.getExtensions(TypeConversionRule.EP_NAME));
@@ -51,10 +49,6 @@ public class TypeMigrationRules {
     myMigrationRootType = migrationRootType;
   }
 
-  public PsiType getRootType() {
-    return myRootType;
-  }
-
   public PsiType getMigrationRootType() {
     return myMigrationRootType;
   }
index bd89a643a121578540723c7ff3d0bf433d5733c8..26d1e2750c21403cdd6a10e6b1a5127b488be1c3 100644 (file)
@@ -191,7 +191,7 @@ class TypeMigrationStatementProcessor extends JavaRecursiveElementVisitor {
       final PsiType valueType = myTypeEvaluator.evaluateType(value);
       if (returnType != null && valueType != null) {
         if (!myLabeler.addMigrationRoot(method, valueType, myStatement, TypeConversionUtil.isAssignable(returnType, valueType) && !isGetter(value, method), true, true)
-            && TypeMigrationLabeler.typeContainsTypeParameters(returnType)) {
+            && TypeMigrationLabeler.typeContainsTypeParameters(returnType, Collections.<PsiTypeParameter>emptySet())) {
           value.accept(this);
         }
       }
index 21145be3859f2465a2f28b752cb65e5b6e045576..e3f246d408739a196bae3c83f489672deb3d299e 100644 (file)
@@ -208,7 +208,7 @@ public class TypeMigrationDialog extends RefactoringDialog {
     }
 
     if (myRules == null) {
-      myRules = new TypeMigrationRules(rootType);
+      myRules = new TypeMigrationRules();
       myRules.setMigrationRootType(migrationType);
       myRules.setBoundScope(myScopeChooserCombo.getSelectedScope());
     }
index 156fe4c2eda349e233f27dccec481ed3f19ab467..f0e279528494f79cd5fdf6b9f595aac724629a9b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationActivationListener;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.wm.IdeFrame;
 import com.intellij.util.Alarm;
 
@@ -77,9 +78,7 @@ public class UnscrambleListener extends ApplicationActivationListener.Adapter {
     for (String line : stacktrace.split("\n")) {
       line = line.trim();
       if (line.length() == 0) continue;
-      if (line.endsWith("\r")) {
-        line = line.substring(0, line.length() - 1);
-      }
+      line = StringUtil.trimEnd(line, "\r");
       if (STACKTRACE_LINE.matcher(line).matches()) {
         linesCount++;
       }
index 98893c1b509eb8fead73dbac13c1008a55affe4d..43756a46869654fae4458f9a259c1ce41e642114 100644 (file)
@@ -33,7 +33,7 @@ public class JdkVersionUtil {
     VERSION_STRINGS.put(JavaSdkVersion.JDK_1_6, new String[]{"1.6", "6.0"});
     VERSION_STRINGS.put(JavaSdkVersion.JDK_1_7, new String[]{"1.7", "7.0"});
     VERSION_STRINGS.put(JavaSdkVersion.JDK_1_8, new String[]{"1.8", "8.0"});
-    VERSION_STRINGS.put(JavaSdkVersion.JDK_1_9, new String[]{"1.9", "9.0"});
+    VERSION_STRINGS.put(JavaSdkVersion.JDK_1_9, new String[]{"1.9", "9.0", "9-ea"});
   }
 
   public static JavaSdkVersion getVersion(@NotNull String versionString) {
index e9f57671aaebf92bdc88a205194e7d1ac515dc90..53c3aa129b02d8b8b57291c6a6a079ef58e30727 100644 (file)
@@ -109,25 +109,40 @@ public class GenericsUtil {
         return PsiType.getJavaLangObject(manager, aClass.getResolveScope());
       }
 
+      final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
       PsiClassType[] conjuncts = new PsiClassType[supers.length];
       for (int i = 0; i < supers.length; i++) {
         PsiClass aSuper = supers[i];
         PsiSubstitutor subst1 = TypeConversionUtil.getSuperClassSubstitutor(aSuper, aClass, classResolveResult1.getSubstitutor());
         PsiSubstitutor subst2 = TypeConversionUtil.getSuperClassSubstitutor(aSuper, bClass, classResolveResult2.getSubstitutor());
         PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
+
+        final Couple<PsiType> types = Couple.<PsiType>of(elementFactory.createType(aSuper, subst1), elementFactory.createType(aSuper, subst2));
+
         for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable(aSuper)) {
           PsiType mapping1 = subst1.substitute(parameter);
           PsiType mapping2 = subst2.substitute(parameter);
 
           if (mapping1 != null && mapping2 != null) {
-            substitutor = substitutor.put(parameter, getLeastContainingTypeArgument(mapping1, mapping2, compared, manager, type1.equals(mapping1) && type2.equals(mapping2) ? aSuper : null, parameter));
+            if (compared.contains(types)) {
+              substitutor = substitutor.put(parameter, PsiWildcardType.createUnbounded(manager));
+            }
+            else {
+              compared.add(types);
+              try {
+                substitutor = substitutor.put(parameter, getLeastContainingTypeArgument(mapping1, mapping2, compared, manager));
+              }
+              finally {
+                compared.remove(types);
+              }
+            }
           }
           else {
             substitutor = substitutor.put(parameter, null);
           }
         }
 
-        conjuncts[i] = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createType(aSuper, substitutor);
+        conjuncts[i] = elementFactory.createType(aSuper, substitutor);
       }
 
       return PsiIntersectionType.createIntersection(conjuncts);
@@ -150,60 +165,37 @@ public class GenericsUtil {
   private static PsiType getLeastContainingTypeArgument(PsiType type1,
                                                         PsiType type2,
                                                         Set<Couple<PsiType>> compared,
-                                                        PsiManager manager,
-                                                        PsiClass nestedLayer,
-                                                        PsiTypeParameter parameter) {
-    Couple<PsiType> types = Couple.of(type1, type2);
-    if (compared.contains(types)) {
-      if (nestedLayer != null) {
-        PsiSubstitutor subst = PsiSubstitutor.EMPTY;
-        for (PsiTypeParameter param : PsiUtil.typeParametersIterable(nestedLayer)) {
-          subst = subst.put(param, PsiWildcardType.createUnbounded(manager));
-        }
-        subst = subst.put(parameter, getLeastContainingTypeArgument(type1, type2, compared, manager, null, null));
-
-        final PsiClassType boundType = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createType(nestedLayer, subst);
-        return PsiWildcardType.createExtends(manager, boundType);
-      }
-      return PsiWildcardType.createUnbounded(manager);
-    }
-    compared.add(types);
-
-    try {
-      if (type1 instanceof PsiWildcardType) {
-        PsiWildcardType wild1 = (PsiWildcardType)type1;
-        final PsiType bound1 = wild1.getBound();
-        if (bound1 == null) return type1;
-        if (type2 instanceof PsiWildcardType) {
-          PsiWildcardType wild2 = (PsiWildcardType)type2;
-          final PsiType bound2 = wild2.getBound();
-          if (bound2 == null) return type2;
-          if (wild1.isExtends() == wild2.isExtends()) {
-            return wild1.isExtends() ?
-                   PsiWildcardType.createExtends(manager, getLeastUpperBound(bound1, bound2, compared, manager)) :
-                   PsiWildcardType.createSuper(manager, getGreatestLowerBound(bound1, bound2));
-          }
-          else {
-            return bound1.equals(bound2) ? bound1 : PsiWildcardType.createUnbounded(manager);
-          }
+                                                        PsiManager manager) {
+    if (type1 instanceof PsiWildcardType) {
+      PsiWildcardType wild1 = (PsiWildcardType)type1;
+      final PsiType bound1 = wild1.getBound();
+      if (bound1 == null) return type1;
+      if (type2 instanceof PsiWildcardType) {
+        PsiWildcardType wild2 = (PsiWildcardType)type2;
+        final PsiType bound2 = wild2.getBound();
+        if (bound2 == null) return type2;
+        if (wild1.isExtends() == wild2.isExtends()) {
+          return wild1.isExtends() ?
+                 PsiWildcardType.createExtends(manager, getLeastUpperBound(bound1, bound2, compared, manager)) :
+                 PsiWildcardType.createSuper(manager, getGreatestLowerBound(bound1, bound2));
         }
         else {
-          return wild1.isExtends() ? PsiWildcardType.createExtends(manager, getLeastUpperBound(bound1, type2, compared, manager)) :
-                 wild1.isSuper() ? PsiWildcardType.createSuper(manager, getGreatestLowerBound(bound1, type2)) :
-                 wild1;
+          return bound1.equals(bound2) ? bound1 : PsiWildcardType.createUnbounded(manager);
         }
       }
-      else if (type2 instanceof PsiWildcardType) {
-        return getLeastContainingTypeArgument(type2, type1, compared, manager, null, null);
+      else {
+        return wild1.isExtends() ? PsiWildcardType.createExtends(manager, getLeastUpperBound(bound1, type2, compared, manager)) :
+               wild1.isSuper() ? PsiWildcardType.createSuper(manager, getGreatestLowerBound(bound1, type2)) :
+               wild1;
       }
-      //Done with wildcards
-
-      if (type1.equals(type2)) return type1;
-      return PsiWildcardType.createExtends(manager, getLeastUpperBound(type1, type2, compared, manager));
     }
-    finally {
-      compared.remove(types);
+    else if (type2 instanceof PsiWildcardType) {
+      return getLeastContainingTypeArgument(type2, type1, compared, manager);
     }
+    //Done with wildcards
+
+    if (type1.equals(type2)) return type1;
+    return PsiWildcardType.createExtends(manager, getLeastUpperBound(type1, type2, compared, manager));
   }
 
   @NotNull
@@ -283,76 +275,16 @@ public class GenericsUtil {
       }
     }
 
-    //todo process type parameter bounds
     for (PsiType type : extendsTypes) {
       PsiType extendsType = substitutor.substitute(type);
-      if (substituted instanceof PsiWildcardType) {
-        final PsiType extendsBound = ((PsiWildcardType)substituted).getExtendsBound();
-        if (acceptExtendsBound(extendsType, extendsBound)) {
-          return null;
-        }
-      }
-      else if (substituted instanceof PsiIntersectionType) {
-        for (PsiType extendsBound : ((PsiIntersectionType)substituted).getConjuncts()) {
-          if (acceptExtendsBound(extendsType, extendsBound)) return null;
-        }
-      }
-      else if (substituted instanceof PsiCapturedWildcardType) {
-        final PsiType extendsBound = ((PsiCapturedWildcardType)substituted).getUpperBound();
-        if (acceptExtendsBound(extendsType, extendsBound) || extendsType.equals(extendsBound)) {
-          return null;
-        }
-      }
       if (extendsType != null && 
-          !TypeConversionUtil.isAssignable(extendsType, substituted, allowUncheckedConversion) &&
-          !TypeConversionUtil.isAssignable(type, substituted, allowUncheckedConversion)) {
+          !TypeConversionUtil.isAssignable(extendsType, substituted, allowUncheckedConversion)) {
         return extendsType;
       }
     }
     return null;
   }
 
-  public static boolean acceptExtendsBound(PsiType extendsType, PsiType extendsBound) {
-    if (Comparing.equal(TypeConversionUtil.erasure(extendsType), TypeConversionUtil.erasure(extendsBound))) {
-      if (extendsBound instanceof PsiClassType) {
-        if (acceptExtendsBound((PsiClassType)extendsBound, 0)) return true;
-      }
-      else if (extendsBound instanceof PsiIntersectionType) {
-        for (PsiType psiType : ((PsiIntersectionType)extendsBound).getConjuncts()) {
-          if (psiType instanceof PsiClassType) {
-            if (acceptExtendsBound((PsiClassType)psiType, 0)) return true;
-          }
-        }
-      }
-    }
-    return false;
-  }
-
-  private static boolean acceptExtendsBound(PsiClassType extendsBound, int depth) {
-    PsiType[] parameters = extendsBound.getParameters();
-    if (parameters.length == 1) {
-      PsiType argType = parameters[0];
-      if (argType instanceof PsiCapturedWildcardType && depth == 0) {
-        argType = ((PsiCapturedWildcardType)argType).getWildcard();
-      }
-      if (argType instanceof PsiWildcardType) {
-        if (!((PsiWildcardType)argType).isBounded()) return true;
-        final PsiType bound = ((PsiWildcardType)argType).getExtendsBound();
-        if (bound instanceof PsiClassType && TypeConversionUtil.erasure(bound).equals(TypeConversionUtil.erasure(extendsBound))) {
-          return acceptExtendsBound((PsiClassType)bound, depth + 1);
-        }
-        if (bound instanceof PsiIntersectionType) {
-          for (PsiType extendsType : ((PsiIntersectionType)bound).getConjuncts()) {
-            if (acceptExtendsBound(extendsBound, extendsType)) {
-              return true;
-            }
-          }
-        }
-      }
-    }
-    return false;
-  }
-
   public static boolean isFromExternalTypeLanguage(@NotNull PsiType type) {
     String internalCanonicalText = type.getInternalCanonicalText();
     return internalCanonicalText != null && internalCanonicalText.equals(type.getCanonicalText());
index 342826d985360bed10d50d4f8f20aa250cbadd5b..2e0f4afa8e09c68f277ba5871d5072ba75354cb8 100644 (file)
@@ -55,8 +55,40 @@ public class PsiCapturedWildcardType extends PsiType.Stub {
     myUpperBound = PsiType.getJavaLangObject(myContext.getManager(), getResolveScope());
   }
 
-  private static RecursionGuard guard = RecursionManager.createGuard("captureGuard");
-  
+  public static RecursionGuard guard = RecursionManager.createGuard("captureGuard");
+
+  public static boolean isCapture() {
+    return guard.currentStack().isEmpty();
+  }
+
+  @Nullable
+  public static PsiType captureUpperBound(@NotNull PsiTypeParameter typeParameter,
+                                          @NotNull PsiWildcardType wildcardType,
+                                          @NotNull PsiSubstitutor captureSubstitutor) {
+    final PsiType[] boundTypes = typeParameter.getExtendsListTypes();
+    PsiType originalBound = !wildcardType.isSuper() ? wildcardType.getBound() : null;
+    PsiType glb = originalBound;
+    for (PsiType boundType : boundTypes) {
+      final PsiType substitutedBoundType = captureSubstitutor.substitute(boundType);
+      //glb for array types is not specified yet
+      if (originalBound instanceof PsiArrayType &&
+          substitutedBoundType instanceof PsiArrayType &&
+          !originalBound.isAssignableFrom(substitutedBoundType) &&
+          !substitutedBoundType.isAssignableFrom(originalBound)) {
+        continue;
+      }
+
+      if (glb == null) {
+        glb = substitutedBoundType;
+      }
+      else {
+        glb = GenericsUtil.getGreatestLowerBound(glb, substitutedBoundType);
+      }
+    }
+
+    return glb;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (!(o instanceof PsiCapturedWildcardType)) {
@@ -86,7 +118,7 @@ public class PsiCapturedWildcardType extends PsiType.Stub {
         }
       });
 
-      if (sameUpperBounds != null && sameUpperBounds) {
+      if (sameUpperBounds == null || sameUpperBounds) {
         return true;
       }
     }
index cf5cf7a8b555c1f5e67b0a2a4def708e336ff048..f46e68012ed940778db6f3761d93d92fec804386 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.psi;
 
+import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.PsiUtil;
@@ -58,10 +59,18 @@ public class PsiIntersectionType extends PsiType.Stub {
     return new PsiIntersectionType(conjuncts);
   }
 
-  private static PsiType[] flattenAndRemoveDuplicates(PsiType[] conjuncts) {
+  private static PsiType[] flattenAndRemoveDuplicates(final PsiType[] conjuncts) {
     try {
-      Set<PsiType> flattened = flatten(conjuncts, ContainerUtil.<PsiType>newLinkedHashSet());
-      return flattened.toArray(createArray(flattened.size()));
+      final Set<PsiType> flattenConjuncts = PsiCapturedWildcardType.guard.doPreventingRecursion(conjuncts, true, new Computable<Set<PsiType>>() {
+        @Override
+        public Set<PsiType> compute() {
+          return flatten(conjuncts, ContainerUtil.<PsiType>newLinkedHashSet());
+        }
+      });
+      if (flattenConjuncts == null) {
+        return conjuncts;
+      }
+      return flattenConjuncts.toArray(createArray(flattenConjuncts.size()));
     }
     catch (NoSuchElementException e) {
       throw new RuntimeException(Arrays.toString(conjuncts), e);
index cb497e6240001b22972ceaae25215cbf5e308689..296fe82cd412c8845f17457c5acb896e01a62810 100644 (file)
@@ -125,7 +125,7 @@ public class MethodCandidateInfo extends CandidateInfo{
     
     if (isToInferApplicability()) {
       //already performed checks, so if inference failed, error message should be saved  
-      if (myInferenceError != null) {
+      if (myInferenceError != null || !isPotentiallyCompatible()) {
         return ApplicabilityLevel.NOT_APPLICABLE;
       }
       return isVarargs() ? ApplicabilityLevel.VARARGS : ApplicabilityLevel.FIXED_ARITY;
@@ -173,8 +173,19 @@ public class MethodCandidateInfo extends CandidateInfo{
       final PsiParameter[] parameters = method.getParameterList().getParameters();
       final PsiExpression[] expressions = ((PsiExpressionList)myArgumentList).getExpressions();
 
-      if (!isVarargs() && expressions.length != parameters.length) {
-        return true;
+      if (!isVarargs() &&  myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
+        if (expressions.length != parameters.length) {
+          return false;
+        }
+      }
+      else {
+        if (expressions.length < parameters.length - 1) {
+          return false;
+        }
+
+        if (parameters.length == 0 && expressions.length != parameters.length) {
+          return false;
+        }
       }
 
       for (int i = 0; i < expressions.length; i++) {
index a9e2b49726ae53e8b287731522c1bf6bb48879b5..6141e725b213531b3cf3807a1edc5525b634df23 100644 (file)
@@ -609,8 +609,10 @@ public final class PsiUtil extends PsiUtilCore {
    * would be equivalent
    */
   public static boolean equalOnEquivalentClasses(PsiClassType thisClassType, @NotNull PsiClass aClass, PsiClassType otherClassType, @NotNull PsiClass bClass) {
-    final PsiClassType capture1 = (PsiClassType)captureToplevelWildcards(thisClassType, aClass);
-    final PsiClassType capture2 = (PsiClassType)captureToplevelWildcards(otherClassType, bClass);
+    final PsiClassType capture1 = !PsiCapturedWildcardType.isCapture()
+                                  ? thisClassType : (PsiClassType)captureToplevelWildcards(thisClassType, aClass);
+    final PsiClassType capture2 = !PsiCapturedWildcardType.isCapture()
+                                  ? otherClassType : (PsiClassType)captureToplevelWildcards(otherClassType, bClass);
 
     final PsiClassType.ClassResolveResult result1 = capture1.resolveGenerics();
     final PsiClassType.ClassResolveResult result2 = capture2.resolveGenerics();
@@ -770,8 +772,13 @@ public final class PsiUtil extends PsiUtilCore {
           final PsiType substituted = substitutor.substitute(typeParameter);
           if (substituted instanceof PsiWildcardType) {
             if (substitutionMap == null) substitutionMap = new HashMap<PsiTypeParameter, PsiType>(substitutor.getSubstitutionMap());
-            substitutionMap.put(typeParameter,
-                                captureTypeParameterBounds(typeParameter, substituted, context, captureSubstitutor));
+            final PsiCapturedWildcardType capturedWildcard = (PsiCapturedWildcardType)captureSubstitutor.substitute(typeParameter);
+            LOG.assertTrue(capturedWildcard != null);
+            final PsiType upperBound = PsiCapturedWildcardType.captureUpperBound(typeParameter, (PsiWildcardType)substituted, captureSubstitutor);
+            if (upperBound != null) {
+              capturedWildcard.setUpperBound(upperBound);
+            }
+            substitutionMap.put(typeParameter, capturedWildcard);
           }
         }
 
@@ -789,66 +796,6 @@ public final class PsiUtil extends PsiUtilCore {
     return type;
   }
 
-  public static PsiType captureTypeParameterBounds(@NotNull PsiTypeParameter typeParameter, PsiType substituted,
-                                                   PsiElement context,
-                                                   PsiSubstitutor captureSubstitutor) {
-    PsiType oldSubstituted = substituted;
-    PsiElement captureContext = context;
-    if (substituted instanceof PsiCapturedWildcardType) {
-      final PsiCapturedWildcardType captured = (PsiCapturedWildcardType)substituted;
-      substituted = captured.getWildcard();
-      captureContext = captured.getContext();
-    }
-    PsiType glb = null;
-    if (substituted instanceof PsiWildcardType) {
-      final PsiType[] boundTypes = typeParameter.getExtendsListTypes();
-      PsiManager manager = typeParameter.getManager();
-      PsiType originalBound = !((PsiWildcardType)substituted).isSuper() ? ((PsiWildcardType)substituted).getBound() : null;
-      glb = originalBound;
-      for (PsiType boundType : boundTypes) {
-        PsiType substitutedBoundType = captureSubstitutor.substitute(boundType);
-        if (substitutedBoundType != null && !(substitutedBoundType instanceof PsiWildcardType) &&
-            !substitutedBoundType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
-          if (originalBound instanceof PsiArrayType &&
-              substitutedBoundType instanceof PsiArrayType &&
-              !originalBound.isAssignableFrom(substitutedBoundType) &&
-              !substitutedBoundType.isAssignableFrom(originalBound)) {
-            continue;
-          }
-
-          if (originalBound == null ||
-              !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(TypeConversionUtil.erasure(originalBound)) &&
-              !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(originalBound)) { //erasure is essential to avoid infinite recursion
-
-            if (glb == null) {
-              glb = substitutedBoundType;
-            }
-            else {
-              glb = GenericsUtil.getGreatestLowerBound(glb, substitutedBoundType);
-            }
-          }
-        }
-      }
-
-      if (glb != null && !((PsiWildcardType)substituted).isSuper()) {
-        substituted = glb instanceof PsiCapturedWildcardType ? ((PsiCapturedWildcardType)glb).getWildcard()
-                                                             : PsiWildcardType.createExtends(manager, glb);
-      }
-    }
-
-    if (captureContext != null) {
-      substituted =
-        oldSubstituted instanceof PsiCapturedWildcardType && substituted.equals(((PsiCapturedWildcardType)oldSubstituted).getWildcard())
-        ? oldSubstituted
-        : captureSubstitutor.substitute(typeParameter);
-      LOG.assertTrue(substituted instanceof PsiCapturedWildcardType);
-      if (glb != null) {
-        ((PsiCapturedWildcardType)substituted).setUpperBound(glb);
-      }
-    }
-    return substituted;
-  }
-
   public static boolean isInsideJavadocComment(PsiElement element) {
     return PsiTreeUtil.getParentOfType(element, PsiDocComment.class, true) != null;
   }
index 4196b34ebd9b45308bb27c7dfbd1c2b080dd7388..fa8711e1027043d75d67365777e5e9cea97eed9c 100644 (file)
@@ -704,6 +704,13 @@ public class TypeConversionUtil {
   }
 
   public static boolean isAssignable(@NotNull PsiType left, @NotNull PsiType right, boolean allowUncheckedConversion) {
+    return isAssignable(left, right, allowUncheckedConversion, true);
+  }
+
+  private static boolean isAssignable(@NotNull PsiType left,
+                                      @NotNull PsiType right,
+                                      boolean allowUncheckedConversion,
+                                      boolean capture) {
     if (left == right || left.equals(right)) return true;
 
     if (isNullType(right)) {
@@ -737,24 +744,24 @@ public class TypeConversionUtil {
     if (left instanceof PsiIntersectionType) {
       PsiType[] conjuncts = ((PsiIntersectionType)left).getConjuncts();
       for (PsiType conjunct : conjuncts) {
-        if (!isAssignable(conjunct, right, allowUncheckedConversion)) return false;
+        if (!isAssignable(conjunct, right, allowUncheckedConversion, capture)) return false;
       }
       return true;
     }
     if (right instanceof PsiIntersectionType) {
       PsiType[] conjuncts = ((PsiIntersectionType)right).getConjuncts();
       for (PsiType conjunct : conjuncts) {
-        if (isAssignable(left, conjunct, allowUncheckedConversion)) return true;
+        if (isAssignable(left, conjunct, allowUncheckedConversion, capture)) return true;
       }
       return false;
     }
 
     if (right instanceof PsiCapturedWildcardType) {
-      return isAssignable(left, ((PsiCapturedWildcardType)right).getUpperBound(), allowUncheckedConversion);
+      return isAssignable(left, ((PsiCapturedWildcardType)right).getUpperBound(), allowUncheckedConversion, capture);
     }
 
     if (left instanceof PsiCapturedWildcardType) {
-      return left.equals(right) || isAssignable(((PsiCapturedWildcardType)left).getLowerBound(), right, allowUncheckedConversion);
+      return left.equals(right) || isAssignable(((PsiCapturedWildcardType)left).getLowerBound(), right, allowUncheckedConversion, capture);
     }
 
     if (left instanceof PsiWildcardType) {
@@ -781,17 +788,17 @@ public class TypeConversionUtil {
       if (lCompType instanceof PsiPrimitiveType) {
         return lCompType.equals(rCompType);
       }
-      return !(rCompType instanceof PsiPrimitiveType) && isAssignable(lCompType, rCompType, allowUncheckedConversion);
+      return !(rCompType instanceof PsiPrimitiveType) && isAssignable(lCompType, rCompType, allowUncheckedConversion, capture);
     }
 
     if (left instanceof PsiDisjunctionType) {
       for (PsiType type : ((PsiDisjunctionType)left).getDisjunctions()) {
-        if (isAssignable(type, right, allowUncheckedConversion)) return true;
+        if (isAssignable(type, right, allowUncheckedConversion, capture)) return true;
       }
       return false;
     }
     if (right instanceof PsiDisjunctionType) {
-      return isAssignable(left, ((PsiDisjunctionType)right).getLeastUpperBound(), allowUncheckedConversion);
+      return isAssignable(left, ((PsiDisjunctionType)right).getLeastUpperBound(), allowUncheckedConversion, capture);
     }
 
     if (left instanceof PsiArrayType) return false;
@@ -830,7 +837,7 @@ public class TypeConversionUtil {
              && rText.endsWith(lText)
              && rText.charAt(rText.length() - lText.length() - 1) == '.';
     }
-    return isClassAssignable(leftResult, rightResult, allowUncheckedConversion, left.getResolveScope());
+    return isClassAssignable(leftResult, rightResult, allowUncheckedConversion, left.getResolveScope(), capture);
   }
 
   private static boolean isAssignableFromWildcard(@NotNull PsiType left, @NotNull PsiWildcardType rightWildcardType) {
@@ -923,19 +930,22 @@ public class TypeConversionUtil {
 
   private static boolean isClassAssignable(@NotNull PsiClassType.ClassResolveResult leftResult,
                                            @NotNull PsiClassType.ClassResolveResult rightResult,
-                                           boolean allowUncheckedConversion, GlobalSearchScope resolveScope) {
+                                           boolean allowUncheckedConversion, 
+                                           GlobalSearchScope resolveScope, 
+                                           boolean capture) {
     final PsiClass leftClass = leftResult.getElement();
     final PsiClass rightClass = rightResult.getElement();
     if (leftClass == null || rightClass == null) return false;
 
     PsiSubstitutor superSubstitutor = JavaClassSupers.getInstance().getSuperClassSubstitutor(leftClass, rightClass, resolveScope,
                                                                                              rightResult.getSubstitutor());
-    return superSubstitutor != null && typeParametersAgree(leftResult, rightResult, allowUncheckedConversion, superSubstitutor);
+    return superSubstitutor != null && typeParametersAgree(leftResult, rightResult, allowUncheckedConversion, superSubstitutor, capture);
   }
 
   private static boolean typeParametersAgree(@NotNull PsiClassType.ClassResolveResult leftResult,
                                              @NotNull PsiClassType.ClassResolveResult rightResult,
-                                             boolean allowUncheckedConversion, PsiSubstitutor superSubstitutor) {
+                                             boolean allowUncheckedConversion, PsiSubstitutor superSubstitutor,
+                                             boolean capture) {
     PsiSubstitutor rightSubstitutor = rightResult.getSubstitutor();
     PsiClass leftClass = leftResult.getElement();
     PsiClass rightClass = rightResult.getElement();
@@ -958,7 +968,9 @@ public class TypeConversionUtil {
       PsiTypeParameter rp = ri.next();
       final PsiType typeLeft = leftSubstitutor.substitute(lp);
       if (typeLeft == null) continue;
-      final PsiType typeRight = rightSubstitutor.substituteWithBoundsPromotion(rp);
+      final PsiType typeRight = PsiCapturedWildcardType.isCapture() && capture
+                                ? rightSubstitutor.substituteWithBoundsPromotion(rp)
+                                : rightSubstitutor.substitute(rp);
       if (typeRight == null) {
         // compatibility feature: allow to assign raw types to generic ones
         return allowUncheckedConversion;
@@ -987,7 +999,7 @@ public class TypeConversionUtil {
       if (typeRight instanceof PsiWildcardType) {
         final PsiWildcardType rightWildcard = (PsiWildcardType)typeRight;
         if (leftWildcard.isExtends()) {
-          return rightWildcard.isExtends() && isAssignable(leftBound, rightWildcard.getBound(), allowUncheckedConversion);
+          return rightWildcard.isExtends() && isAssignable(leftBound, rightWildcard.getBound(), allowUncheckedConversion, false);
         }
         else { //isSuper
           if (rightWildcard.isSuper()) {
@@ -995,7 +1007,7 @@ public class TypeConversionUtil {
               @NotNull
               @Override
               public Boolean compute() {
-                return isAssignable(rightWildcard.getBound(), leftBound, allowUncheckedConversion);
+                return isAssignable(rightWildcard.getBound(), leftBound, allowUncheckedConversion, false);
               }
             });
             if (assignable != null && assignable) {
@@ -1007,14 +1019,14 @@ public class TypeConversionUtil {
       }
       else {
         if (leftWildcard.isExtends()) {
-          return isAssignable(leftBound, typeRight, false);
+          return isAssignable(leftBound, typeRight, false, false);
         }
         else { // isSuper
           final Boolean assignable = ourGuard.doPreventingRecursion(leftWildcard, true, new NotNullComputable<Boolean>() {
             @NotNull
             @Override
             public Boolean compute() {
-              return isAssignable(typeRight, leftBound, false);
+              return isAssignable(typeRight, leftBound, false, false);
             }
           });
           return assignable == null || assignable.booleanValue(); 
index 8d54f2b952feb02da6612dd323cfb92f1f877d6a..8800579563e2c922ce2c5d493a66e7493f08c046 100644 (file)
@@ -682,8 +682,15 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
       return settings.isCollapseImports();
     }
     else if (element instanceof PsiMethod || element instanceof PsiClassInitializer || element instanceof PsiCodeBlock) {
-      if (element instanceof PsiMethod && isSimplePropertyAccessor((PsiMethod)element)) {
-        return settings.isCollapseAccessors();
+      if (element instanceof PsiMethod) {
+
+        if (!settings.isCollapseAccessors() && !settings.isCollapseMethods()) {
+          return false;
+        }
+
+        if (isSimplePropertyAccessor((PsiMethod)element)) {
+          return settings.isCollapseAccessors();
+        }
       }
       return settings.isCollapseMethods();
     }
index 99c70a74557a4b1b9082781d5706ef79c824d319..809417d62663055092da9cf4240ece7ffb6305f8 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.psi.impl;
 
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceBound;
+import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceVariable;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.JavaClassSupers;
@@ -25,6 +26,8 @@ import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -39,17 +42,22 @@ public class JavaClassSupersImpl extends JavaClassSupers {
                                                  @NotNull GlobalSearchScope scope,
                                                  @NotNull PsiSubstitutor derivedSubstitutor) {
     if (InheritanceImplUtil.hasObjectQualifiedName(superClass)) return PsiSubstitutor.EMPTY;
-    if (superClass instanceof InferenceVariable && !(derivedClass instanceof PsiTypeParameter)) {
-      for (PsiType lowerBound : ((InferenceVariable)superClass).getBounds(InferenceBound.LOWER)) {
-        if (lowerBound instanceof PsiClassType) {
-          final PsiClassType.ClassResolveResult result = ((PsiClassType)lowerBound).resolveGenerics();
-          final PsiClass boundClass = result.getElement();
-          if (boundClass != null && boundClass.equals(derivedClass)) {
-            final PsiSubstitutor substitutor = getSuperSubstitutorWithCaching(boundClass, 
-                                                                              derivedClass, scope, result.getSubstitutor());
-            if (substitutor != null) {
-              return composeSubstitutors(derivedSubstitutor, substitutor, boundClass);
-            }
+    if (!(derivedClass instanceof PsiTypeParameter)) {
+      List<PsiType> bounds = null;
+      if (superClass instanceof InferenceVariable) {
+        bounds = ((InferenceVariable)superClass).getBounds(InferenceBound.LOWER);
+      }
+      else if (superClass instanceof PsiTypeParameter) {
+        final PsiType lowerBound = superClass.getUserData(InferenceSession.LOWER_BOUND);
+        if (lowerBound != null) {
+          bounds = Collections.singletonList(lowerBound);
+        }
+      }
+      if (bounds != null) {
+        for (PsiType lowerBound : bounds) {
+          final PsiSubstitutor substitutor = processLowerBound(lowerBound, derivedClass, scope, derivedSubstitutor);
+          if (substitutor != null) {
+            return substitutor;
           }
         }
       }
@@ -59,6 +67,32 @@ public class JavaClassSupersImpl extends JavaClassSupers {
            ? processTypeParameter((PsiTypeParameter)derivedClass, scope, superClass, ContainerUtil.<PsiTypeParameter>newTroveSet(), derivedSubstitutor)
            : getSuperSubstitutorWithCaching(superClass, derivedClass, scope, derivedSubstitutor);
   }
+  
+  private static PsiSubstitutor processLowerBound(@NotNull PsiType lowerBound, 
+                                                  @NotNull PsiClass derivedClass,
+                                                  @NotNull GlobalSearchScope scope,
+                                                  @NotNull PsiSubstitutor derivedSubstitutor) {
+    if (lowerBound instanceof PsiClassType) {
+      final PsiClassType.ClassResolveResult result = ((PsiClassType)lowerBound).resolveGenerics();
+      final PsiClass boundClass = result.getElement();
+      if (boundClass != null) {
+        final PsiSubstitutor substitutor = getSuperSubstitutorWithCaching(boundClass,
+                                                                          derivedClass, scope, result.getSubstitutor());
+        if (substitutor != null) {
+          return composeSubstitutors(derivedSubstitutor, substitutor, boundClass);
+        }
+      }
+    }
+    else if (lowerBound instanceof PsiIntersectionType) {
+      for (PsiType bound : ((PsiIntersectionType)lowerBound).getConjuncts()) {
+        final PsiSubstitutor substitutor = processLowerBound(bound, derivedClass, scope, derivedSubstitutor);
+        if (substitutor != null) {
+          return substitutor;
+        }
+      }
+    }
+    return null;
+  }
 
   @Nullable
   private static PsiSubstitutor getSuperSubstitutorWithCaching(@NotNull PsiClass superClass,
index 2c0a16d03edef60be9da1d7806f5faa087699e54..6f92e020a8cf782723914c6406a20e43afdebafb 100644 (file)
@@ -1031,6 +1031,20 @@ public class PsiClassImplUtil {
     if (psiClass.isAnnotationType()) {
       return new PsiClassType[]{getAnnotationSuperType(psiClass, JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory())};
     }
+    PsiType upperBound = psiClass.getUserData(InferenceSession.UPPER_BOUND);
+    if (upperBound instanceof PsiIntersectionType) {
+      final PsiType[] conjuncts = ((PsiIntersectionType)upperBound).getConjuncts();
+      final List<PsiClassType> result = new ArrayList<PsiClassType>();
+      for (PsiType conjunct : conjuncts) {
+        if (conjunct instanceof PsiClassType) {
+          result.add((PsiClassType)conjunct);
+        }
+      }
+      return result.toArray(new PsiClassType[result.size()]);
+    }
+    else if (upperBound instanceof PsiClassType) {
+      return new PsiClassType[] {(PsiClassType)upperBound};
+    }
     final PsiReferenceList extendsList = psiClass.getExtendsList();
     if (extendsList != null) {
       return extendsList.getReferencedTypes();
index 936b11140d9173036027ac9a736a5146d35cab08..ed6faa53331d548cf21641a3076d5ccf3d0f8556 100644 (file)
@@ -106,7 +106,16 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
 
   @Override
   public PsiType substituteWithBoundsPromotion(@NotNull PsiTypeParameter typeParameter) {
-    return PsiUtil.captureTypeParameterBounds(typeParameter, substitute(typeParameter), null, this);
+    final PsiType substituted = substitute(typeParameter);
+    if (substituted instanceof PsiWildcardType && !((PsiWildcardType)substituted).isSuper()) {
+      final PsiWildcardType wildcardType = (PsiWildcardType)substituted;
+      final PsiType glb = PsiCapturedWildcardType.captureUpperBound(typeParameter, wildcardType, this);
+      if (glb != null ) {
+        return glb instanceof PsiCapturedWildcardType ? ((PsiCapturedWildcardType)glb).getWildcard()
+                                                      : PsiWildcardType.createExtends(typeParameter.getManager(), glb);
+      }
+    }
+    return substituted;
   }
 
   public boolean equals(final Object o) {
index e54bc203ca79b14051a6f00ed73e85e036e27e0f..e6a06e5108bd716a4b227adae54d7a5dbbe1c7aa 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.intellij.psi.impl.source.resolve.graphInference;
 
-import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Key;
@@ -42,6 +41,7 @@ import java.util.*;
 public class InferenceSession {
   private static final Logger LOG = Logger.getInstance("#" + InferenceSession.class.getName());
   public static final Key<PsiType> LOWER_BOUND = Key.create("LowBound");
+  public static final Key<PsiType> UPPER_BOUND = Key.create("UpperBound");
   private static final Key<PsiElement> ORIGINAL_CONTEXT = Key.create("ORIGINAL_CONTEXT");
   private static final Key<Boolean> ERASED = Key.create("UNCHECKED_CONVERSION");
   private static final Function<Pair<PsiType, PsiType>, PsiType> UPPER_BOUND_FUNCTION = new Function<Pair<PsiType, PsiType>, PsiType>() {
@@ -985,24 +985,10 @@ public class InferenceSession {
         }
       }
 
-      final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getManager().getProject());
-      final PsiTypeParameter[] freshParameters = createFreshVariables(vars, substitutor);
-      for (int i = 0; i < freshParameters.length; i++) {
-        PsiTypeParameter parameter = freshParameters[i];
-        final InferenceVariable var = vars.get(i);
-        final PsiType lub = getLowerBound(var, substitutor);
-        if (lub != PsiType.NULL) {
-          for (PsiClassType upperBoundType : parameter.getExtendsListTypes()) {
-            if (!TypeConversionUtil.isAssignable(upperBoundType, lub)) {
-              return null;
-            }
-          }
-          parameter.putUserData(LOWER_BOUND, lub);
-        }
-        if (!var.addBound(elementFactory.createType(parameter), InferenceBound.EQ)) {
-          return null;
-        }
+      if (!initFreshVariables(substitutor, vars)) {
+        return null;
       }
+
       myIncorporationPhase.forgetCaptures(vars);
       if (!repeatInferencePhases(true)) {
         return null;
@@ -1011,38 +997,36 @@ public class InferenceSession {
     return substitutor;
   }
 
-  private PsiTypeParameter[] createFreshVariables(final List<InferenceVariable> vars, final PsiSubstitutor siteSubstitutor) {
+  private boolean initFreshVariables(PsiSubstitutor substitutor, List<InferenceVariable> vars) {
     final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getManager().getProject());
-
-    PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
+    PsiSubstitutor ySubstitutor = PsiSubstitutor.EMPTY;
     final PsiTypeParameter[] yVars = new PsiTypeParameter[vars.size()];
     for (int i = 0; i < vars.size(); i++) {
       InferenceVariable var = vars.get(i);
       final PsiTypeParameter parameter = var.getParameter();
       yVars[i] = elementFactory.createTypeParameterFromText(getFreshVariableName(var), parameter);
-      substitutor = substitutor.put(var, elementFactory.createType(yVars[i]));
-    }
-
-
-    final PsiSubstitutor ySubstitutor = substitutor;
-    final String classText = "class I<" + StringUtil.join(vars, new Function<InferenceVariable, String>() {
-      @Override
-      public String fun(InferenceVariable variable) {
-        final PsiType glb = composeBound(variable, InferenceBound.UPPER, UPPER_BOUND_FUNCTION, ySubstitutor.putAll(siteSubstitutor), true);
-        return getFreshVariableName(variable) + " extends " + glb.getInternalCanonicalText();
-      }
-    }, ", ") + ">{}";
-
-    final PsiFile file =
-      PsiFileFactory.getInstance(getManager().getProject()).createFileFromText("inference_dummy.java", JavaFileType.INSTANCE, classText);
-    LOG.assertTrue(file instanceof PsiJavaFile, classText);
-    final PsiClass[] classes = ((PsiJavaFile)file).getClasses();
-    LOG.assertTrue(classes.length == 1, classText);
-    final PsiTypeParameter[] parameters = classes[0].getTypeParameters();
-    for (PsiTypeParameter parameter : parameters) {
+      ySubstitutor = ySubstitutor.put(var, elementFactory.createType(yVars[i]));
+    }
+    for (int i = 0; i < yVars.length; i++) {
+      PsiTypeParameter parameter = yVars[i];
+      final InferenceVariable var = vars.get(i);
+      final PsiType lub = getLowerBound(var, substitutor);
+      if (lub != PsiType.NULL) {
+        for (PsiClassType upperBoundType : parameter.getExtendsListTypes()) {
+          if (!TypeConversionUtil.isAssignable(upperBoundType, lub)) {
+            return false;
+          }
+        }
+        parameter.putUserData(LOWER_BOUND, lub);
+      }
+      parameter.putUserData(UPPER_BOUND,
+                            composeBound(var, InferenceBound.UPPER, UPPER_BOUND_FUNCTION, ySubstitutor.putAll(substitutor), true));
       parameter.putUserData(ORIGINAL_CONTEXT, myContext);
+      if (!var.addBound(elementFactory.createType(parameter), InferenceBound.EQ)) {
+        return false;
+      }
     }
-    return parameters;
+    return true;
   }
 
   private static String getFreshVariableName(InferenceVariable var) {
index 21a817506181bba18c7d7abf1076ecded0420b70..958c5ae14b10f12cdeaabbad4398793913d6e2cd 100644 (file)
@@ -178,8 +178,12 @@ public class PsiPolyExpressionUtil {
         type = method.getReturnType();
       }
     }
-    if (TypeConversionUtil.isNumericType(type)) return ConditionalKind.NUMERIC;
-    if (TypeConversionUtil.isBooleanType(type)) return ConditionalKind.BOOLEAN;
+
+    final ConditionalKind kind = isBooleanOrNumericType(type);
+    if (kind != null) {
+      return kind;
+    }
+
     if (expr instanceof PsiConditionalExpression) {
       final PsiExpression thenExpression = ((PsiConditionalExpression)expr).getThenExpression();
       final PsiExpression elseExpression = ((PsiConditionalExpression)expr).getElseExpression();
@@ -190,4 +194,21 @@ public class PsiPolyExpressionUtil {
     }
     return null;
   }
+
+  @Nullable
+  private static ConditionalKind isBooleanOrNumericType(PsiType type) {
+    final PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(type);
+    if (TypeConversionUtil.isNumericType(type)) return ConditionalKind.NUMERIC;
+    if (TypeConversionUtil.isBooleanType(type)) return ConditionalKind.BOOLEAN;
+
+    if (psiClass instanceof PsiTypeParameter) {
+      for (PsiClassType classType : psiClass.getExtendsListTypes()) {
+        final ConditionalKind kind = isBooleanOrNumericType(classType);
+        if (kind != null) {
+          return kind;
+        }
+      }
+    }
+    return null;
+  }
 }
index 5bf3addded5f96b30bb3d7d3390d07fcf9d70df1..5cc81e1373b3a30bbb85878aae141246baa34a16 100644 (file)
@@ -65,6 +65,15 @@ public class PsiConditionalExpressionImpl extends ExpressionPsiElement implement
     if (type2 == null) return type1;
 
     if (type1.equals(type2)) return type1;
+
+    if (PsiUtil.isLanguageLevel8OrHigher(this) &&
+        PsiPolyExpressionUtil.isPolyExpression(this) &&
+        !MethodCandidateInfo.ourOverloadGuard.currentStack().contains(PsiUtil.skipParenthesizedExprUp(this.getParent()))) {
+      //15.25.3 Reference Conditional Expressions 
+      // The type of a poly reference conditional expression is the same as its target type.
+      return InferenceSession.getTargetType(this);
+    }
+
     final int typeRank1 = TypeConversionUtil.getTypeRank(type1);
     final int typeRank2 = TypeConversionUtil.getTypeRank(type2);
 
@@ -90,14 +99,6 @@ public class PsiConditionalExpressionImpl extends ExpressionPsiElement implement
     if (TypeConversionUtil.isNullType(type1) && !(type2 instanceof PsiPrimitiveType)) return type2;
     if (TypeConversionUtil.isNullType(type2) && !(type1 instanceof PsiPrimitiveType)) return type1;
 
-    if (PsiUtil.isLanguageLevel8OrHigher(this) && 
-        PsiPolyExpressionUtil.isPolyExpression(this) && 
-        !MethodCandidateInfo.ourOverloadGuard.currentStack().contains(PsiUtil.skipParenthesizedExprUp(this.getParent()))) {
-      //15.25.3 Reference Conditional Expressions 
-      // The type of a poly reference conditional expression is the same as its target type.
-      return InferenceSession.getTargetType(this);
-    }
-
     if (TypeConversionUtil.isAssignable(type1, type2, false)) return type1;
     if (TypeConversionUtil.isAssignable(type2, type1, false)) return type2;
     if (!PsiUtil.isLanguageLevel5OrHigher(this)) {
index b74387111cd55c92fc67b6d50998629ec01e9ddb..3061f4638483418f180a4c430459ffce5504cde9 100644 (file)
@@ -426,4 +426,14 @@ class NotDefinitelyUnassigned {
     }
     <error descr="Variable 'i' might already have been assigned to">i</error> = 1;
   }
+}
+
+class ClassInitializerConstantEval {
+  {
+    final int x;
+    if(false){
+      x = 1;
+      <error descr="Variable 'x' might already have been assigned to">x</error> = 1;
+    }
+  }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA130243.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA130243.java
new file mode 100644 (file)
index 0000000..daee2c6
--- /dev/null
@@ -0,0 +1,19 @@
+class Test {
+
+  public enum EXT {
+    TOP, BOTTOM
+  }
+
+  public static <C extends Comparable<? extends C>> C min(C c1, C... c2) {
+    return null;
+  }
+
+  public static <C extends Comparable<? extends C>> C min(EXT ext, C c1, C... c2) {
+    return null;
+  }
+
+  public static void main(String[] args) {
+    min("a", "b", "c");
+    min(EXT.TOP, "a", "b", "c");
+  }
+}
\ No newline at end of file
index 5cd402a50c26636aa82911e67dad65fb1cc80303..b46d90f7729fa8acd438c55f883eb2a1cc8295e1 100644 (file)
@@ -14,4 +14,13 @@ abstract class A1<T>{
     void bar(A1<Long> x, A1<Integer> y){
         baz(foo(x, y));
     }
-}
\ No newline at end of file
+}
+
+abstract class A3<T>{
+    abstract <S> S foo(S x, S y);
+    <S extends Number & Comparable<? extends K>, K extends Number & Comparable<? extends M>, M extends Number & Comparable<?>> void baz(A<S> a){}
+
+    void bar(A<Long> x, A<Integer> y){
+        baz(foo(x, y));
+    }
+}
index 5706e9f126186b14d69840597e34e9895fbc0057..868efce3432ac6015b8d201e7ce6c7978375d67d 100644 (file)
@@ -8,7 +8,7 @@ class Test {
     }
 
     void foo() {
-        <error descr="Incompatible types. Found: 'java.util.List<java.lang.Class<? extends java.io.Serializable & java.lang.Comparable<? extends java.lang.Comparable<?>>>>', required: 'java.util.List<java.lang.Class<? extends java.io.Serializable>>'">List<Class<? extends Serializable>> l = <warning descr="Unchecked generics array creation for varargs parameter">this.asList</warning>(String.class, Integer.class);</error>
+        <error descr="Incompatible types. Found: 'java.util.List<java.lang.Class<? extends java.io.Serializable & java.lang.Comparable<? extends java.io.Serializable & java.lang.Comparable<?>>>>', required: 'java.util.List<java.lang.Class<? extends java.io.Serializable>>'">List<Class<? extends Serializable>> l = <warning descr="Unchecked generics array creation for varargs parameter">this.asList</warning>(String.class, Integer.class);</error>
         l.size();
         List<? extends Object> objects = this.asList(new String(), new Integer(0));
         objects.size();
@@ -146,7 +146,7 @@ class IDEADEV25515 {
     }
 
     public static final
-    <error descr="Incompatible types. Found: 'java.util.List<java.lang.Class<? extends java.io.Serializable & java.lang.Comparable<? extends java.lang.Comparable<?>>>>', required: 'java.util.List<java.lang.Class<? extends java.io.Serializable>>'">List<Class<? extends Serializable>> SIMPLE_TYPES =
+    <error descr="Incompatible types. Found: 'java.util.List<java.lang.Class<? extends java.io.Serializable & java.lang.Comparable<? extends java.io.Serializable & java.lang.Comparable<?>>>>', required: 'java.util.List<java.lang.Class<? extends java.io.Serializable>>'">List<Class<? extends Serializable>> SIMPLE_TYPES =
 <warning descr="Unchecked generics array creation for varargs parameter">asList</warning>(String.class, Integer.class ,Long.class, Double.class, /*Date.class,*/
 Boolean.class, Boolean.TYPE /*,String[].class */ /*,BigDecimal.class*/);</error>
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/StopBoundsPromotionInsideNestedWildcards.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/StopBoundsPromotionInsideNestedWildcards.java
new file mode 100644 (file)
index 0000000..155368d
--- /dev/null
@@ -0,0 +1,8 @@
+interface A<T extends B<? extends T>> { }
+interface B<T extends A<?>> { }
+
+class C {
+  void foo(A<?> x){
+    <error descr="Incompatible types. Found: 'A<capture<?>>', required: 'A<? extends B<? extends A<?>>>'">A<? extends B<? extends A<?>>>  y =  x;</error>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA139096.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA139096.java
new file mode 100644 (file)
index 0000000..2c4702e
--- /dev/null
@@ -0,0 +1,10 @@
+import java.io.*;
+import java.util.*;
+
+abstract class C {
+  Iterator<? extends Comparable<? extends Serializable>> bar(List<String> x, Set<Integer> y) {
+    return foo(x, y).iterator();
+  }
+
+  abstract <T> T foo(T x, T y);
+}
\ No newline at end of file
index e6e4e01930ef5407f845a0549ebe56670e5f32dd..c6523a15ca8516b7ccfe043c8d14deac3cede660 100644 (file)
@@ -1,6 +1,6 @@
 class Test {
   void bar() {
-    baz<error descr="'baz(S)' in 'Test' cannot be applied to '(java.io.Serializable & java.lang.Comparable<? extends java.io.Serializable & java.lang.Comparable<? extends java.lang.Comparable<?>>>)'">(foo(1, ""))</error>;
+    baz<error descr="'baz(S)' in 'Test' cannot be applied to '(java.io.Serializable & java.lang.Comparable<? extends java.io.Serializable & java.lang.Comparable<?>>)'">(foo(1, ""))</error>;
   }
 
   <T> T foo(T x, T y) {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA146897.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA146897.java
new file mode 100644 (file)
index 0000000..3caad06
--- /dev/null
@@ -0,0 +1,9 @@
+
+interface XYZ<<error descr="Cyclic inheritance involving 'X'"></error>X extends X> {
+
+  class Q {
+    public static void main(String[] args) {
+      <error descr="'XYZ' is abstract; cannot be instantiated">new XYZ<>()</error>;
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypes.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypes.java
new file mode 100644 (file)
index 0000000..54e328d
--- /dev/null
@@ -0,0 +1,12 @@
+
+class A<T extends Iterable<?>>{
+  T get() {return null;}
+  T x;
+  void foo(A<? extends Iterable<String> > a){
+    String s = bar(a.get());
+    String s1 = bar(a.x);
+  }
+  <Tb> Tb bar(Iterable<Tb> a){
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypesIDEA139157.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypesIDEA139157.java
new file mode 100644 (file)
index 0000000..3197ed4
--- /dev/null
@@ -0,0 +1,10 @@
+
+import java.util.*;
+
+interface A<T extends A<? extends A<T>>> { }
+
+class C {
+  void foo(List<A<? extends A<?>>> x){
+    List<A<?>> y = x;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypesIDEA139167.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/RecursiveCapturedWildcardTypesIDEA139167.java
new file mode 100644 (file)
index 0000000..17855d4
--- /dev/null
@@ -0,0 +1,13 @@
+
+import java.util.List;
+
+interface A<T extends List<String>> {
+  T m();
+}
+
+abstract class C {
+  abstract <S> A<? extends S> foo();
+  void bar() {
+    this.<List<?>>foo().m().get(0).toLowerCase();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/PolyConditionalExpressionWithTargetPrimitive.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/PolyConditionalExpressionWithTargetPrimitive.java
new file mode 100644 (file)
index 0000000..b3fd0e9
--- /dev/null
@@ -0,0 +1,26 @@
+
+class Conditional {
+  void m(Object p, boolean b) {
+    int a  = b ? <error descr="Incompatible types. Found: 'null', required: 'int'">null</error> : ((Getter<Integer>) p).get();
+    int a1 = b ? <error descr="Incompatible types. Found: 'null', required: 'int'">null</error> : Conditional.<Integer>f();
+    int a2 = b ? null : 1;
+    int a3 = b ? null : f1();
+    int a4 = b ? null : f2();
+  }
+
+  private static <T> T f() {
+    return null;
+  }
+
+  private static int f1() {
+    return 1;
+  }
+
+  private static <T extends Integer, S extends T> S f2() {
+    return null;
+  }
+}
+
+interface Getter<A> {
+  A get();
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/PotentialCompatibilityInCaseWhenNoMethodHasValidNumberOfParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/PotentialCompatibilityInCaseWhenNoMethodHasValidNumberOfParameters.java
new file mode 100644 (file)
index 0000000..115a459
--- /dev/null
@@ -0,0 +1,14 @@
+
+class Test {
+  public <T> void varargs(int i, String... p1) { }
+  public <T> void usage(String p1) { }
+  {
+    varargs<error descr="Cannot resolve method 'varargs()'">()</error>;
+    varargs(1);
+    varargs(1, "");
+    varargs(1, "", "");
+    usage<error descr="'usage(java.lang.String)' in 'Test' cannot be applied to '()'">()</error>; 
+    usage("");
+    usage<error descr="'usage(java.lang.String)' in 'Test' cannot be applied to '(java.lang.String, java.lang.String)'">("", "")</error>;
+  }
+}
\ No newline at end of file
index 91b378c80de0cdd9b888d91e4e259f7c78e6fa3a..1cf0444c8362f6874d22125a641d0e23e587da4c 100644 (file)
@@ -1,7 +1,7 @@
 // "Cast to 'B'" "true"
 class A {
  void f(B b) {
-   B s = <caret>b == null ? null : (B) this;
+   B s =b == null ? null : <caret>(B) this;
  }
 }
 class B extends A {}
\ No newline at end of file
index 3fb70333d43e1fceb87ebb6dbc9fb88775727f8e..f19a0a489aa7dd2e05a75ab6a7562d31ed00d50c 100644 (file)
@@ -1,7 +1,7 @@
 // "Cast to 'B'" "true"
 class A {
  void f(B b) {
-   B s = <caret>b == null ? null : this;
+   B s =b == null ? null :  <caret>this;
  }
 }
 class B extends A {}
\ No newline at end of file
index 85e4d69968a2658811f72cbe655881d994a5b0eb..a3682b815f0f1d8d56584390215ca8ca3ca14e57 100644 (file)
@@ -1,6 +1,6 @@
 import java.io.Serializable;
 
-// "Change type arguments to <Serializable & Comparable<? extends Serializable & Comparable<? extends Comparable<?>>>>" "true"
+// "Change type arguments to <Serializable & Comparable<? extends Serializable & Comparable<?>>>" "true"
 class Generic<E> {
   Generic(E arg, E arg1) {
   }
index 7821964109551c74fe378fc7a955d185fd6e888c..348aa8536943e57954a002260171fcce8abb8019 100644 (file)
@@ -1,4 +1,4 @@
-// "Change type arguments to <Serializable & Comparable<? extends Serializable & Comparable<? extends Comparable<?>>>>" "true"
+// "Change type arguments to <Serializable & Comparable<? extends Serializable & Comparable<?>>>" "true"
 class Generic<E> {
   Generic(E arg, E arg1) {
   }
diff --git a/java/java-tests/testData/codeInsight/documentation/LinkBetweenMethods.html b/java/java-tests/testData/codeInsight/documentation/LinkBetweenMethods.html
new file mode 100644 (file)
index 0000000..9f7688c
--- /dev/null
@@ -0,0 +1,22 @@
+<HTML><base href="placeholder"><style type="text/css">  ul.inheritance {
+      margin:0;
+      padding:0;
+  }
+  ul.inheritance li {
+       display:inline;
+       list-style:none;
+  }
+  ul.inheritance li ul.inheritance {
+    margin-left:15px;
+    padding-left:15px;
+    padding-top:1px;
+  }
+</style><a name="m1--">
+<!--   -->
+</a>
+<h3><a href="psi_element://com.jetbrains.LinkBetweenMethods"><code>com.jetbrains.LinkBetweenMethods</code></a></h3>
+<pre>public&nbsp;void&nbsp;m1()</pre>
+<div class="block"><a href="psi_element://com.jetbrains.LinkBetweenMethods#m2()"><code>m2()</code></a></div>
+</li>
+</ul>
+</HTML>
\ No newline at end of file
index c8c68becd10e406ffafd55c0fb1b2fa09cad68fa..f34e796df74fcd092361f5bc3558b171268fd9c3 100644 (file)
Binary files a/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar and b/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar differ
index 86eaa25edfb3bc479ee1b48cba7cbb676c6970d7..048740f5f9fb4bc9d22c3140a6fd17816570812d 100644 (file)
Binary files a/java/java-tests/testData/codeInsight/documentation/library-src.jar and b/java/java-tests/testData/codeInsight/documentation/library-src.jar differ
index 5af61f8693d6f5833c87501673a9b7355494387b..ce0abdc617bd52a86b85e4f5abdcc64c343288f1 100644 (file)
Binary files a/java/java-tests/testData/codeInsight/documentation/library.jar and b/java/java-tests/testData/codeInsight/documentation/library.jar differ
diff --git a/java/java-tests/testData/inspection/testOnly/insideField/expected.xml b/java/java-tests/testData/inspection/testOnly/insideField/expected.xml
new file mode 100644 (file)
index 0000000..bf29b44
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+  <problem>
+    <file>A.java</file>
+    <line>14</line>
+    <module>testInsideField</module>
+    <package>&lt;default&gt;</package>
+    <entry_point TYPE="method" FQNAME="A$2 void run()"/>
+    <description>Test-only method is called in production code</description>
+  </problem>
+</problems>
+
diff --git a/java/java-tests/testData/inspection/testOnly/insideField/src/A.java b/java/java-tests/testData/inspection/testOnly/insideField/src/A.java
new file mode 100644 (file)
index 0000000..4c3af30
--- /dev/null
@@ -0,0 +1,17 @@
+public class A {
+  @org.jetbrains.annotations.TestOnly
+  public static final String MY_FIELD = "VALUE";
+
+  @org.jetbrains.annotations.TestOnly
+  public static final Runnable MY_TEST_ONLY_RUNNABLE = new Runnable() {
+    public void run() {
+      System.out.println(MY_FIELD);
+    }
+  };
+
+  public static final Runnable MY_PRODUCTION_RUNNABLE = new Runnable() {
+    public void run() {
+      System.out.println(MY_FIELD);
+    }
+  };
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/testOnly/insideField/src/C.java b/java/java-tests/testData/inspection/testOnly/insideField/src/C.java
new file mode 100644 (file)
index 0000000..dbcea8c
--- /dev/null
@@ -0,0 +1,10 @@
+public class C {
+  @org.junit.Test
+  public void foo() {
+    new Runnable() {
+      public void run() {
+        System.out.println(A.MY_FIELD);
+      }
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/testOnly/insideField/test/D.java b/java/java-tests/testData/inspection/testOnly/insideField/test/D.java
new file mode 100644 (file)
index 0000000..3cf7367
--- /dev/null
@@ -0,0 +1,15 @@
+public class D {
+  public static final Runnable MY_RUNNABLE = new Runnable() {
+    public void run() {
+      System.out.println(A.MY_FIELD);
+    }
+  };
+
+  public void test() {
+    new Runnable() {
+      public void run() {
+        System.out.println(A.MY_FIELD);
+      }
+    };
+  }
+}
\ No newline at end of file
index 1248f2cdfc6ea6f683ba2abef5f249453b066348..e0f2293938ba9e363aa18ff9efac76b0e3b6308d 100644 (file)
@@ -8,6 +8,6 @@ class Test {
   enum Y implements I {a}
 
   {
-      List<? extends Enum<? extends Enum<? extends Enum<?>>>> l = Arrays.asList(X.a, Y.a);
+      List<? extends Enum<? extends Enum<?>>> l = Arrays.asList(X.a, Y.a);
   }
 }
index fac05d5b5bbad90081945ef39daf15a444420dbb..ba0d3046a3dd960523074fc4844ac135d9fe2808 100644 (file)
@@ -104,6 +104,10 @@ public class JavaExternalDocumentationTest extends PlatformTestCase {
   public void testLinkToPackageSummaryWithReference() throws Exception {
     doTest("class Foo implements com.jetbrains.<caret>SimpleInterface {}");
   }
+  
+  public void testLinkBetweenMethods() throws Exception {
+    doTest("class Foo {{ new com.jetbrains.LinkBetweenMethods().<caret>m1(); }}");
+  }
 
   private void doTest(String text) throws Exception {
     String actualText = getDocumentationText(text);
index 22f93eb08f538c906f6d3948359db315350237f5..0c5612e5a48e885a34c7366601bc2e475807cc01 100644 (file)
@@ -24,7 +24,10 @@ import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.GenericsUtil;
 import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiManager;
+import com.intellij.psi.PsiType;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
@@ -536,10 +539,28 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
   }
 
+  public void testStopBoundsPromotionInsideNestedWildcards() throws Exception {
+    doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+  }
+
+  public void testIDEA130243() throws Exception {
+    doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+  }
+  
   public void testProvablyDistinctForWildcardsWithArrayBounds() throws Exception {
     doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
   }
 
+  public void testLeastUpperBoundWithRecursiveTypes() throws Exception {
+    final PsiManager manager = getPsiManager();
+    final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
+    final PsiType leastUpperBound = GenericsUtil.getLeastUpperBound(PsiType.INT.getBoxedType(manager, scope), 
+                                                                    PsiType.LONG.getBoxedType(manager, scope), 
+                                                                    manager);
+    assertNotNull(leastUpperBound);
+    assertEquals("Number & Comparable<? extends Number & Comparable<?>>", leastUpperBound.getPresentableText());
+  }
+
   public void testJavaUtilCollections_NoVerify() throws Exception {
     PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
     assertNotNull(collectionsClass);
index dfbbfc87deba318dd9457dabe73ac207cc6b93f4..f05cd31045aaf21ec5b27aee5bb531cc19b539d7 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.completion.CompletionContributor;
 import com.intellij.codeInsight.daemon.*;
 import com.intellij.codeInsight.daemon.impl.quickfix.DeleteCatchFix;
 import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
+import com.intellij.codeInsight.folding.CodeFoldingManager;
 import com.intellij.codeInsight.generation.actions.CommentByLineCommentAction;
 import com.intellij.codeInsight.hint.EditorHintListener;
 import com.intellij.codeInsight.intention.AbstractIntentionAction;
@@ -2078,5 +2079,57 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
 
     assertEmpty(visibleHints);
   }
+  
+  public void testCodeFoldingPassRestartsOnRegionUnfolding() throws Exception {
+    TestLoggerFactory.enableDebugLogging(myTestRootDisposable, "#com.intellij.codeInsight.daemon.impl.PassExecutorService");
+    DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance();
+    int savedDelay = settings.AUTOREPARSE_DELAY;
+    settings.AUTOREPARSE_DELAY = 0;
+    try {
+      configureByText(StdFileTypes.JAVA, "class Foo {\n" +
+                                         "    void m() {\n" +
+                                         "\n" +
+                                         "    }\n" +
+                                         "}");
+      CodeFoldingManager.getInstance(getProject()).buildInitialFoldings(myEditor);
+      waitForDaemon();
+      EditorTestUtil.executeAction(myEditor, IdeActions.ACTION_COLLAPSE_ALL_REGIONS);
+      waitForDaemon();
+      checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
+
+      new WriteCommandAction<Void>(myProject){
+        @Override
+        protected void run(@NotNull Result<Void> result) throws Throwable {
+          myEditor.getDocument().insertString(0, "/*");
+        }
+      }.execute();
+      waitForDaemon();
+      checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{...}']");
+      
+      EditorTestUtil.executeAction(myEditor, IdeActions.ACTION_EXPAND_ALL_REGIONS);
+      waitForDaemon();
+      checkFoldingState("[FoldRegion -(0:37), placeholder='/.../']");
+    }
+    finally {
+      settings.AUTOREPARSE_DELAY = savedDelay;
+    }
+  }
+
+  private void checkFoldingState(String expected) {
+    assertEquals(expected, Arrays.toString(myEditor.getFoldingModel().getAllFoldRegions()));
+  }
+
+  private void waitForDaemon() {
+    long deadline = System.currentTimeMillis() + 60_000;
+    while (PsiDocumentManager.getInstance(myProject).isUncommited(myEditor.getDocument())) {
+      if (System.currentTimeMillis() > deadline) fail("Too long waiting for document commit");
+      UIUtil.dispatchAllInvocationEvents();
+    }
+    UIUtil.dispatchAllInvocationEvents(); // make sure daemon is started
+    while (myDaemonCodeAnalyzer.isRunning()) {
+      if (System.currentTimeMillis() > deadline) fail("Too long waiting for daemon to finish");
+      UIUtil.dispatchAllInvocationEvents();
+    }
+  }
 }
 
index 0c2273100a16d601542df466adbe4741505aae61..9bdc01515f3277b8e531568fb04d2d912e89567c 100644 (file)
@@ -922,4 +922,24 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
   public void testDistinguishTypeArgs() throws Exception {
     doTest();
   }
+
+  public void testRecursiveCapturedWildcardTypes() throws Exception {
+    doTest();
+  }
+
+  public void testRecursiveCapturedWildcardTypesIDEA139167() throws Exception {
+    doTest();
+  }
+  
+  public void testRecursiveCapturedWildcardTypesIDEA139157() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA146897() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA139096() throws Exception {
+    doTest();
+  }
 }
index fb84404648c514fc38b513c1554931e78f5694f8..61534eecad63fcb40734225962f6e32cb7570ea6 100644 (file)
@@ -343,6 +343,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
     doTest();
   }
 
+  public void testPolyConditionalExpressionWithTargetPrimitive() throws Exception {
+    doTest();
+  }
+
   private void doTest() throws Exception {
     doTest(false);
   }
index b2812c74d74f463e440bae424a8b4f7efbdde50b..2e9eeb9e356a264449a85060c8a314475526d5bb 100644 (file)
@@ -187,6 +187,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
     doTest(false);
   }
 
+  public void testPotentialCompatibilityInCaseWhenNoMethodHasValidNumberOfParameters() throws Exception {
+    doTest(false);
+  }
+
   private void doTest() {
     doTest(true);
   }
index 80ed8a4a291b8fb135e199543d72751484313fa7..f69deedd9c55c443baf17ca88dd57dcab4d0d7d7 100644 (file)
@@ -82,7 +82,7 @@ class Foo { List a; Map b; }
 
     myFixture.type 'import '
     myFixture.doHighlighting()
-    assert !myFixture.editor.foldingModel.getCollapsedRegionAtOffset(10)
+    assert !myFixture.editor.foldingModel.getCollapsedRegionAtOffset(46)
   }
 
   public void testJavadocLikeClassHeader() {
@@ -1165,6 +1165,30 @@ class Foo {
     assert topLevelRegions[0].startOffset == text.indexOf('{', text.indexOf("if"))
     assert topLevelRegions[0].endOffset == text.indexOf('}', text.indexOf("if")) + 1
   }
+  
+  public void "test editing near closure folding"() {
+    configure """\
+class Foo {
+  void m() {
+    SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                System.out.println();
+            }
+        });
+  }
+}
+"""
+    assertTopLevelFoldRegionsState "[FoldRegion +(56:143), placeholder='(Runnable) () → { ', FoldRegion +(164:188), placeholder=' }']"
+    myFixture.editor.caretModel.moveToOffset(myFixture.editor.document.text.indexOf("SwingUtilities"))
+    myFixture.type(' ')
+    myFixture.doHighlighting()
+    assertTopLevelFoldRegionsState "[FoldRegion +(57:144), placeholder='(Runnable) () → { ', FoldRegion +(165:189), placeholder=' }']"
+  }
+
+  private void assertTopLevelFoldRegionsState(String expectedState) {
+    assertEquals(expectedState, myFixture.editor.foldingModel.toString())
+  }
 
   private int getFoldRegionsCount() {
     return myFixture.editor.foldingModel.allFoldRegions.length
index 07d17637f2184cf706271f96403db513aea4cf5e..1a116d8205207b88617381b1ee8ef5d2b9d345e0 100644 (file)
@@ -29,6 +29,7 @@ public class TestOnlyInspectionTest extends InspectionTestCase {
   protected void setupRootModel(String testDir, VirtualFile[] sourceDir, String jdkName) {
     super.setupRootModel(testDir, sourceDir, jdkName);
     VirtualFile projectDir = LocalFileSystem.getInstance().findFileByPath(testDir);
+    assertNotNull(projectDir);
     VirtualFile test = projectDir.findChild("test");
     if (test != null) PsiTestUtil.addSourceRoot(myModule, test, true);
   }
@@ -39,29 +40,33 @@ public class TestOnlyInspectionTest extends InspectionTestCase {
     return new AnalysisScope(myModule);
   }
 
-  public void testSimple() throws Exception {
+  public void testSimple() {
     doTest();
   }
 
-  public void testInsideInner() throws Exception {
+  public void testInsideInner() {
     doTest();
   }
 
-  public void testConstructor() throws Exception {
+  public void testConstructor() {
     doTest();
   }
 
-  public void testVisibleForTesting() throws Exception { doTest(); }
+  public void testVisibleForTesting() { doTest(); }
 
-  public void testUnresolved() throws Exception {
+  public void testUnresolved() {
     doTest(); // shouldn't throw
   }
   
-  public void testClass() throws Exception {
+  public void testClass() {
+    doTest();
+  }
+  
+  public void testInsideField() {
     doTest();
   }
 
-  private void doTest() throws Exception {
+  private void doTest() {
     TestOnlyInspection i = new TestOnlyInspection();
     doTest("testOnly/" + getTestName(true), new LocalInspectionToolWrapper(i), "java 1.5");
   }
index 66aaa67732327239a80c24a6d23126f5f58a7259..4b0ee7222143a689c7f139a88519d9149e8964d2 100644 (file)
@@ -621,6 +621,11 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
     FindUtil.replace(myProject, myEditor, 0, model);
     assertEquals("Foo foo FOO", myEditor.getDocument().getText());
 
+    model.setStringToFind("Foo");
+    model.setStringToReplace("Bar");
+    FindUtil.replace(myProject, myEditor, 0, model);
+    assertEquals("Bar bar BAR", myEditor.getDocument().getText());
+
     configureByText(FileTypes.PLAIN_TEXT, "Bar bar");
 
     model.setStringToFind("bar");
@@ -892,7 +897,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
           result.set(new FindResultImpl());
         }
       }, progressIndicatorBase);
-    });
+    }, "runAsyncTest");
     thread.start();
 
     progressStarted.await();
index ea5282c781e4ae4f2682fbf3268794e7126fad42..f7f9e2f842a4ca1161dd6b6cd7fd6257daaa9e48 100644 (file)
@@ -416,6 +416,17 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase {
     assert JavaPsiFacade.getInstance(project).findClass("Foo3", scope)
   }
 
+  public void "test rename file invalidates indices in right order"() throws IOException {
+    GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
+
+    for(def i = 0; i < 100; ++i) {
+      final VirtualFile file = myFixture.addFileToProject("foo/Foo" + i + ".java", "package foo; class Foo" + i + " {}").getVirtualFile();
+      assertNotNull(JavaPsiFacade.getInstance(getProject()).findClass("foo.Foo" + i, scope));
+      file.rename(this, "Bar" + i + ".java");
+      assertNotNull(JavaPsiFacade.getInstance(getProject()).findClass("foo.Foo" + i, scope));
+    }
+  }
+
   public void "test do not collect stub tree while holding stub elements"() throws IOException {
     final VirtualFile vFile = myFixture.addClass("class Foo {}").getContainingFile().getVirtualFile();
 
index ad12ef131055baafbc380eb2cc1e934d6fe0f8f0..ff8aae2a0192bb1368d785b7b81d87f1c9505ff6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,11 @@ import com.intellij.codeInsight.folding.CodeFoldingManager;
 import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.editor.CaretModel;
 import com.intellij.openapi.editor.FoldRegion;
+import com.intellij.psi.PsiDocumentManager;
 import com.intellij.testFramework.TestFileType;
 
 import java.io.IOException;
+import java.util.Arrays;
 
 /**
  * @author Denis Zhdanov
@@ -70,6 +72,62 @@ public class FoldingProcessingOnDocumentModificationTest extends AbstractEditorT
     assertEquals(1, myEditor.getFoldingModel().getAllFoldRegions().length);
   }
   
+  public void testSurvivingBrokenPsi() throws Exception {
+    openJavaEditor("class Foo {\n" +
+                   "    void m() {\n" +
+                   "\n" +
+                   "    }\n" +
+                   "}");
+    executeAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS);
+    checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
+    
+    myEditor.getDocument().insertString(0, "/*");
+    checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{...}']");
+    
+    myEditor.getDocument().deleteString(0, 2);
+    checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
+  }
+  
+  public void testInvalidRegionIsRemovedOnExpanding() throws Exception {
+    openJavaEditor("class Foo {\n" +
+                   "    void m() {\n" +
+                   "\n" +
+                   "    }\n" +
+                   "}");
+    executeAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS);
+    checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
+
+    myEditor.getDocument().insertString(0, "/*");
+    checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{...}']");
+
+    executeAction(IdeActions.ACTION_EXPAND_ALL_REGIONS);
+    checkFoldingState("[FoldRegion -(0:37), placeholder='/.../']");
+  }
+  
+  public void testEditingNearRegionExpandsIt() throws Exception {
+    openJavaEditor("class Foo {\n" +
+                   "    void m() <caret>{\n" +
+                   "\n" +
+                   "    }\n" +
+                   "}");
+    executeAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS);
+    executeAction(IdeActions.ACTION_EDITOR_DELETE);
+    checkFoldingState("[]");
+  }
+  
+  private void openJavaEditor(String text) throws Exception {
+    init(text, TestFileType.JAVA);
+    buildInitialFoldRegions();
+    runFoldingPass(true);
+    runFoldingPass();
+  }
+
+  private static void checkFoldingState(String expectedState) {
+    PsiDocumentManager.getInstance(ourProject).commitDocument(myEditor.getDocument());
+    runFoldingPass();
+    assertEquals(expectedState, Arrays.toString(myEditor.getFoldingModel().getAllFoldRegions()));
+  }
+  
   private static void buildInitialFoldRegions() {
     CodeFoldingManager.getInstance(getProject()).buildInitialFoldings(myEditor);
   }
@@ -78,6 +136,10 @@ public class FoldingProcessingOnDocumentModificationTest extends AbstractEditorT
     CodeFoldingManager.getInstance(getProject()).updateFoldRegions(myEditor);
   }
   
+  private static void runFoldingPass() {
+    runFoldingPass(false);
+  }
+  
   private static void runFoldingPass(boolean firstTime) {
     Runnable runnable = CodeFoldingManager.getInstance(getProject()).updateFoldRegionsAsync(myEditor, firstTime);
     assertNotNull(runnable);
index beed9ac5521a7852ec131031e44d36fce06d5a23..f5266d02c9bfb7255dc1f7ac6f1749649225596f 100644 (file)
@@ -149,17 +149,13 @@ public class IndentTest extends LightIdeaTestCase {
         });
       }
     }, null, null);
-    
+
 
     String textAfter = loadFile(fileNameAfter);
     String fileText = file.getText();
-    if (textAfter.startsWith("\n")) {
-      textAfter = textAfter.substring(1);
-    }
-    if (fileText.startsWith("\n")) {
-      fileText = fileText.substring(1);
-    }
-    
+    textAfter = StringUtil.trimStart(textAfter, "\n");
+    fileText = StringUtil.trimStart(fileText, "\n");
+
     assertEquals(textAfter, fileText);
   }
 
index 4f2cd40645659ffeb0ba4f22b7a1564571a255f0..552635e79071364ed568812e0dde409bd5d7ff79 100644 (file)
@@ -334,7 +334,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
   }
 
   public void testSpacesInsideLambda() {
-    getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
+    getSettings().KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE = true;
     getSettings().SPACE_AROUND_LAMBDA_ARROW = true;
 
     doMethodTest("()->{}",
index 040648043d7c6fdb83ddf01c06f450b8a2aeaf37..85097c372e857b1c6b9e6dfd084d6eb88df74bd3 100644 (file)
@@ -646,4 +646,15 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
     );
   }
   
+  public void test_KeepSimpleLambdasInOneLine() {
+    getSettings().KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE = true;
+    doMethodTest("      execute(  () -> {});", 
+                 "execute(() -> {});");
+    
+    getSettings().KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE = false;
+    doMethodTest("execute(() -> {});", 
+                 "execute(() -> {\n" +
+                 "});");
+  }
+  
 }
index 7644c9dcbc2a229a729b1fe8e51e4bdbe46b06e7..03ea132fa4ee717f94ee5a2a5e39bf7ce4c5812b 100644 (file)
@@ -128,7 +128,7 @@ public class TabIndentingTest extends LightIdeaTestCase {
     doTest("SCR6197.java", "SCR6197_after.java");
   }
 
-  private void doTest(String fileNameBefore, String fileNameAfter) throws Exception{
+  private void doTest(String fileNameBefore, String fileNameAfter) throws Exception {
     String text = loadFile(fileNameBefore);
     final PsiFile file = createFile(fileNameBefore, text);
     CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
@@ -147,18 +147,14 @@ public class TabIndentingTest extends LightIdeaTestCase {
         });
       }
     }, null, null);
-    
+
 
     String textAfter = loadFile(fileNameAfter);
     String fileText = file.getText();
 
-    if (textAfter.startsWith("\n")) {
-      textAfter = textAfter.substring(1);
-    }
-    if (fileText.startsWith("\n")) {
-      fileText = fileText.substring(1);
-    }
-    
+    textAfter = StringUtil.trimStart(textAfter, "\n");
+    fileText = StringUtil.trimStart(fileText, "\n");
+
     if (!textAfter.equals(fileText)) {
       System.err.println("Expected:");
       System.err.println(textAfter);
index 5a0508f8944779c877684d1155bcd41130ecfe61..fa747d2720c447b72658890751a2f49a1d112aa1 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.psi.formatter.java;
 
 import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 
 public class WrapperTest extends JavaFormatterTestCase {
@@ -28,9 +29,7 @@ public class WrapperTest extends JavaFormatterTestCase {
   @Override
   protected String prepareText(final String text) {
     String result = text;
-    if (result.startsWith("\n")) {
-      result = result.substring(1);
-    }
+    result = StringUtil.trimStart(result, "\n");
     return result;
   }
 
index 61a6442f400dd8bbbe0b8754282fa60079a23d52..604e779a954472e013dc856eceead1d47ce20358 100644 (file)
--- a/