Merge branch 'master' into daywalker/cmake_option_sorting
authorVasily Pisar <vasily.pisar@jetbrains.com>
Thu, 29 Oct 2015 13:07:05 +0000 (16:07 +0300)
committerVasily Pisar <vasily.pisar@jetbrains.com>
Thu, 29 Oct 2015 13:07:05 +0000 (16:07 +0300)
669 files changed:
.idea/libraries/Netty.xml
README.md
RegExpSupport/src/org/intellij/lang/regexp/surroundWith/SimpleSurroundDescriptor.java
bin/scripts/unix/idea.sh
build/scripts/layouts.gant
build/scripts/libLicenses.gant
build/scripts/utils.gant
java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaDebuggerEvaluator.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorImpl.java
java/debugger/openapi/src/com/intellij/debugger/ui/tree/NodeDescriptorNameAdjuster.java
java/execution/impl/src/com/intellij/execution/junit/JUnitProcessHandler.java
java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java
java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConstructorParametersFixer.java
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapLongWithMathToIntExactFix.java [new file with mode: 0644]
java/java-analysis-impl/src/com/intellij/codeInsight/guess/impl/ExpressionTypeMemoryState.java
java/java-analysis-impl/src/com/intellij/codeInsight/intention/EmptyQuickFixFactory.java
java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/RedundantLambdaCodeBlockInspection.java
java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java
java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspectionBase.java
java/java-impl/src/com/intellij/codeInsight/completion/ArrayMemberAccess.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/completion/ChainedCallCompletion.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/completion/FromArrayConversion.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java
java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/completion/SlowerTypeConversions.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/completion/ToArrayConversion.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/XmlSurroundWithRangeAdjuster.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/AddDeprecationAnnotationIntention.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/AddNotNullAnnotationIntention.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/AddNullableAnnotationIntention.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
java/java-impl/src/com/intellij/codeInspection/dataFlow/EditContractIntention.java
java/java-impl/src/com/intellij/codeInspection/emptyMethod/EmptyMethodInspection.java
java/java-impl/src/com/intellij/codeInspection/java18StreamApi/FluentIterableMethodTransformer.java [deleted file]
java/java-impl/src/com/intellij/codeInspection/java18StreamApi/GuavaFluentIterableInspection.java [deleted file]
java/java-impl/src/com/intellij/codeInspection/java18StreamApi/GuavaFluentIterableMethodConverters.java [deleted file]
java/java-impl/src/com/intellij/codeInspection/java18StreamApi/GuavaFunctionAndPredicateConverter.java [deleted file]
java/java-impl/src/com/intellij/codeInspection/java18StreamApi/GuavaOptionalConverter.java [deleted file]
java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java
java/java-impl/src/com/intellij/ide/util/SuperMethodWarningUtil.java
java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java
java/java-impl/src/com/intellij/psi/formatter/java/BlockContainingJavaBlock.java
java/java-impl/src/com/intellij/psi/formatter/java/ChildAlignmentStrategyProvider.java
java/java-impl/src/com/intellij/psi/formatter/java/SubsequentClassMemberAlignment.java [new file with mode: 0644]
java/java-impl/src/com/intellij/psi/formatter/java/SubsequentFieldAligner.java
java/java-impl/src/com/intellij/psi/formatter/java/SubsequentOneLineMethodsAligner.java [new file with mode: 0644]
java/java-impl/src/com/intellij/psi/formatter/java/SubsequentVariablesAligner.java
java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java
java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java
java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationStatementProcessor.java
java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionIndex.java
java/java-psi-api/src/com/intellij/psi/compiled/ClassFileDecompilers.java
java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java
java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.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/InferenceVariable.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
java/java-tests/testData/codeInsight/completion/keywords/breakInLabeledBlock.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/CastTwice.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/OuterSuperMethodCall.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/OuterSuperMethodCall_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/ShowMostSpecificOverride.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normalSorting/PreferVarsHavingReferencedMember.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/smartType/second/ChainDuplicationAfterInstanceof.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/SillyAssignment.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/NullTypesInDiamondsInference.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/RecursiveAtSiteSubstitutorsWithAdditionalConstraints.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference/afterUnqualifiedThis.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference/beforeUnqualifiedThis.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeMethodSignatureFromUsage/afterNonDenotableType.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeMethodSignatureFromUsage/beforeNonDenotableType.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterNonDenotable.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeNonDenotable.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/beforeNoParamNumberMatchFound.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/afterAssignment.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/afterFewParameters.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/afterSingleParameter.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/afterVariableDeclaration.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/beforeAssignment.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/beforeFewParameters.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/beforeSingleParameter.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact/beforeVariableDeclaration.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/gotosuper/OverridingLibrary.java [new file with mode: 0644]
java/java-tests/testData/compiler/notNullVerification/SkipBridgeMethods.java [new file with mode: 0644]
java/java-tests/testData/inspection/dataFlow/fixture/IncrementParenthesized.java [new file with mode: 0644]
java/java-tests/testData/inspection/dataFlow/fixture/NumberComparisonsWhenValueIsKnown.java
java/java-tests/testData/inspection/emptyMethod/emptyMethodsHierarchy/expected.xml [new file with mode: 0644]
java/java-tests/testData/inspection/emptyMethod/emptyMethodsHierarchy/src/p2/Derived.java [new file with mode: 0644]
java/java-tests/testData/inspection/guava/base.java [deleted file]
java/java-tests/testData/inspection/guava/base_after.java [deleted file]
java/java-tests/testData/inspection/guava/insideLambda.java [deleted file]
java/java-tests/testData/inspection/guava/insideLambda_after.java [deleted file]
java/java-tests/testData/inspection/guava/localVariable.java [deleted file]
java/java-tests/testData/inspection/guava/localVariable_after.java [deleted file]
java/java-tests/testData/inspection/guava/nonSuitableMethodParameterType.java [deleted file]
java/java-tests/testData/inspection/guava/nonSuitableReturnType.java [deleted file]
java/java-tests/testData/inspection/guava/nonSuitableReturnType2.java [deleted file]
java/java-tests/testData/inspection/guava/stopMethods.java [deleted file]
java/java-tests/testData/inspection/guava/suitableReturnType1.java [deleted file]
java/java-tests/testData/inspection/guava/suitableReturnType1_after.java [deleted file]
java/java-tests/testData/inspection/guava/suitableReturnType2.java [deleted file]
java/java-tests/testData/inspection/guava/suitableReturnType2_after.java [deleted file]
java/java-tests/testData/inspection/guava/suitableReturnType3.java [deleted file]
java/java-tests/testData/inspection/guava/suitableReturnType3_after.java [deleted file]
java/java-tests/testData/inspection/usage1.5/defaultMethods/src/Test.java
java/java-tests/testData/refactoring/copyClass/recursiveTypes/Bar.expected.java [new file with mode: 0644]
java/java-tests/testData/refactoring/copyClass/recursiveTypes/Foo.java [new file with mode: 0644]
java/java-tests/testData/refactoring/introduceVariable/PutInLambdaBodyVoid.after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/introduceVariable/PutInLambdaBodyVoid.java [new file with mode: 0644]
java/java-tests/testData/refactoring/makeMethodStatic/afterClearOverrideAnnotation.java [new file with mode: 0644]
java/java-tests/testData/refactoring/makeMethodStatic/afterDelegatePlace.java [new file with mode: 0644]
java/java-tests/testData/refactoring/makeMethodStatic/beforeClearOverrideAnnotation.java [new file with mode: 0644]
java/java-tests/testData/refactoring/makeMethodStatic/beforeDelegatePlace.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionDfaTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/completion/SecondSmartTypeCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/WrapLongWithMathToIntExactFixTest.java [moved from platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJLabelUI.java with 53% similarity]
java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/EmptyMethodTest.java
java/java-tests/testSrc/com/intellij/codeInspection/GuavaFluentIterableTest.java [deleted file]
java/java-tests/testSrc/com/intellij/codeInspection/JavaAPIUsagesInspectionTest.java
java/java-tests/testSrc/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java
java/java-tests/testSrc/com/intellij/dependencies/UsagesInAnalyzingDependenciesTest.java
java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
java/java-tests/testSrc/com/intellij/ide/util/JavaSuperMethodTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/navigation/GotoActionTest.groovy
java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterAlignmentTest.java
java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java
java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java
java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
java/java-tests/testSrc/com/intellij/refactoring/MakeMethodStaticTest.java
java/java-tests/testSrc/com/intellij/roots/ModuleGraphTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/slicer/SliceTreeTest.java
java/openapi/src/com/intellij/codeInsight/generation/surroundWith/JavaExpressionSurrounder.java
java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java
java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/guava/GuavaFluentIterableConversionRule.java
java/typeMigration/test/com/intellij/codeInsight/inspections/GuavaInspectionTest.java
java/typeMigration/testData/inspections/guava/fluentIterableChainSeparatedByMethods.java [new file with mode: 0644]
java/typeMigration/testData/inspections/guava/fluentIterableChainSeparatedByMethods_after.java [new file with mode: 0644]
java/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items
java/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items
jps/jps-builders/src/org/jetbrains/jps/api/GlobalOptions.java
jps/jps-builders/src/org/jetbrains/jps/cmdline/LogSetup.java
jps/jps-builders/src/org/jetbrains/jps/incremental/CompileScope.java
jps/jps-builders/src/org/jetbrains/jps/incremental/CompileScopeImpl.java
jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/RmiStubsGenerator.java
jps/jps-builders/testSrc/org/jetbrains/jps/builders/CompileScopeTestBuilder.java
lib/batik-all.jar [moved from lib/batik-all-1.8.jar with 63% similarity]
lib/netty-all-4.1.0.Beta7.jar [moved from lib/netty-all-4.1.0.Beta6.jar with 75% similarity]
lib/required_for_dist.txt
lib/src/netty-all-4.1.0.Beta7-sources.jar [moved from lib/src/netty-all-4.1.0.Beta6-sources.jar with 82% similarity]
lib/xml-apis-ext.jar [new file with mode: 0644]
platform/analysis-api/src/com/intellij/profile/ApplicationProfileManager.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/DefaultHighlightVisitorBasedInspection.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ThreadLocalAnnotatorMap.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java
platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInWebServer.kt
platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt
platform/built-in-server/src/org/jetbrains/builtInWebServer/StaticFileHandler.kt
platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/ExpressionParseTree.java
platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/SsiConditional.java
platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/SsiFsize.java
platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/SsiProcessor.java [deleted file]
platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/SsiProcessor.kt [new file with mode: 0644]
platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/SsiStopProcessingException.java [deleted file]
platform/built-in-server/src/org/jetbrains/io/fastCgi/FastCgiDecoder.kt
platform/built-in-server/src/org/jetbrains/io/fastCgi/FastCgiRequest.kt
platform/built-in-server/src/org/jetbrains/io/fastCgi/FastCgiService.kt
platform/built-in-server/testSrc/BinaryRequestHandlerTest.kt
platform/configuration-store-impl/src/ApplicationStoreImpl.kt
platform/configuration-store-impl/src/ProjectStateStorageManager.kt
platform/configuration-store-impl/src/ProjectStoreImpl.kt
platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt
platform/configuration-store-impl/src/SchemeManagerImpl.kt
platform/configuration-store-impl/src/StateMap.kt
platform/configuration-store-impl/src/StateStorageManagerImpl.kt
platform/configuration-store-impl/src/StoreAwareProjectManager.kt
platform/core-api/src/com/intellij/lang/folding/CompositeFoldingBuilder.java
platform/core-api/src/com/intellij/openapi/options/SchemeProcessor.java
platform/core-api/src/com/intellij/openapi/options/SchemesManager.java
platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java
platform/core-api/src/com/intellij/psi/search/GlobalSearchScope.java
platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
platform/core-impl/src/com/intellij/openapi/options/EmptySchemesManager.java
platform/core-impl/src/com/intellij/openapi/vfs/impl/ZipHandler.java
platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java
platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java
platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java
platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
platform/diff-api/src/com/intellij/diff/fragments/DiffFragmentImpl.java
platform/diff-api/src/com/intellij/diff/fragments/LineFragmentImpl.java
platform/diff-impl/src/com/intellij/diff/comparison/ByLine.java
platform/diff-impl/src/com/intellij/diff/comparison/ByWord.java
platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java
platform/diff-impl/src/com/intellij/diff/comparison/ComparisonMergeUtil.java
platform/diff-impl/src/com/intellij/diff/comparison/TextChunk.java
platform/diff-impl/src/com/intellij/diff/comparison/TrimUtil.java
platform/diff-impl/src/com/intellij/diff/comparison/iterables/DiffIterableUtil.java
platform/diff-impl/src/com/intellij/diff/fragments/MergeLineFragment.java
platform/diff-impl/src/com/intellij/diff/fragments/MergeLineFragmentImpl.java [new file with mode: 0644]
platform/diff-impl/src/com/intellij/diff/fragments/MergeWordFragment.java [moved from platform/platform-impl/src/com/intellij/remote/Tunnelled.java with 68% similarity]
platform/diff-impl/src/com/intellij/diff/fragments/MergeWordFragmentImpl.java [new file with mode: 0644]
platform/diff-impl/src/com/intellij/diff/merge/TextMergeChange.java
platform/diff-impl/src/com/intellij/diff/merge/TextMergeTool.java
platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffChange.java
platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleOnesideDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffChange.java
platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffViewer.java
platform/diff-impl/src/com/intellij/diff/tools/simple/ThreesideDiffChangeBase.java
platform/diff-impl/src/com/intellij/diff/tools/util/StatusPanel.java
platform/diff-impl/src/com/intellij/diff/util/DiffDrawUtil.java
platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java
platform/diff-impl/src/com/intellij/diff/util/MergeRange.java [new file with mode: 0644]
platform/diff-impl/src/com/intellij/diff/util/TextDiffType.java
platform/diff-impl/src/com/intellij/diff/util/TextDiffTypeFactory.java
platform/diff-impl/tests/com/intellij/diff/DiffTestCase.kt
platform/diff-impl/tests/com/intellij/diff/comparison/CharComparisonUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/ComparisonMergeUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/ComparisonMergeUtilTestBase.kt
platform/diff-impl/tests/com/intellij/diff/comparison/ComparisonUtilAutoTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/ComparisonUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/ComparisonUtilTestBase.kt
platform/diff-impl/tests/com/intellij/diff/comparison/LineComparisonUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/SplitComparisonUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/TrimUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/comparison/WordComparisonUtilTest.kt
platform/diff-impl/tests/com/intellij/diff/merge/MergeAutoTest.kt
platform/diff-impl/tests/com/intellij/diff/merge/MergeTest.kt
platform/diff-impl/tests/com/intellij/diff/merge/MergeTestBase.kt
platform/diff-impl/tests/com/intellij/diff/tools/fragmented/LineNumberConvertorCorrectorTest.kt
platform/diff-impl/tests/com/intellij/diff/tools/fragmented/LineNumberConvertorTest.kt
platform/diff-impl/tests/com/intellij/diff/tools/fragmented/UnifiedFragmentBuilderAutoTest.kt
platform/diff-impl/tests/com/intellij/diff/tools/fragmented/UnifiedFragmentBuilderTest.kt
platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java
platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/LoadingIcon.java [deleted file]
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/RepositoryNode.java
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/RepositoryWithBranchPanel.java
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/SingleRepositoryNode.java
platform/dvcs-impl/src/com/intellij/dvcs/repo/AbstractRepositoryManager.java
platform/dvcs-impl/src/com/intellij/dvcs/repo/VcsRepositoryManager.java
platform/dvcs-impl/src/com/intellij/dvcs/repo/VcsRepositoryMappingListener.java [moved from platform/script-debugger/backend/src/org/jetbrains/debugger/HasUrl.java with 74% similarity]
platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/execution/ExternalSystemExecutionConsoleManager.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ModuleData.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/TaskData.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/IdeModelsProvider.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/IdeModelsProviderImpl.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/DefaultExternalSystemExecutionConsoleManager.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunConfiguration.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/ExternalSystemExecuteTaskTask.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/AbstractIdeModifiableModelsProvider.java
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java
platform/indexing-api/src/com/intellij/psi/search/searches/DefinitionsSearch.java
platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java
platform/indexing-impl/src/com/intellij/psi/search/SearchScopeEnlarger.java
platform/indexing-impl/src/com/intellij/util/indexing/AdditionalIndexableFileSet.java
platform/lang-api/src/com/intellij/codeInsight/completion/AlwaysFocusLookup.java [moved from platform/built-in-server/src/org/jetbrains/builtInWebServer/ssi/SsiCommand.java with 62% similarity]
platform/lang-api/src/com/intellij/codeInsight/editorActions/BackspaceHandlerDelegate.java
platform/lang-api/src/com/intellij/codeInsight/lookup/Lookup.java
platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.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/psi/file/FileLookupInfoProvider.java
platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPreselectionBehaviourProvider.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzerSettingsImpl.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightingSettingsPerFile.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupManager.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionsStep.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupDocumentSavingVetoer.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupUi.java
platform/lang-impl/src/com/intellij/codeInsight/preview/ImageOrColorPreviewManager.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/ListTemplatesHandler.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateLookupActionProvider.java
platform/lang-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplateLookupActionProvider.java
platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java
platform/lang-impl/src/com/intellij/codeInspection/ex/PerformFixesModalTask.java
platform/lang-impl/src/com/intellij/execution/RunContentExecutor.java
platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java
platform/lang-impl/src/com/intellij/execution/runners/RerunTestsAction.java
platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java
platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTableCellRenderer.java
platform/lang-impl/src/com/intellij/find/impl/FindDialog.java
platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java
platform/lang-impl/src/com/intellij/formatting/AbstractBlockAlignmentProcessor.java
platform/lang-impl/src/com/intellij/formatting/AlignmentImpl.java
platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java
platform/lang-impl/src/com/intellij/formatting/InitialInfoBuilder.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateDefaultExtension.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/InternalTemplateBean.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java
platform/lang-impl/src/com/intellij/ide/scopeView/ScopeTreeViewPanel.java
platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java
platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java
platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectDialog.java
platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeEditorPanel.java
platform/lang-impl/src/com/intellij/injected/editor/VirtualFileWindowImpl.java
platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffOptionsPanel.form
platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffOptionsPanel.java
platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewPanel.java
platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewProvider.java
platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java
platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentRootPanel.java
platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/ShredImpl.java
platform/lang-impl/src/com/intellij/psi/search/PredefinedSearchScopeProviderImpl.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodNodeBase.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java
platform/lang-impl/src/com/intellij/refactoring/rename/RenameDialog.java
platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java
platform/lang-impl/src/com/intellij/refactoring/ui/RefactoringDialog.java
platform/lang-impl/src/com/intellij/ui/JBTableWithHintProvider.java [deleted file]
platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java
platform/platform-api/src/com/intellij/featureStatistics/ProductivityFeaturesProvider.java
platform/platform-api/src/com/intellij/ide/TypeIconEP.java
platform/platform-api/src/com/intellij/ide/TypeNameEP.java
platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
platform/platform-api/src/com/intellij/ui/CheckboxTreeBase.java
platform/platform-api/src/com/intellij/ui/GuiUtils.java
platform/platform-api/src/com/intellij/util/graph/GraphAlgorithms.java
platform/platform-api/src/com/intellij/util/ui/ButtonlessScrollBarUI.java
platform/platform-impl/src/com/intellij/concurrency/JobLauncherImpl.java
platform/platform-impl/src/com/intellij/ide/GeneralSettingsConfigurable.java
platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacro.java
platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacroManager.java
platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java
platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeTimed.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java
platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsState.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf_mac.properties
platform/platform-impl/src/com/intellij/internal/statistic/StatisticsUploadAssistant.java
platform/platform-impl/src/com/intellij/internal/statistic/connect/RemotelyConfigurableStatisticsService.java
platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsNotification.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/internal/statistic/updater/SendStatisticsComponent.java
platform/platform-impl/src/com/intellij/notification/impl/NotificationActionProvider.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenu.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/IdeaActionButtonLook.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorEmptyTextPainter.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWithProviderComposite.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/HistoryEntry.java
platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java
platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java
platform/platform-impl/src/com/intellij/openapi/options/ex/SortedConfigurableGroup.java
platform/platform-impl/src/com/intellij/openapi/project/DumbPermissionServiceImpl.java
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/util/io/fileUtil.kt
platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/CanonicalPathMap.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/PlatformFrameTitleBuilder.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ComboContentLayout.java
platform/platform-impl/src/com/intellij/remote/BaseRemoteProcessHandler.java
platform/platform-impl/src/com/intellij/remote/RemoteProcess.java
platform/platform-impl/src/com/intellij/remote/RemoteProcessControl.java
platform/platform-impl/src/com/intellij/ui/BalloonLayoutImpl.java
platform/platform-impl/src/com/intellij/ui/EditorComboBoxEditor.java
platform/platform-impl/src/com/intellij/ui/EditorTextField.java
platform/platform-impl/src/com/intellij/util/graph/impl/GraphAlgorithmsImpl.java
platform/platform-impl/src/io/netty/buffer/ByteBufUtf8Writer.java
platform/platform-impl/src/io/netty/buffer/ByteBufUtilEx.java
platform/platform-impl/src/org/jetbrains/io/BuiltInServer.java
platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
platform/platform-resources-en/src/messages/ApplicationBundle.properties
platform/platform-resources-en/src/messages/DiffBundle.properties
platform/platform-resources-en/src/messages/IdeBundle.properties
platform/platform-resources-en/src/messages/OptionsBundle.properties
platform/platform-resources-en/src/messages/StatisticsBundle.properties
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
platform/platform-resources/src/brokenPlugins.txt
platform/platform-resources/src/idea/FindViewColorsScheme.xml
platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java
platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/local/CanonicalPathMapTest.java [new file with mode: 0644]
platform/platform-tests/testSrc/com/intellij/psi/impl/PsiDocumentManagerImplTest.java
platform/platform-tests/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java
platform/projectModel-impl/src/com/intellij/application/options/PathMacroExpandableProtocolBean.java
platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java
platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.java
platform/script-debugger/backend/src/org/jetbrains/debugger/BreakpointManager.kt
platform/script-debugger/backend/src/org/jetbrains/debugger/BreakpointManagerBase.kt
platform/script-debugger/backend/src/org/jetbrains/debugger/Script.java [deleted file]
platform/script-debugger/backend/src/org/jetbrains/debugger/Script.kt [new file with mode: 0755]
platform/script-debugger/backend/src/org/jetbrains/debugger/ScriptBase.java [deleted file]
platform/script-debugger/backend/src/org/jetbrains/debugger/ScriptBase.kt [new file with mode: 0755]
platform/script-debugger/backend/src/org/jetbrains/debugger/ScriptManager.java [deleted file]
platform/script-debugger/backend/src/org/jetbrains/debugger/ScriptManager.kt [new file with mode: 0644]
platform/script-debugger/backend/src/org/jetbrains/debugger/ScriptManagerBase.java [deleted file]
platform/script-debugger/backend/src/org/jetbrains/debugger/ScriptManagerBase.kt [new file with mode: 0644]
platform/script-debugger/backend/src/org/jetbrains/debugger/VariablesHost.java
platform/script-debugger/backend/src/org/jetbrains/debugger/VmBase.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebuggerSupportUtils.java
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/LineBreakpointManager.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/ScopeVariablesGroup.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/ValueNodeAsyncFunction.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/Variables.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/VmConnection.kt
platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/ExecutionStackImpl.kt
platform/structuralsearch/source/META-INF/structuralsearch.xml
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java
platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java
platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java
platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java
platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
platform/structure-view-api/src/com/intellij/ide/projectView/PresentationData.java
platform/testFramework/src/com/intellij/projectView/TestProjectTreeStructure.java
platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java
platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java
platform/testFramework/src/com/intellij/testFramework/VfsTestUtil.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/testRunner/src/com/intellij/execution/testframework/TestSearchScope.java
platform/usageView/src/com/intellij/usages/ChunkExtractor.java
platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java
platform/util-rt/src/com/intellij/openapi/util/Comparing.java
platform/util-rt/src/com/intellij/util/Base64.java
platform/util-rt/src/com/intellij/util/Consumer.java
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java
platform/util/src/com/intellij/openapi/util/Disposer.java
platform/util/src/com/intellij/openapi/util/io/FileSystemUtil.java
platform/util/src/com/intellij/openapi/util/io/win32/FileInfo.java
platform/util/src/com/intellij/openapi/util/text/StringUtil.java
platform/util/src/com/intellij/util/FontUtil.java
platform/util/src/com/intellij/util/SVGLoader.java
platform/util/src/com/intellij/util/TimedComputable.java
platform/util/src/com/intellij/util/TimedReference.java
platform/util/src/com/intellij/util/containers/Interner.java
platform/util/src/com/intellij/util/containers/OpenTHashSet.java
platform/util/src/com/intellij/util/containers/RefHashMap.java
platform/util/src/com/intellij/util/containers/SoftHashMap.java
platform/util/src/com/intellij/util/containers/WeakHashMap.java
platform/util/src/com/intellij/util/io/BaseDataReader.java
platform/util/src/com/intellij/util/io/DirectBufferWrapper.java
platform/util/src/com/intellij/util/io/MappedBufferWrapper.java
platform/util/src/com/intellij/util/lang/JarLoader.java
platform/util/src/com/intellij/util/ui/JBUI.java
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/util/testSrc/com/intellij/openapi/util/io/FileAttributesReadingTest.java
platform/util/testSrc/com/intellij/util/io/BaseOutputReaderTest.java
platform/util/testSrc/com/intellij/util/text/StringUtilTest.java
platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.kt
platform/util/util.iml
platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListUtil.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/MatchPatchPaths.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangeList.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/UnshelveChangesAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/UnshelveWithDialogAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserChangeListNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserChangeNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFilePathNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserLocallyDeletedNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserLockedFoldersNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserLogicallyLockedFile.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/MultipleChangeListBrowser.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/SelectFilesDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/checkout/CheckoutAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MultipleFileMergeDialog.java
platform/vcs-impl/testSrc/com/intellij/openapi/vcs/changes/committed/ZipChangesTest.kt
platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilder.kt
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/BreakpointsDialogFactory.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/ManualArrayToCollectionCopyInspection.java
plugins/InspectionGadgets/test/com/siyeh/igfixes/controlflow/trivialIf/NegatedConditional.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/controlflow/trivialIf/NegatedConditional.java [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/controlflow/TrivialIfFixTest.java
plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/ConcatenationInjector.java
plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/validation/UnknownLanguageID.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
plugins/ant/tests/src/com/intellij/lang/ant/AntCompletionTest.java
plugins/devkit/src/dom/Extensions.java
plugins/devkit/src/dom/impl/ExtensionDomExtender.java
plugins/devkit/src/dom/impl/ExtensionsImpl.java
plugins/devkit/src/inspections/PluginXmlDomInspection.java
plugins/devkit/src/inspections/internal/UseJBColorInspection.java
plugins/devkit/testData/codeInsight/extensionsSpecifyDefaultExtensionNs.xml [new file with mode: 0644]
plugins/devkit/testSources/codeInsight/PluginXmlFunctionalTest.groovy
plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java
plugins/gradle/resources/i18n/GradleBundle.properties
plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleResourceCompilerConfigurationGenerator.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/AllInPackageGradleConfigurationProducer.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleTestRunConfigurationProducer.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleTestsExecutionConsole.java [new file with mode: 0644]
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleTestsExecutionConsoleManager.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestClassGradleConfigurationProducer.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestMethodGradleConfigurationProducer.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AbstractTestEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AfterSuiteEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AfterTestEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/BeforeSuiteEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/BeforeTestEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/ConfigurationErrorEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/OnOutputEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/ReportLocationEvent.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java
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/task/GradleTaskManager.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/compiler/GradleResourceProcessingTest.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleMiscImportingTest.java [new file with mode: 0644]
plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ExternalSourceSet.java
plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ExternalTask.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/model/DefaultExternalSourceSet.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/model/DefaultExternalTask.java
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ExternalProjectBuilderImpl.groovy
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/init/testFilterInit.gradle
plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightMethodBuilder.java
plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/ForkedGroovyc.java
plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenationAwareInjector.java
plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcCliCommandExecutor.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcCommand.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunConfiguration.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTarget.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTargetDialog.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolvePropertyTest.groovy
plugins/hg4idea/src/org/zmlx/hg4idea/action/mq/HgQGotoFromLogAction.java
plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandProcessHandler.java
plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java
plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java
plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java
plugins/junit_rt/src/com/intellij/junit4/JUnit4IdeaTestRunner.java
plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/ManifestImporter.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenImporter.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenProjectModelModifier.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/actions/MavenProjectModelModifierTest.java
plugins/settings-repository/src/CredentialsStore.kt
plugins/settings-repository/src/RepositoryService.kt
plugins/settings-repository/src/git/JGitCredentialsProvider.kt
plugins/settings-repository/src/git/commit.kt
plugins/settings-repository/src/git/pull.kt
plugins/settings-repository/src/git/reset.kt
plugins/settings-repository/src/settings/IcsSettings.kt
plugins/settings-repository/src/settings/readOnlySourcesEditor.kt
plugins/settings-repository/src/settings/upstreamEditor.kt
plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnProcessHandler.java
plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskVcsTest.java
plugins/testng/src/com/theoryinpractice/testng/model/TestNGTestObject.java
plugins/testng/src/com/theoryinpractice/testng/model/TestNGTestPackage.java
plugins/ui-designer-core/src/com/intellij/designer/propertyTable/renderers/ColorIcon.java
plugins/ui-designer/src/com/intellij/uiDesigner/componentTree/ComponentTree.java
plugins/ui-designer/testSrc/com/intellij/uiDesigner/projectView/FormMergerTreeStructureProviderTest.java
plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/ui/EditContextDialog.java
python/helpers/pycharm/_jb_utils.py
python/helpers/pycharm/behave_runner.py
python/helpers/pydev/pydevd.py
python/helpers/pydev/pydevd_concurrency_analyser/pydevd_concurrency_logger.py
python/helpers/pydev/pydevd_concurrency_analyser/pydevd_thread_wrappers.py
python/ide/src/com/jetbrains/python/configuration/PyDiffPreviewProvider.java
python/psi-api/src/com/jetbrains/python/PyNames.java
python/psi-api/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java
python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
python/src/META-INF/python-core.xml
python/src/com/jetbrains/python/PyBundle.properties
python/src/com/jetbrains/python/debugger/PyBreakpointHandlerFactory.java
python/src/com/jetbrains/python/documentation/docstrings/PyStructuredDocstringFormatter.java
python/src/com/jetbrains/python/editor/PythonEnterHandler.java
python/src/com/jetbrains/python/editor/PythonSpaceHandler.java
python/src/com/jetbrains/python/psi/PyIndentUtil.java
python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
python/src/com/jetbrains/python/remote/PyRemoteSkeletonGeneratorFactory.java [new file with mode: 0644]
python/src/com/jetbrains/python/run/AbstractPythonRunConfiguration.java
python/src/com/jetbrains/python/sdk/AbstractCreateVirtualEnvDialog.java
python/src/com/jetbrains/python/sdk/CreateCondaEnvDialog.java
python/src/com/jetbrains/python/sdk/CreateVirtualEnvDialog.java
python/src/com/jetbrains/python/validation/PyDumbAwareAnnotator.java
python/testData/editing/enterDocstringStubWhenClassDocstringBelow.after.py [new file with mode: 0644]
python/testData/editing/enterDocstringStubWhenClassDocstringBelow.py [new file with mode: 0644]
python/testData/editing/enterDocstringStubWhenFunctionDocstringBelow.after.py [new file with mode: 0644]
python/testData/editing/enterDocstringStubWhenFunctionDocstringBelow.py [new file with mode: 0644]
python/testData/editing/enterNoDocstringStubWhenCodeExampleInDocstring.after.py [new file with mode: 0644]
python/testData/editing/enterNoDocstringStubWhenCodeExampleInDocstring.py [new file with mode: 0644]
python/testData/refactoring/introduceVariable/callExpressionQualifier.after.py [new file with mode: 0644]
python/testData/refactoring/introduceVariable/callExpressionQualifier.py [new file with mode: 0644]
python/testData/refactoring/introduceVariable/caretAtExpressionEnd.after.py [new file with mode: 0644]
python/testData/refactoring/introduceVariable/caretAtExpressionEnd.py [new file with mode: 0644]
python/testData/refactoring/introduceVariable/dontSuggestReservedName.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/PyEditingTest.java
python/testSrc/com/jetbrains/python/refactoring/PyIntroduceVariableTest.java
resources-en/src/messages/QuickFixBundle.properties
resources/src/META-INF/IdeaPlugin.xml
xml/dom-tests/tests/com/intellij/util/xml/DomFileDescriptionTest.java
xml/impl/src/com/intellij/codeInsight/completion/XmlCharFilter.java
xml/impl/src/com/intellij/codeInsight/template/emmet/completion/EmmetLookupActionProvider.java
xml/impl/src/com/intellij/ide/browsers/BrowserSettingsPanel.java
xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java
xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java
xml/impl/src/com/intellij/psi/formatter/xml/XmlFormattingPolicy.java
xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java
xml/tests/testData/intentions/splitTag/after1.html
xml/tests/testData/intentions/splitTag/after3.html

index 79f757374bafcd621248944cd27ff70dbab02cf9..9d24dbe72c714b0c48cafd9c73f5f4b6f922751f 100644 (file)
@@ -4,11 +4,11 @@
       <root url="file://$PROJECT_DIR$/lib/annotations/netty"/>
     </ANNOTATIONS>
     <CLASSES>
-      <root url="jar://$PROJECT_DIR$/lib/netty-all-4.1.0.Beta6.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/netty-all-4.1.0.Beta7.jar!/" />
     </CLASSES>
     <JAVADOC />
     <SOURCES>
-      <root url="jar://$PROJECT_DIR$/lib/src/netty-all-4.1.0.Beta6-sources.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/src/netty-all-4.1.0.Beta7-sources.jar!/" />
     </SOURCES>
   </library>
 </component>
\ No newline at end of file
index 148813f1918e49163ed88438882189f9a05f65ca..d0527fe4a451f3f83d42d07913b085ab6b62314a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,11 +1,10 @@
 # IntelliJ IDEA Community Edition
 ### Building and Running from the IDE
-To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or IntelliJ IDEA Ultimate. To build and run the code:
+To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or IntelliJ IDEA Ultimate not older than 14.1.5. To build and run the code:
 * Run **getPlugins.sh** / **getPlugins.bat** from the project root directory to check out additional modules.
-* Install the **Kotlin plugin** from the plugin manager (version 0.12.613). Parts of IntelliJ IDEA are written in Kotlin, and you need the plugin to compile the code.
-* Make sure you have the **Groovy** plugin enabled. Parts of IntelliJ IDEA are written in Groovy, and you will get compilation errors if you don't have the plugin enabled.
-* Make sure you have the **UI Designer** plugin enabled. Most of IntelliJ IDEA's UI is built using the **UI Designer**, and the version you build will not run correctly if you don't have the plugin enabled.
+* If this git repository is not on 'master' branch you need to checkout the same branches/tags in android and android/tools-base git repositories.
 * Open the project.
+* If an error notification about a missing required plugin (e.g. Kotlin) is shown enable or install that plugin.
 * Configure a JSDK named "**IDEA jdk**" (case sensitive), pointing to an installation of JDK 1.6.
 * Unless you're running on a Mac with an Apple JDK, add <JDK_HOME>/lib/tools.jar to the set of "**IDEA jdk**" jars.
 * Configure a JSDK named "**1.8**", pointing to an installation of JDK 1.8.
index 30c39945ad30871dd371c2692019d22a36d1c178..3a2fa22f406caf5d95aa68c6bd55a0defdb80b0d 100644 (file)
@@ -17,84 +17,81 @@ package org.intellij.lang.regexp.surroundWith;
 
 import com.intellij.lang.surroundWith.SurroundDescriptor;
 import com.intellij.lang.surroundWith.Surrounder;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiWhiteSpace;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtilCore;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
+import org.intellij.lang.regexp.psi.RegExpAtom;
+import org.intellij.lang.regexp.psi.RegExpBranch;
 import org.intellij.lang.regexp.psi.RegExpElement;
 import org.intellij.lang.regexp.psi.RegExpPattern;
-import org.intellij.lang.regexp.psi.RegExpBranch;
-import org.intellij.lang.regexp.psi.RegExpAtom;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 public class SimpleSurroundDescriptor implements SurroundDescriptor {
-    private static final Surrounder[] SURROUNDERS = {
-            new GroupSurrounder("Capturing Group (pattern)", "("),
-            new GroupSurrounder("Non-Capturing Group (?:pattern)", "(?:"),
-    };
+  private static final Surrounder[] SURROUNDERS = {
+    new GroupSurrounder("Capturing Group (pattern)", "("),
+    new GroupSurrounder("Non-Capturing Group (?:pattern)", "(?:"),
+  };
 
-    @NotNull
-    public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
-        return findElementsInRange(file, startOffset, endOffset);
+  @NotNull
+  public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
+    // adjust start/end
+    PsiElement element1 = file.findElementAt(startOffset);
+    PsiElement element2 = file.findElementAt(endOffset - 1);
+    if (element1 instanceof PsiWhiteSpace) {
+      startOffset = element1.getTextRange().getEndOffset();
     }
-
-    @NotNull
-    public Surrounder[] getSurrounders() {
-        return SURROUNDERS;
+    if (element2 instanceof PsiWhiteSpace) {
+      endOffset = element2.getTextRange().getStartOffset();
     }
 
-  @Override
-  public boolean isExclusive() {
-    return false;
-  }
+    RegExpElement pattern = findElementAtStrict(file, startOffset, endOffset, RegExpPattern.class);
+    if (pattern != null) return new RegExpElement[]{pattern};
 
-  private PsiElement[] findElementsInRange(PsiFile file, int startOffset, int endOffset) {
-        // adjust start/end
-        PsiElement element1 = file.findElementAt(startOffset);
-        PsiElement element2 = file.findElementAt(endOffset - 1);
-        if (element1 instanceof PsiWhiteSpace) {
-            startOffset = element1.getTextRange().getEndOffset();
-        }
-        if (element2 instanceof PsiWhiteSpace) {
-            endOffset = element2.getTextRange().getStartOffset();
-        }
+    RegExpElement branch = findElementAtStrict(file, startOffset, endOffset, RegExpBranch.class);
+    if (branch != null) return new RegExpElement[]{branch};
 
-        final RegExpElement pattern = findElementAtStrict(file, startOffset, endOffset, RegExpPattern.class);
-        if (pattern != null) return new RegExpElement[]{ pattern };
+    List<PsiElement> atoms = new ArrayList<PsiElement>();
+    RegExpAtom atom = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, RegExpAtom.class);
+    for (; atom != null; atom = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, RegExpAtom.class)) {
+      atoms.add(atom);
+      startOffset = atom.getTextRange().getEndOffset();
 
-        final RegExpElement branch = findElementAtStrict(file, startOffset, endOffset, RegExpBranch.class);
-        if (branch != null) return new RegExpElement[]{ branch };
+      // handle embedded whitespace
+      if ((element1 = file.findElementAt(startOffset)) instanceof PsiWhiteSpace) {
+        startOffset = element1.getTextRange().getEndOffset();
+        atoms.add(element1);
+      }
+    }
 
-        final List<PsiElement> atoms = new ArrayList<PsiElement>();
-        RegExpAtom atom = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, RegExpAtom.class);
-        for (; atom != null; atom = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, RegExpAtom.class)) {
-            atoms.add(atom);
-            startOffset = atom.getTextRange().getEndOffset();
+    if (startOffset == endOffset && atoms.size() > 0) {
+      PsiElement[] elements = PsiUtilCore.toPsiElementArray(atoms);
+      if ((atoms.size() == 1 || PsiTreeUtil.findCommonParent(elements) == elements[0].getParent())) {
+        return elements;
+      }
+    }
+    return PsiElement.EMPTY_ARRAY;
+  }
 
-            // handle embedded whitespace
-            if ((element1 = file.findElementAt(startOffset)) instanceof PsiWhiteSpace) {
-                startOffset = element1.getTextRange().getEndOffset();
-                atoms.add(element1);
-            }
-        }
+  @NotNull
+  public Surrounder[] getSurrounders() {
+    return SURROUNDERS;
+  }
 
-        if (startOffset == endOffset && atoms.size() > 0) {
-          final PsiElement[] elements = PsiUtilCore.toPsiElementArray(atoms);
-            if ((atoms.size() == 1 || PsiTreeUtil.findCommonParent(elements) == elements[0].getParent())) {
-                return elements;
-            }
-        }
-        return PsiElement.EMPTY_ARRAY;
-    }
+  @Override
+  public boolean isExclusive() {
+    return false;
+  }
 
-    @Nullable
-    private static <T extends RegExpElement> T findElementAtStrict(PsiFile file, int startOffset, int endOffset, Class<T> clazz) {
-        T element = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, clazz);
-        if (element == null || element.getTextRange().getEndOffset() < endOffset) return null;
-        return element;
-    }
+  @Nullable
+  private static <T extends RegExpElement> T findElementAtStrict(PsiFile file, int startOffset, int endOffset, Class<T> clazz) {
+    T element = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, clazz);
+    if (element == null || element.getTextRange().getEndOffset() < endOffset) return null;
+    return element;
+  }
 }
index 39257f80bb1c6ff459563d941c7280a44248f771..39b95bf19b90af187ae809237520314e33cda610 100755 (executable)
@@ -161,8 +161,6 @@ if [ "$IS_EAP" = "true" ]; then
   fi
 fi
 
-IDE_JVM_ARGS="@@ide_jvm_args@@"
-
 @@class_path@@
 if [ -n "$@@product_uc@@_CLASSPATH" ]; then
   CLASSPATH="$CLASSPATH:$@@product_uc@@_CLASSPATH"
@@ -176,17 +174,17 @@ fi
 # ---------------------------------------------------------------------
 # Run the IDE.
 # ---------------------------------------------------------------------
-IFS="$(printf '\t')"
+IFS="$(printf '\n\t')"
 LD_LIBRARY_PATH="$IDE_BIN_HOME:$LD_LIBRARY_PATH" "$JAVA_BIN" \
   $AGENT \
   "-Xbootclasspath/a:$IDE_HOME/lib/boot.jar" \
   -classpath "$CLASSPATH" \
-  `echo "$VM_OPTIONS" | "$TR" '\n' '\t'` \
+  $VM_OPTIONS \
   "-Djb.vmOptionsFile=$VM_OPTIONS_FILE" \
   "-XX:ErrorFile=$HOME/java_error_in_@@product_uc@@_%p.log" \
   -Djb.restart.code=88 -Didea.paths.selector=@@system_selector@@ \
   $IDE_PROPERTIES_PROPERTY \
-  `echo "$IDE_JVM_ARGS" | "$TR" ' ' '\t'` \
+  @@ide_jvm_args@@ \
   com.intellij.idea.Main \
   "$@"
 EC=$?
index 90f111846aa35e27100afdaa2a9d39b6e684b400..da1fbd1fd8750153dfb170f2da39d751369a7917 100644 (file)
@@ -968,8 +968,9 @@ def layout_core(String home, String target) {
       include(name: "snappy-in-java-0.3.1.jar")
       include(name: "jayatana-1.2.4.jar")
       include(name: "imgscalr-lib-4.2.jar")
-      include(name: "batik-all-1.8.jar")
+      include(name: "batik-all.jar")
       include(name: "xmlgraphics-commons-1.5.jar")
+      include(name: "xml-apis-ext.jar")
     }
   }
 }
index 41be0514df643ed9fd90eebfde08913b3da30cc9..4a2fea25f1f8d0f0809eecd6f75bbd43f6b7fb3f 100644 (file)
@@ -211,8 +211,9 @@ libraryLicense(name: "Guava", version: "17.0", license: "Apache 2.0", url: "http
 libraryLicense(name: "hamcrest", version: "1.3", license: "BSD", url: "http://hamcrest.org/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
 libraryLicense(name: "HttpComponents HttpClient", libraryName: "http-client", version: "4.3.2", license: "Apache 2.0", url: "http://hc.apache.org/httpcomponents-client-ga/index.html")
 libraryLicense(name: "imgscalr", libraryName: "imgscalr", version: "4.2", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/thebuzzmedia/imgscalr")
-libraryLicense(name: "batik", libraryName: "batik", version: "1.8", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://svn.apache.org/repos/asf/xmlgraphics/batik")
+libraryLicense(name: "batik", libraryName: "batik", version: "1.7.1", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://svn.apache.org/repos/asf/xmlgraphics/batik")
 libraryLicense(name: "xmlgraphics-commons", libraryName: "xmlgraphics-commons", version: "1.5", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://svn.apache.org/repos/asf/xmlgraphics/commons")
+libraryLicense(name: "xml-apis-ext", libraryName: "xml-apis-ext", version: "1.3", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "http://xerces.apache.org/xml-commons/components/external")
 libraryLicense(name: "ini4j", libraryName: "ini4j-0.5.2-patched", version: "0.5.2 (with a patch by JetBrains)", license: "Apache 2.0", url: "http://ini4j.sourceforge.net/", attachedTo: "git4idea")
 libraryLicense(name: "ISO RELAX", libraryName: "isorelax.jar", license: "MIT License", url: "http://sourceforge.net/projects/iso-relax/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
 libraryLicense(name: "Jakarta ORO", libraryName: "OroMatcher", version: "2.0.8", license: "Apache", url: "http://jakarta.apache.org/oro/", licenseUrl: "http://svn.apache.org/repos/asf/jakarta/oro/trunk/LICENSE")
@@ -245,6 +246,7 @@ libraryLicense(name: "JUnit", libraryName: "JUnit4", version: "4.11", license: "
 libraryLicense(name: "jzlib", libraryName: "jzlib", version: "1.1.1", license: "BSD", url: "http://www.jcraft.com/jzlib/", licenseUrl: "http://www.jcraft.com/jzlib/LICENSE.txt")
 libraryLicense(name: "Kryo", libraryName: "Kryo", version: "2.22", license: "New BSD License", url: "https://github.com/EsotericSoftware/kryo", licenseUrl: "https://github.com/EsotericSoftware/kryo/blob/master/license.txt")
 libraryLicense(name: "kXML2", libraryName: "kxml2", version: "2.3.0", license: "BSD", url: "http://sourceforge.net/projects/kxml/")
+libraryLicense(name: "Lobo evolution", libraryName: "Loboevolution.jar", version: "0.98.6 (with patches by JetBrains)", license: "MIT", url: "http://sourceforge.net/projects/loboevolution/", licenseUrl: "http://opensource.org/licenses/mit-license.php")
 libraryLicense(name: "Log4j", libraryName: "Log4J", version: "1.2.17", license: "Apache 2.0", url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://logging.apache.org/license.html")
 libraryLicense(name: "Lombok AST", libraryName: "lombok-ast", version: "0.2.1", license: "MIT", url: "http://projectlombok.org/", licenseUrl: "http://opensource.org/licenses/mit-license.php")
 libraryLicense(name: "markdown4j", libraryName: "markdown4j-2.2", version: "2.2", license: "New BSD", url: "https://code.google.com/p/markdown4j/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
@@ -311,6 +313,7 @@ libraryLicense(name: "YourKit Java Profiler", libraryName: "yjp-controller-api-r
 
 jetbrainsLibrary("Coverage")
 jetbrainsLibrary("CoverageReport")
+jetbrainsLibrary("intellij-markdown.jar")
 jetbrainsLibrary("JPS")
 jetbrainsLibrary("Maven Embedder")
 jetbrainsLibrary("tcServiceMessages")
index bd6d0c16ab72a68fad42c62cca7fabcb3a5b3aa1..8dd6d7b342c60078ab7e6295f3ae3b5190c5a6bd 100644 (file)
@@ -17,6 +17,7 @@
 
 import com.intellij.openapi.util.SystemInfo
 import com.intellij.openapi.util.io.FileUtil
+import com.intellij.openapi.util.text.StringUtil
 import org.jetbrains.jps.gant.JpsGantTool
 import org.jetbrains.jps.gant.TeamCityBuildInfoPrinter
 import org.jetbrains.jps.model.java.*
@@ -914,6 +915,7 @@ binding.setVariable("buildWinZip", { String zipPath, List paths, String zipPrefi
 binding.setVariable("buildCrossPlatformZip", { String zipPath, String sandbox, List commonPaths, String distWin, String distUnix, String distMac ->
   projectBuilder.stage("Building cross-platform zip")
 
+  def executableName = StringUtil.trimEnd(new File(distMac, "bin").list().find { it.endsWith(".vmoptions") }, ".vmoptions")
   def zipDir = "$sandbox/cross-platform-zip"
   def ideaPropertiesFile = commonPaths.collect { new File(it, "bin/idea.properties") }.find { it.exists() }
   ["win", "linux"].each {
@@ -923,16 +925,16 @@ binding.setVariable("buildCrossPlatformZip", { String zipPath, String sandbox, L
   ant.fixcrlf(file: "$zipDir/bin/win/idea.properties", eol: "dos")
   ant.copy(todir: "$zipDir/bin/linux") {
     fileset(dir: "$distUnix/bin") {
-      include(name: "idea*.vmoptions")
+      include(name: "*.vmoptions")
     }
   }
   ant.copy(todir: "$zipDir/bin/mac") {
     fileset(dir: "$distMac/bin") {
-      include(name: "idea.vmoptions")
+      include(name: "${executableName}.vmoptions")
       include(name: "idea.properties")
     }
   }
-  ant.copy(file: "$distMac/bin/idea.vmoptions", tofile: "$zipDir/bin/mac/idea64.vmoptions")
+  ant.copy(file: "$distMac/bin/${executableName}.vmoptions", tofile: "$zipDir/bin/mac/${executableName}64.vmoptions")
   ant.copy(todir: "$zipDir/bin") {
     fileset(dir: "$distMac/bin") {
       include(name: "*.jnilib")
@@ -950,17 +952,17 @@ binding.setVariable("buildCrossPlatformZip", { String zipPath, String sandbox, L
 
     fileset(dir: distWin) {
       exclude(name: "bin/fsnotifier*.exe")
-      exclude(name: "bin/idea*.exe.vmoptions")
-      exclude(name: "bin/idea*.exe")
+      exclude(name: "bin/*.exe.vmoptions")
+      exclude(name: "bin/${executableName}*.exe")
     }
     zipfileset(dir: "$distWin/bin", prefix: "bin/win") {
       include(name: "fsnotifier*.exe")
-      include(name: "idea*.exe.vmoptions")
+      include(name: "*.exe.vmoptions")
     }
 
     fileset(dir: distUnix) {
       exclude(name: "bin/fsnotifier*")
-      exclude(name: "bin/idea*.vmoptions")
+      exclude(name: "bin/*.vmoptions")
       exclude(name: "bin/*.sh")
       exclude(name: "help/**")
     }
@@ -978,7 +980,7 @@ binding.setVariable("buildCrossPlatformZip", { String zipPath, String sandbox, L
       exclude(name: "bin/*.py")
       exclude(name: "bin/*.jnilib")
       exclude(name: "bin/idea.properties")
-      exclude(name: "bin/idea*.vmoptions")
+      exclude(name: "bin/*.vmoptions")
     }
     zipfileset(dir: "$distMac/bin", filemode: "775", prefix: "bin") {
       include(name: "restarter*")
index 1267afd48b3cc856403910d02ac5afbce05e81bf..3a1f45821d170580389ff63d002896ec9ef88dc9 100644 (file)
@@ -75,10 +75,7 @@ import com.intellij.openapi.vfs.newvfs.BulkFileListener;
 import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
 import com.intellij.openapi.vfs.newvfs.impl.FileNameCache;
 import com.intellij.openapi.wm.IdeFrame;
-import com.intellij.util.Alarm;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.Function;
-import com.intellij.util.SmartList;
+import com.intellij.util.*;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.concurrency.SequentialTaskExecutor;
 import com.intellij.util.containers.IntArrayList;
@@ -1319,7 +1316,7 @@ public class BuildManager implements Disposable {
   }
 
   private int startListening() throws Exception {
-    final ServerBootstrap bootstrap = NettyUtil.nioServerBootstrap(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE));
+    final ServerBootstrap bootstrap = NettyUtil.nioServerBootstrap(new NioEventLoopGroup(1, ConcurrencyUtil.newNamedThreadFactory("External compiler")));
     bootstrap.childHandler(new ChannelInitializer() {
       @Override
       protected void initChannel(Channel channel) throws Exception {
index 84c547040101001f4c8b9d2e1123ccd16baf0690..adb7e1d389dbc1701444d744dd94cc165bd0f7ed 100644 (file)
@@ -123,6 +123,10 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
 
   @Override
   public MethodVisitor visitMethod(final int access, final String name, String desc, String signature, String[] exceptions) {
+    if ((access & Opcodes.ACC_BRIDGE) != 0) {
+      return super.visitMethod(access, name, desc, signature, exceptions);
+    }
+
     final Type[] args = Type.getArgumentTypes(desc);
     final Type returnType = Type.getReturnType(desc);
     final MethodVisitor v = cv.visitMethod(access, name, desc, signature, exceptions);
index 695fc03b0379fa755fc66ac61aba32397e7b6100..eaaef3e2c026810ba3f20c898bc7ccd670c07d2c 100644 (file)
@@ -107,7 +107,7 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator {
       public void run() {
         try {
           PsiElement elementAtCursor = DebuggerUtilsEx.findElementAt(PsiDocumentManager.getInstance(project).getPsiFile(document), offset);
-          if (elementAtCursor == null) {
+          if (elementAtCursor == null || !elementAtCursor.isValid()) {
             return;
           }
           Pair<PsiElement, TextRange> pair = findExpression(elementAtCursor, sideEffectsAllowed);
index cd10a0f673b13636151273a3afef17411af41d69..c61a8de671d152d4662933de2bc6dfd202608991 100644 (file)
@@ -580,7 +580,7 @@ public class JavaStackFrame extends XStackFrame {
       return Pair.create(Collections.<String>emptySet(), Collections.<TextWithImports>emptySet());
     }
     final PsiFile positionFile = position.getFile();
-    if (!positionFile.getLanguage().isKindOf(JavaLanguage.INSTANCE)) {
+    if (!positionFile.isValid() || !positionFile.getLanguage().isKindOf(JavaLanguage.INSTANCE)) {
       return Pair.create(visibleVars, Collections.<TextWithImports>emptySet());
     }
 
index 632d6bbf6b2f0d5f4f90c6aa129d5c10d4f1a393..6b2713e87a9b4dd9c2fea9672863a7f927fb5d9c 100644 (file)
@@ -285,7 +285,7 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
   private static Iterable<PsiElement> getLineElements(final PsiFile file, int lineNumber) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
     Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
-    if (document == null || lineNumber >= document.getLineCount()) {
+    if (document == null || lineNumber < 0 || lineNumber >= document.getLineCount()) {
       return EmptyIterable.getInstance();
     }
     final TextRange lineRange = DocumentUtil.getLineTextRange(document, lineNumber);
index c273c50f2944d5ed8f845555898ac44bc2b84475..361101abea5f4595dc812dd138dc50715c49ddda 100644 (file)
@@ -245,4 +245,9 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
     }
     return null;
   }
+
+  @Override
+  public boolean canBeHitInOtherPlaces() {
+    return true; // line breakpoints could be hit in other versions of the same classes
+  }
 }
index 8016073b3234dc49ab9505f35cb062d1f7761446..16f3fc6137eeaa57ddc87e3a59d2358f9dc9d955 100644 (file)
@@ -90,9 +90,12 @@ public abstract class NodeDescriptorImpl implements NodeDescriptor {
         throw new EvaluateException(DebuggerBundle.message("error.invalid.stackframe"));
       }
       catch (VMDisconnectedException e) {
-        throw new EvaluateException(DebuggerBundle.message("error.vm.disconnected"));
+        throw e;
       }
       catch (RuntimeException e) {
+        if (e.getCause() instanceof InterruptedException) {
+          throw e;
+        }
         LOG.error(e);
         throw new EvaluateException("Internal error, see logs for more details");
       }
index 712beb2480b830b728071fca50cc44f7cfffeda5..5fa255b1095772f150f63acb1f3591ff168851f4 100644 (file)
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
  * @author Nikolay.Tropin
  */
 public abstract class NodeDescriptorNameAdjuster {
-  public static ExtensionPointName<NodeDescriptorNameAdjuster> EP_NAME = ExtensionPointName.create("com.intellij.debugger.nodeNameAdjuster");
+  public static final ExtensionPointName<NodeDescriptorNameAdjuster> EP_NAME = ExtensionPointName.create("com.intellij.debugger.nodeNameAdjuster");
 
   public abstract boolean isApplicable(@NotNull NodeDescriptor descriptor);
 
index 01132371ae04bed07d5630850542fc66526f5f14..263251b668d1d963571af1c2767230c8008f9f6f 100644 (file)
@@ -48,11 +48,13 @@ public class JUnitProcessHandler extends KillableColoredProcessHandler {
     });
   }
 
+  @NotNull
   @Override
   protected Reader createProcessOutReader() {
     return myOut.createReader();
   }
 
+  @NotNull
   @Override
   protected Reader createProcessErrReader() {
     return myErr.createReader();
@@ -74,4 +76,9 @@ public class JUnitProcessHandler extends KillableColoredProcessHandler {
     ProcessTerminatedListener.attach(processHandler);
     return processHandler;
   }
+
+  @Override
+  protected boolean useNonBlockingRead() {
+    return true;
+  }
 }
\ No newline at end of file
index 8afa3ba0981ccfdcf2df4d1504ad10f35d708c1a..a58e7bc7171745969860318b9d457987b35fffed 100644 (file)
@@ -162,26 +162,34 @@ public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder> e
       }
 
       boolean shouldOpenExisting = false;
-      if (!ApplicationManager.getApplication().isHeadlessEnvironment() && (projectFile.exists() || dotIdeaFile.exists())) {
-        String existingName;
-        if (dotIdeaFile.exists()) {
-          existingName = "an existing project";
-          pathToOpen = dotIdeaFile.getParent();
+      boolean importToProject = false;
+      if (projectFile.exists() || dotIdeaFile.exists()) {
+        if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
+          shouldOpenExisting = true;
+          importToProject = true;
         }
         else {
-          existingName = "'" + projectFile.getName() + "'";
-          pathToOpen = projectFilePath;
+          String existingName;
+          if (dotIdeaFile.exists()) {
+            existingName = "an existing project";
+            pathToOpen = dotIdeaFile.getParent();
+          }
+          else {
+            existingName = "'" + projectFile.getName() + "'";
+            pathToOpen = projectFilePath;
+          }
+          int result = Messages.showYesNoCancelDialog(
+            projectToClose,
+            IdeBundle.message("project.import.open.existing", existingName, projectFile.getParent(), virtualFile.getName()),
+            IdeBundle.message("title.open.project"),
+            IdeBundle.message("project.import.open.existing.openExisting"),
+            IdeBundle.message("project.import.open.existing.reimport"),
+            CommonBundle.message("button.cancel"),
+            Messages.getQuestionIcon());
+          if (result == Messages.CANCEL) return null;
+          shouldOpenExisting = result == Messages.YES;
+          importToProject = !shouldOpenExisting;
         }
-        int result = Messages.showYesNoCancelDialog(
-          projectToClose,
-          IdeBundle.message("project.import.open.existing", existingName, projectFile.getParent(), virtualFile.getName()),
-          IdeBundle.message("title.open.project"),
-          IdeBundle.message("project.import.open.existing.openExisting"),
-          IdeBundle.message("project.import.open.existing.reimport"),
-          CommonBundle.message("button.cancel"),
-          Messages.getQuestionIcon());
-        if (result == Messages.CANCEL) return null;
-        shouldOpenExisting = result == Messages.YES;
       }
 
       final Project projectToOpen;
@@ -195,8 +203,11 @@ public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder> e
       }
       else {
         projectToOpen = ProjectManagerEx.getInstanceEx().newProject(wizardContext.getProjectName(), pathToOpen, true, false);
+      }
+      if (projectToOpen == null) return null;
 
-        if (projectToOpen == null || !getBuilder().validate(projectToClose, projectToOpen)) {
+      if (importToProject) {
+        if (!getBuilder().validate(projectToClose, projectToOpen)) {
           return null;
         }
 
index 5e1cb191ecddff0d1a8e7698821e44ed669f7553..6dd7cb6bf527ac5aec7586fa932eb1da4cf95ae7 100644 (file)
@@ -265,4 +265,7 @@ public abstract class QuickFixFactory {
 
   @NotNull
   public abstract IntentionAction addMethodQualifierFix(@NotNull PsiMethodCallExpression methodCall);
+
+  @NotNull
+  public abstract IntentionAction createWrapLongWithMathToIntExactFix(@NotNull PsiExpression expression);
 }
index a3f78da67e05bb167e4b0b58ab5dd9d6a8dd26ce..0dc6c8fca8eb91164eaf7da241c9e2c372cfc1ea 100644 (file)
@@ -583,6 +583,7 @@ public class HighlightMethodUtil {
     TextRange fixRange = getFixRange(elementToHighlight);
     CastMethodArgumentFix.REGISTRAR.registerCastActions(candidates, methodCall, info, fixRange);
     WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(candidates, methodCall, info, fixRange);
+    WrapLongWithMathToIntExactFix.REGISTAR.registerCastActions(candidates, methodCall, info, fixRange);
     PermuteArgumentsFix.registerFix(info, methodCall, candidates, fixRange);
     WrapExpressionFix.registerWrapAction(candidates, list.getExpressions(), info);
     registerChangeParameterClassFix(methodCall, list, info);
@@ -669,6 +670,7 @@ public class HighlightMethodUtil {
     TextRange fixRange = getFixRange(elementToHighlight);
     CastMethodArgumentFix.REGISTRAR.registerCastActions(candidates, methodCall, info, fixRange);
     WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(candidates, methodCall, info, fixRange);
+    WrapLongWithMathToIntExactFix.REGISTAR.registerCastActions(candidates, methodCall, info, fixRange);
     PermuteArgumentsFix.registerFix(info, methodCall, candidates, fixRange);
     WrapExpressionFix.registerWrapAction(candidates, list.getExpressions(), info);
     registerChangeParameterClassFix(methodCall, list, info);
@@ -703,6 +705,7 @@ public class HighlightMethodUtil {
     PermuteArgumentsFix.registerFix(highlightInfo, methodCall, methodCandidates, fixRange);
     AddTypeArgumentsFix.REGISTRAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange);
     WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange);
+    WrapLongWithMathToIntExactFix.REGISTAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange);
     registerMethodAccessLevelIntentions(methodCandidates, methodCall, list, highlightInfo);
     registerChangeMethodSignatureFromUsageIntentions(methodCandidates, list, highlightInfo, fixRange);
     RemoveRedundantArgumentsFix.registerIntentions(methodCandidates, list, highlightInfo, fixRange);
index 25d4412ef13516de1c9c304cab2ea1677fc63c2d..32e2437c55cea6ba2edc8d7f899d7bf302eba44b 100644 (file)
@@ -564,6 +564,9 @@ public class HighlightUtil extends HighlightUtilBase {
       QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createAddTypeCastFix(lType, expression));
     }
     if (expression != null) {
+      if (PsiType.INT.equals(lType) && rType != null && (PsiType.LONG.equals(rType) || PsiType.LONG.getBoxedTypeName().equals(rType.getCanonicalText(false)))) {
+        QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createWrapLongWithMathToIntExactFix(expression));
+      }
       QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createWrapExpressionFix(lType, expression));
       AddTypeArgumentsConditionalFix.register(highlightInfo, expression, lType);
     }
@@ -1415,6 +1418,9 @@ public class HighlightUtil extends HighlightUtilBase {
       QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createConvertSwitchToIfIntention(statement));
       if (PsiType.LONG.equals(type) || PsiType.FLOAT.equals(type) || PsiType.DOUBLE.equals(type)) {
         QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createAddTypeCastFix(PsiType.INT, expression));
+        if (PsiType.LONG.equals(type)) {
+          QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createWrapLongWithMathToIntExactFix(expression));
+        }
       }
       if (requiredLevel != null) {
         QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createIncreaseLanguageLevelFix(requiredLevel));
index 44a4c761b18ac5f18cfdc8efb7c0ddffd7debc24..2feb7c42d94c7260c1db3ce7e6f38fb500c837f7 100644 (file)
@@ -43,5 +43,7 @@ public class ConstructorParametersFixer {
     }
     CastMethodArgumentFix.REGISTRAR.registerCastActions(candidates, constructorCall, highlightInfo, fixRange);
     AddTypeArgumentsFix.REGISTRAR.registerCastActions(candidates, constructorCall, highlightInfo, fixRange);
+    WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(candidates, constructorCall, highlightInfo, fixRange);
+    WrapLongWithMathToIntExactFix.REGISTAR.registerCastActions(candidates, constructorCall, highlightInfo, fixRange);
   }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapLongWithMathToIntExactFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapLongWithMathToIntExactFix.java
new file mode 100644 (file)
index 0000000..57f4e73
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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 com.intellij.codeInsight.daemon.impl.quickfix;
+
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.codeInsight.intention.HighPriorityAction;
+import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class WrapLongWithMathToIntExactFix extends LocalQuickFixAndIntentionActionOnPsiElement implements HighPriorityAction {
+  private final static Logger LOG = Logger.getInstance(WrapLongWithMathToIntExactFix.class);
+
+  public final static MyMethodArgumentFixerFactory REGISTAR = new MyMethodArgumentFixerFactory();
+
+  public WrapLongWithMathToIntExactFix(final @NotNull PsiExpression expression) {
+    super(expression);
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return getFamilyName();
+  }
+
+  @Override
+  public void invoke(@NotNull Project project,
+                     @NotNull PsiFile file,
+                     @Nullable("is null when called from inspection") Editor editor,
+                     @NotNull PsiElement startElement,
+                     @NotNull PsiElement endElement) {
+    startElement.replace(getModifiedExpression(startElement));
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull Project project,
+                             @NotNull PsiFile file,
+                             @NotNull PsiElement startElement,
+                             @NotNull PsiElement endElement) {
+    return startElement.isValid() && startElement.getManager().isInProject(startElement) && PsiUtil.isLanguageLevel8OrHigher(startElement);
+  }
+
+  @Nls
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return QuickFixBundle.message("wrap.long.with.math.to.int.text");
+  }
+
+  private static PsiElement getModifiedExpression(PsiElement expression) {
+    return JavaPsiFacade.getElementFactory(expression.getProject()).createExpressionFromText("java.lang.Math.toIntExact(" + expression.getText() + ")", expression);
+  }
+
+  private static class MyMethodArgumentFix extends MethodArgumentFix implements HighPriorityAction {
+
+    protected MyMethodArgumentFix(@NotNull PsiExpressionList list,
+                                  int i,
+                                  @NotNull PsiType toType,
+                                  @NotNull ArgumentFixerActionFactory fixerActionFactory) {
+      super(list, i, toType, fixerActionFactory);
+    }
+
+    @Nls
+    @NotNull
+    @Override
+    public String getText() {
+      return myArgList.getExpressions().length == 1
+             ? QuickFixBundle.message("wrap.long.with.math.to.int.parameter.single.text")
+             : QuickFixBundle.message("wrap.long.with.math.to.int.parameter.multiple.text", myIndex + 1);
+    }
+
+    @Override
+    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+      return PsiUtil.isLanguageLevel8OrHigher(file) && super.isAvailable(project, editor, file);
+    }
+  }
+
+  public static class MyMethodArgumentFixerFactory extends ArgumentFixerActionFactory {
+    @Nullable
+    @Override
+    protected PsiExpression getModifiedArgument(final PsiExpression expression, final PsiType toType) throws IncorrectOperationException {
+      return PsiType.INT.equals(toType) ? (PsiExpression)getModifiedExpression(expression) : null;
+    }
+
+    @Override
+    public boolean areTypesConvertible(final PsiType exprType, final PsiType parameterType, final PsiElement context) {
+      return parameterType.isConvertibleFrom(exprType) || (PsiType.INT.equals(parameterType) && PsiType.LONG.equals(exprType));
+    }
+
+    @Override
+    public MethodArgumentFix createFix(final PsiExpressionList list, final int i, final PsiType toType) {
+      return new MyMethodArgumentFix(list, i, toType, this);
+    }
+  }
+}
index 4554b15b90414cef2937dda51dbaeb00c6552d60..7b1af3b24ae9d13e43527a8ed94a7f7572a95d20 100644 (file)
@@ -26,6 +26,7 @@ import com.intellij.psi.PsiType;
 import com.intellij.util.containers.HashMap;
 import gnu.trove.THashMap;
 import gnu.trove.TObjectHashingStrategy;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.Map;
 
@@ -110,7 +111,10 @@ public class ExpressionTypeMemoryState extends DfaMemoryStateImpl {
     return super.toString() + " states=[" + new HashMap<PsiExpression, PsiType>(myStates) + "]";
   }
 
-  public void setExpressionType(PsiExpression expression, PsiType type) {
-    myStates.put(expression, type);
+  public void setExpressionType(PsiExpression expression, @NotNull PsiType type) {
+    PsiType prev = myStates.get(expression);
+    if (prev == null || !type.isAssignableFrom(prev)) {
+      myStates.put(expression, type);
+    }
   }
 }
index e886be781eab44583d68f37114a720e00d431389..0e4142979c6a9f58403c22db32c10e8cdb5c4a26 100644 (file)
@@ -608,4 +608,10 @@ public class EmptyQuickFixFactory extends QuickFixFactory {
   public IntentionAction addMethodQualifierFix(@NotNull PsiMethodCallExpression methodCall) {
     return QuickFixes.EMPTY_FIX;
   }
+
+  @NotNull
+  @Override
+  public IntentionAction createWrapLongWithMathToIntExactFix(@NotNull PsiExpression expression) {
+    return QuickFixes.EMPTY_FIX;
+  }
 }
index ea2209f232eee80ea1d2f624a1bad0d07fdb4e3f..04a925b970d9d687f40cd0052180c171724537e0 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.FileModificationService;
 import com.intellij.codeInsight.daemon.GroupNames;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -69,7 +68,7 @@ public class AnonymousCanBeMethodReferenceInspection extends BaseJavaBatchLocalI
           final PsiMethod method = aClass.getMethods()[0];
           final PsiCodeBlock body = method.getBody();
           final PsiCallExpression callExpression =
-            LambdaCanBeMethodReferenceInspection.canBeMethodReferenceProblem(body, method.getParameterList().getParameters(), aClass.getBaseClassType());
+            LambdaCanBeMethodReferenceInspection.canBeMethodReferenceProblem(body, method.getParameterList().getParameters(), aClass.getBaseClassType(), aClass.getParent());
           if (callExpression != null) {
             final PsiMethod resolveMethod = callExpression.resolveMethod();
             if (resolveMethod != method &&
@@ -118,7 +117,7 @@ public class AnonymousCanBeMethodReferenceInspection extends BaseJavaBatchLocalI
 
           final PsiParameter[] parameters = methods[0].getParameterList().getParameters();
           final PsiCallExpression callExpression = LambdaCanBeMethodReferenceInspection
-            .canBeMethodReferenceProblem(methods[0].getBody(), parameters, anonymousClass.getBaseClassType());
+            .canBeMethodReferenceProblem(methods[0].getBody(), parameters, anonymousClass.getBaseClassType(), anonymousClass.getParent());
           if (callExpression == null) return;
           final String methodRefText =
             LambdaCanBeMethodReferenceInspection.createMethodReferenceText(callExpression, anonymousClass.getBaseClassType(), parameters);
index 140f672f1a3016177989e529bd9711cd2ce34f44..2abba13e3c347efd33cbadfbb95280eab3afcf2b 100644 (file)
@@ -89,8 +89,16 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
 
   @Nullable
   public static PsiCallExpression canBeMethodReferenceProblem(@Nullable final PsiElement body,
-                                                                 final PsiParameter[] parameters,
-                                                                 PsiType functionalInterfaceType) {
+                                                              final PsiParameter[] parameters,
+                                                              final PsiType functionalInterfaceType) {
+    return canBeMethodReferenceProblem(body, parameters, functionalInterfaceType, null);
+  }
+
+  @Nullable
+  public static PsiCallExpression canBeMethodReferenceProblem(@Nullable final PsiElement body,
+                                                              final PsiParameter[] parameters,
+                                                              PsiType functionalInterfaceType, 
+                                                              @Nullable PsiElement context) {
     final PsiCallExpression callExpression = extractMethodCallFromBlock(body);
     if (callExpression instanceof PsiNewExpression) {
       final PsiNewExpression newExpression = (PsiNewExpression)callExpression;
@@ -104,7 +112,7 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
       LOG.assertTrue(callExpression != null);
       final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(callExpression.getProject());
       final PsiMethodReferenceExpression methodReferenceExpression = 
-        (PsiMethodReferenceExpression)elementFactory.createExpressionFromText(methodReferenceText, callExpression);
+        (PsiMethodReferenceExpression)elementFactory.createExpressionFromText(methodReferenceText, context != null ? context : callExpression);
       final Map<PsiElement, PsiType> map = LambdaUtil.getFunctionalTypeMap();
       try {
         map.put(methodReferenceExpression, functionalInterfaceType);
@@ -367,7 +375,10 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
         return getClassReferenceName(containingClass);
       }
       else {
-        final PsiClass parentContainingClass = PsiTreeUtil.getParentOfType(methodCall, PsiClass.class);
+        PsiClass parentContainingClass = PsiTreeUtil.getParentOfType(methodCall, PsiClass.class);
+        if (parentContainingClass instanceof PsiAnonymousClass) {
+          parentContainingClass = PsiTreeUtil.getParentOfType(parentContainingClass, PsiClass.class, true);
+        }
         PsiClass treeContainingClass = parentContainingClass;
         while (treeContainingClass != null && !InheritanceUtil.isInheritorOrSelf(treeContainingClass, containingClass, true)) {
           treeContainingClass = PsiTreeUtil.getParentOfType(treeContainingClass, PsiClass.class, true);
index 3ffd0427a74a47339dcdb76c33e89883dbc1728e..f253ac0f3e144bd8697450ba667fa091f38c8e6e 100644 (file)
@@ -111,7 +111,10 @@ public class RedundantLambdaCodeBlockInspection extends BaseJavaBatchLocalInspec
                 if (argumentList == null) {
                   return null;
                 }
-                conflictResolver.checkParametersNumber(info, argumentList.getExpressions().length, false);
+                final boolean atLeastOneMatchFound = conflictResolver.checkParametersNumber(info, argumentList.getExpressions().length, false);
+                if (!atLeastOneMatchFound) {
+                  return null;
+                }
                 conflictResolver.checkSpecifics(info, MethodCandidateInfo.ApplicabilityLevel.VARARGS, level);
                 if (info.size() > 1) {
                   return null;
index de61f5623bf3a8ab4647267ff7798d2c67cf32f6..833db62dbebe159b600dbd43fa446a54d0fc19f8 100644 (file)
@@ -40,7 +40,7 @@ public class BytecodeAnalysisIndex extends FileBasedIndexExtension<Bytes, HEquat
   private static final ClassDataIndexer INDEXER = new ClassDataIndexer();
   private static final HKeyDescriptor KEY_DESCRIPTOR = new HKeyDescriptor();
 
-  private static final int ourInternalVersion = 6;
+  private static final int ourInternalVersion = 7;
   private static final boolean ourEnabled = SystemProperties.getBooleanProperty("idea.enable.bytecode.contract.inference", true);
 
   @NotNull
index 7f203f194c8693b30bb0aba3c9ce37375c39d0da..b31f9499d70e62aa30154b1efd7116bdb9f21b03 100644 (file)
@@ -323,6 +323,13 @@ public class ClassDataIndexer implements DataIndexer<Bytes, HEquations, FileCont
           result.add(new Equation<Key, Value>(new Key(method, NullableOut, stable), NullableMethodAnalysis.analyze(methodNode, origins, jsr)));
         }
 
+        boolean withCycle = !richControlFlow.dfsTree.back.isEmpty();
+        if (argumentTypes.length > 50 && withCycle) {
+          // IDEA-137443 - do not analyze very complex methods
+          return;
+        }
+
+        // arguments and contract clauses
         for (int i = 0; i < argumentTypes.length; i++) {
           boolean notNullParam = false;
 
index 1a6e9214f6032c12b0b27b75a162fcea1465983a..209d0e91634c50e5497f8a0b44393f420aab4e1b 100644 (file)
@@ -1217,7 +1217,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
     }
   }
 
-  private void generateBoxingUnboxingInstructionFor(PsiExpression expression, PsiType expectedType) {
+  private void generateBoxingUnboxingInstructionFor(@NotNull PsiExpression expression, PsiType expectedType) {
     if (expectedType == PsiType.VOID) return;
 
     PsiType exprType = expression.getType();
@@ -1617,23 +1617,18 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
   @Override public void visitPostfixExpression(PsiPostfixExpression expression) {
     startElement(expression);
 
-    PsiExpression operand = expression.getOperand();
-    operand.accept(this);
-    generateBoxingUnboxingInstructionFor(operand, PsiType.INT);
+    PsiExpression operand = PsiUtil.skipParenthesizedExprDown(expression.getOperand());
+    if (operand != null) {
+      operand.accept(this);
+      generateBoxingUnboxingInstructionFor(operand, PsiType.INT);
+    } else {
+      pushUnknown();
+    }
 
     addInstruction(new PopInstruction());
     pushUnknown();
 
-    if (operand instanceof PsiReferenceExpression) {
-      PsiVariable psiVariable = DfaValueFactory.resolveUnqualifiedVariable((PsiReferenceExpression)expression.getOperand());
-      if (psiVariable != null) {
-        DfaVariableValue dfaVariable = myFactory.getVarFactory().createVariableValue(psiVariable, false);
-        addInstruction(new FlushVariableInstruction(dfaVariable));
-        if (psiVariable instanceof PsiField) {
-          addInstruction(new FlushVariableInstruction(null));
-        }
-      }
-    }
+    flushIncrementedValue(operand);
 
     finishElement(expression);
   }
@@ -1643,7 +1638,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
 
     DfaValue dfaValue = myFactory.createValue(expression);
     if (dfaValue == null) {
-      PsiExpression operand = expression.getOperand();
+      PsiExpression operand = PsiUtil.skipParenthesizedExprDown(expression.getOperand());
 
       if (operand == null) {
         pushUnknown();
@@ -1660,16 +1655,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
           addInstruction(new PopInstruction());
           pushUnknown();
 
-          if (operand instanceof PsiReferenceExpression) {
-            PsiVariable psiVariable = DfaValueFactory.resolveUnqualifiedVariable((PsiReferenceExpression)operand);
-            if (psiVariable != null) {
-              DfaVariableValue dfaVariable = myFactory.getVarFactory().createVariableValue(psiVariable, false);
-              addInstruction(new FlushVariableInstruction(dfaVariable));
-              if (psiVariable instanceof PsiField) {
-                addInstruction(new FlushVariableInstruction(null));
-              }
-            }
-          }
+          flushIncrementedValue(operand);
         }
       }
     }
@@ -1680,6 +1666,19 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
     finishElement(expression);
   }
 
+  private void flushIncrementedValue(@Nullable PsiExpression operand) {
+    if (operand instanceof PsiReferenceExpression) {
+      PsiVariable psiVariable = DfaValueFactory.resolveUnqualifiedVariable((PsiReferenceExpression)operand);
+      if (psiVariable != null) {
+        DfaVariableValue dfaVariable = myFactory.getVarFactory().createVariableValue(psiVariable, false);
+        addInstruction(new FlushVariableInstruction(dfaVariable));
+        if (psiVariable instanceof PsiField) {
+          addInstruction(new FlushVariableInstruction(null));
+        }
+      }
+    }
+  }
+
   @Override public void visitReferenceExpression(PsiReferenceExpression expression) {
     startElement(expression);
 
index d50e0038aff0ffcbd70e9e23bdfdaa0bd1b022f8..a7894bf8e020143e583d5358c9199ea2c319581b 100644 (file)
@@ -549,10 +549,12 @@ public class StandardInstructionVisitor extends InstructionVisitor {
     if (opSign == LT && comparedWith <= rangeMin) return alwaysFalse(instruction, runner, memState);
     if (opSign == LT && comparedWith > rangeMax) return alwaysTrue(instruction, runner, memState);
     if (opSign == LE && comparedWith >= rangeMax) return alwaysTrue(instruction, runner, memState);
+    if (opSign == LE && comparedWith < rangeMin) return alwaysFalse(instruction, runner, memState);
 
     if (opSign == GT && comparedWith >= rangeMax) return alwaysFalse(instruction, runner, memState);
     if (opSign == GT && comparedWith < rangeMin) return alwaysTrue(instruction, runner, memState);
     if (opSign == GE && comparedWith <= rangeMin) return alwaysTrue(instruction, runner, memState);
+    if (opSign == GE && comparedWith > rangeMax) return alwaysFalse(instruction, runner, memState);
 
     return null;
   }
index 6977028bfe7a8d80ae52ee62c1195abcfeb0d46c..1d9fd85aeee0f40a7e52b15e68f2315a66f9de59 100644 (file)
@@ -206,7 +206,7 @@ public class Java15APIUsageInspectionBase extends BaseJavaBatchLocalInspectionTo
 
     @Override public void visitClass(PsiClass aClass) {
       // Don't go into classes (anonymous, locals).
-      if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
+      if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !(aClass instanceof PsiTypeParameter)) {
         final Module module = ModuleUtilCore.findModuleForPsiElement(aClass);
         final LanguageLevel effectiveLanguageLevel = module != null ? getEffectiveLanguageLevel(module) : null;
         if (effectiveLanguageLevel != null && !effectiveLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
index c6aeb59b5b24d15232827872ee40a87158976a06..5ab01c3ce6f6e9d4d0d238fa3b6d5655f4188433 100644 (file)
@@ -96,28 +96,45 @@ public class SillyAssignmentInspectionBase extends BaseJavaBatchLocalInspectionT
     PsiExpression lExpression = assignment.getLExpression();
     PsiExpression rExpression = assignment.getRExpression();
     if (rExpression == null) return;
+
     lExpression = PsiUtil.deparenthesizeExpression(lExpression);
-    rExpression = PsiUtil.deparenthesizeExpression(rExpression);
     if (!(lExpression instanceof PsiReferenceExpression)) return;
+    PsiReferenceExpression lRef = (PsiReferenceExpression)lExpression;
+    final PsiVariable variable = (PsiVariable)lRef.resolve();
+    if (variable == null) return;
+
+    rExpression = deparenthesizeRExpr(rExpression, variable);
+
     PsiReferenceExpression rRef;
     if (!(rExpression instanceof PsiReferenceExpression)) {
       if (!(rExpression instanceof PsiAssignmentExpression)) return;
       final PsiAssignmentExpression rAssignmentExpression = (PsiAssignmentExpression)rExpression;
-      final PsiExpression assignee = PsiUtil.deparenthesizeExpression(rAssignmentExpression.getLExpression());
+      final PsiExpression assignee = deparenthesizeRExpr(rAssignmentExpression.getLExpression(), variable);
       if (!(assignee instanceof PsiReferenceExpression)) return;
       rRef = (PsiReferenceExpression)assignee;
     } else {
       rRef = (PsiReferenceExpression)rExpression;
     }
-    PsiReferenceExpression lRef = (PsiReferenceExpression)lExpression;
     PsiManager manager = assignment.getManager();
     if (!sameInstanceReferences(lRef, rRef, manager)) return;
-    final PsiVariable variable = (PsiVariable)lRef.resolve();
-    if (variable == null) return;
     holder.registerProblem(assignment, InspectionsBundle.message("assignment.to.itself.problem.descriptor", variable.getName()),
                            ProblemHighlightType.LIKE_UNUSED_SYMBOL, createRemoveAssignmentFix());
   }
 
+  private static PsiExpression deparenthesizeRExpr(PsiExpression rExpression, PsiVariable variable) {
+    rExpression = PsiUtil.skipParenthesizedExprDown(rExpression);
+    if (rExpression instanceof PsiTypeCastExpression) {
+      final PsiTypeElement castTypeElement = ((PsiTypeCastExpression)rExpression).getCastType();
+      if (castTypeElement != null &&
+          castTypeElement.getType() instanceof PsiPrimitiveType &&
+          variable.getType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
+        return rExpression;
+      }
+      return PsiUtil.deparenthesizeExpression(rExpression);
+    }
+    return rExpression;
+  }
+
   protected LocalQuickFix createRemoveAssignmentFix() {
     return null;
   }
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ArrayMemberAccess.java b/java/java-impl/src/com/intellij/codeInsight/completion/ArrayMemberAccess.java
new file mode 100644 (file)
index 0000000..9847eac
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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 com.intellij.codeInsight.completion;
+
+import com.intellij.codeInsight.lookup.ExpressionLookupItem;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.openapi.util.Iconable;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.util.Consumer;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor.createExpression;
+import static com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor.getQualifierText;
+import static com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor.getSpace;
+
+/**
+ * @author peter
+ */
+class ArrayMemberAccess {
+  static void addMemberAccessors(final PsiElement element, final String prefix, final PsiType itemType,
+                                 final PsiElement qualifier, final Consumer<LookupElement> result, PsiModifierListOwner object,
+                                 final PsiType expectedType)
+    throws IncorrectOperationException {
+    if (itemType instanceof PsiArrayType && expectedType.isAssignableFrom(((PsiArrayType)itemType).getComponentType())) {
+      final PsiExpression conversion = createExpression(getQualifierText(qualifier) + prefix + "[0]", element);
+      result.consume(new ExpressionLookupItem(conversion, object.getIcon(Iconable.ICON_FLAG_VISIBILITY), prefix + "[...]", prefix) {
+        @Override
+        public void handleInsert(InsertionContext context) {
+          FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_ARRAY_MEMBER);
+
+          final int tailOffset = context.getTailOffset();
+          final String callSpace = getSpace(CodeStyleSettingsManager.getSettings(element.getProject()).SPACE_WITHIN_BRACKETS);
+          context.getDocument().insertString(tailOffset, "[" + callSpace + callSpace + "]");
+          context.getEditor().getCaretModel().moveToOffset(tailOffset + 1 + callSpace.length());
+        }
+      });
+    }
+  }
+
+  @Nullable
+  static ExpressionLookupItem accessFirstElement(PsiElement element, LookupElement item) {
+    if (item.getObject() instanceof PsiLocalVariable) {
+      final PsiLocalVariable variable = (PsiLocalVariable)item.getObject();
+      final PsiType type = variable.getType();
+      final PsiExpression expression = variable.getInitializer();
+      if (type instanceof PsiArrayType && expression instanceof PsiNewExpression) {
+        final PsiNewExpression newExpression = (PsiNewExpression)expression;
+        final PsiExpression[] dimensions = newExpression.getArrayDimensions();
+        if (dimensions.length == 1 && "1".equals(dimensions[0].getText()) && newExpression.getArrayInitializer() == null) {
+          final String text = variable.getName() + "[0]";
+          return new ExpressionLookupItem(createExpression(text, element), variable.getIcon(Iconable.ICON_FLAG_VISIBILITY), text, text);
+        }
+      }
+    }
+    return null;
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ChainedCallCompletion.java b/java/java-impl/src/com/intellij/codeInsight/completion/ChainedCallCompletion.java
new file mode 100644 (file)
index 0000000..b497d44
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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 com.intellij.codeInsight.completion;
+
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.patterns.PsiMethodPattern;
+import com.intellij.patterns.StandardPatterns;
+import com.intellij.psi.*;
+import com.intellij.psi.filters.ElementFilter;
+import com.intellij.psi.util.InheritanceUtil;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.Consumer;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NonNls;
+
+import static com.intellij.patterns.PsiJavaPatterns.psiMethod;
+
+/**
+ * @author peter
+ */
+class ChainedCallCompletion {
+  private static final PsiMethodPattern OBJECT_METHOD_PATTERN = psiMethod().withName(
+    StandardPatterns.string().oneOf("hashCode", "equals", "finalize", "wait", "notify", "notifyAll", "getClass", "clone", "toString")).
+    definedInClass(CommonClassNames.JAVA_LANG_OBJECT);
+
+  static void addChains(final PsiElement place, LookupElement qualifierItem,
+                        final Consumer<LookupElement> result,
+                        PsiType qualifierType,
+                        final PsiType expectedType, JavaSmartCompletionParameters parameters) throws
+                                                                                                           IncorrectOperationException {
+    final Object object = qualifierItem.getObject();
+    if (OBJECT_METHOD_PATTERN.accepts(object) && !allowGetClass(object, parameters)) {
+      return;
+    }
+
+    if (parameters.getParameters().getInvocationCount() < 3 && qualifierType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
+      return;
+    }
+
+    if (object instanceof PsiMethod && ((PsiMethod)object).getParameterList().getParametersCount() > 0) {
+      return;
+    }
+
+    final PsiReferenceExpression mockRef = ReferenceExpressionCompletionContributor.createMockReference(place, qualifierType, qualifierItem);
+    if (mockRef == null) {
+      return;
+    }
+
+    final ElementFilter filter = ReferenceExpressionCompletionContributor.getReferenceFilter(place, true);
+    for (final LookupElement item : ReferenceExpressionCompletionContributor.completeFinalReference(place, mockRef, filter, parameters)) {
+      if (shouldChain(place, qualifierType, expectedType, item)) {
+        result.consume(new JavaChainLookupElement(qualifierItem, item) {
+          @Override
+          public void handleInsert(InsertionContext context) {
+            FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_CHAIN);
+            super.handleInsert(context);
+          }
+        });
+      }
+    }
+  }
+
+  private static boolean shouldChain(PsiElement element, PsiType qualifierType, PsiType expectedType, LookupElement item) {
+    Object object = item.getObject();
+    if (object instanceof PsiModifierListOwner && ((PsiModifierListOwner)object).hasModifierProperty(PsiModifier.STATIC)) {
+      return false;
+    }
+
+    if (object instanceof PsiMethod) {
+      final PsiMethod method = (PsiMethod)object;
+      if (psiMethod().withName("toArray").withParameterCount(1)
+        .definedInClass(CommonClassNames.JAVA_UTIL_COLLECTION).accepts(method)) {
+        return false;
+      }
+      final PsiMethod parentMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
+      if (isUselessObjectMethod(method, parentMethod, qualifierType)) {
+        return false;
+      }
+
+      final PsiType type = method.getReturnType();
+      if (type instanceof PsiClassType) {
+        final PsiClassType classType = (PsiClassType)type;
+        final PsiClass psiClass = classType.resolve();
+        if (psiClass instanceof PsiTypeParameter && method.getTypeParameterList() == psiClass.getParent()) {
+          final PsiTypeParameter typeParameter = (PsiTypeParameter)psiClass;
+          if (typeParameter.getExtendsListTypes().length == 0) return false;
+          if (!expectedType.isAssignableFrom(TypeConversionUtil.typeParameterErasure(typeParameter))) return false;
+        }
+      }
+    }
+    return true;
+  }
+
+  private static boolean isUselessObjectMethod(PsiMethod method, PsiMethod parentMethod, PsiType qualifierType) {
+    if (!OBJECT_METHOD_PATTERN.accepts(method)) {
+      return false;
+    }
+
+    if (OBJECT_METHOD_PATTERN.accepts(parentMethod) && method.getName().equals(parentMethod.getName())) {
+      return false;
+    }
+
+    if ("toString".equals(method.getName())) {
+      if (qualifierType.equalsToText(CommonClassNames.JAVA_LANG_STRING_BUFFER) ||
+          InheritanceUtil.isInheritor(qualifierType, CommonClassNames.JAVA_LANG_ABSTRACT_STRING_BUILDER)) {
+        return false;
+      }
+    }
+
+    return true;
+  }
+
+  private static boolean allowGetClass(final Object object, final JavaSmartCompletionParameters parameters) {
+    if (!"getClass".equals(((PsiMethod)object).getName())) return false;
+
+    final PsiType type = parameters.getDefaultType();
+    @NonNls final String canonicalText = type.getCanonicalText();
+    if ("java.lang.ClassLoader".equals(canonicalText)) return true;
+    if (canonicalText.startsWith("java.lang.reflect.")) return true;
+    return false;
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/FromArrayConversion.java b/java/java-impl/src/com/intellij/codeInsight/completion/FromArrayConversion.java
new file mode 100644 (file)
index 0000000..cd99db1
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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 com.intellij.codeInsight.completion;
+
+import com.intellij.codeInsight.lookup.ExpressionLookupItem;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.Consumer;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.PlatformIcons;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor.createExpression;
+import static com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor.getSpace;
+
+/**
+ * @author peter
+ */
+class FromArrayConversion {
+  static void addConversions(final PsiElement element,
+                             final String prefix,
+                             final PsiType itemType,
+                             final Consumer<LookupElement> result,
+                             @Nullable PsiElement qualifier,
+                             final PsiType expectedType) throws IncorrectOperationException {
+    final String methodName = getArraysConversionMethod(itemType, expectedType);
+    if (methodName == null) return;
+
+    final String qualifierText = ReferenceExpressionCompletionContributor.getQualifierText(qualifier);
+    final PsiExpression conversion = createExpression("java.util.Arrays." + methodName + "(" + qualifierText + prefix + ")", element);
+    final String presentable = "Arrays." + methodName + "(" + qualifierText + prefix + ")";
+    String[] lookupStrings = {StringUtil.isEmpty(qualifierText) ? presentable : prefix, prefix, presentable, methodName + "(" + prefix + ")"};
+    result.consume(new ExpressionLookupItem(conversion, PlatformIcons.METHOD_ICON, presentable, lookupStrings) {
+      @Override
+      public void handleInsert(InsertionContext context) {
+        FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_ASLIST);
+
+        int startOffset = context.getStartOffset() - qualifierText.length();
+        final Project project = element.getProject();
+        final String callSpace = getSpace(CodeStyleSettingsManager.getSettings(project).SPACE_WITHIN_METHOD_CALL_PARENTHESES);
+        final String newText = "java.util.Arrays." + methodName + "(" + callSpace + qualifierText + prefix + callSpace + ")";
+        context.getDocument().replaceString(startOffset, context.getTailOffset(), newText);
+
+        context.commitDocument();
+        JavaCodeStyleManager.getInstance(project).shortenClassReferences(context.getFile(), startOffset, startOffset + CommonClassNames.JAVA_UTIL_ARRAYS.length());
+      }
+    });
+  }
+
+  @Nullable
+  private static String getArraysConversionMethod(PsiType itemType, PsiType expectedType) {
+    String methodName = "asList";
+    PsiType componentType = PsiUtil.extractIterableTypeParameter(expectedType, true);
+    if (componentType == null) {
+      methodName = "stream";
+      componentType = getStreamComponentType(expectedType);
+      PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(componentType);
+      if (unboxedType != null) {
+        componentType = unboxedType;
+      }
+    }
+
+    if (componentType == null ||
+        !(itemType instanceof PsiArrayType) ||
+        !componentType.isAssignableFrom(((PsiArrayType)itemType).getComponentType())) {
+      return null;
+
+    }
+    return methodName;
+  }
+
+  private static PsiType getStreamComponentType(PsiType expectedType) {
+    return PsiUtil.substituteTypeParameter(expectedType, CommonClassNames.JAVA_UTIL_STREAM_BASE_STREAM, 0, true);
+  }
+}
index ca6a491d5d826577e5a8ade89c43476f2aeb4ce2..949590106a0882a63465f7ecf778e2b3740eabab 100644 (file)
@@ -64,7 +64,7 @@ public class JavaCompletionSorting {
 
     CompletionSorter sorter = CompletionSorter.defaultSorter(parameters, result.getPrefixMatcher());
     if (!smart && afterNew) {
-      sorter = sorter.weighBefore("liftShorter", new PreferExpected(true, expectedTypes));
+      sorter = sorter.weighBefore("liftShorter", new PreferExpected(true, expectedTypes, position));
     } else if (PsiTreeUtil.getParentOfType(position, PsiReferenceList.class) == null) {
       sorter = ((CompletionSorterImpl)sorter).withClassifier("liftShorterClasses", true, new LiftShorterClasses(position));
     }
@@ -77,7 +77,7 @@ public class JavaCompletionSorting {
     if (!smart) {
       ContainerUtil.addIfNotNull(afterPrefix, preferStatics(position, expectedTypes));
       if (!afterNew) {
-        afterPrefix.add(new PreferExpected(false, expectedTypes));
+        afterPrefix.add(new PreferExpected(false, expectedTypes, position));
       }
     }
     ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes));
@@ -138,7 +138,7 @@ public class JavaCompletionSorting {
     };
   }
 
-  private static ExpectedTypeMatching getExpectedTypeMatching(LookupElement item, ExpectedTypeInfo[] expectedInfos) {
+  private static ExpectedTypeMatching getExpectedTypeMatching(LookupElement item, ExpectedTypeInfo[] expectedInfos, @Nullable String expectedMemberName) {
     PsiType itemType = JavaCompletionUtil.getLookupElementType(item);
 
     if (itemType != null) {
@@ -172,6 +172,22 @@ public class JavaCompletionSorting {
       return ExpectedTypeMatching.unexpected;
     }
 
+    return preferByMemberName(expectedMemberName, itemType);
+  }
+
+  @NotNull
+  private static ExpectedTypeMatching preferByMemberName(@Nullable String expectedMemberName, @Nullable PsiType itemType) {
+    if (expectedMemberName != null) {
+      PsiClass itemClass = PsiUtil.resolveClassInClassTypeOnly(itemType);
+      if (itemClass != null) {
+        if (itemClass.findMethodsByName(expectedMemberName, true).length > 0 ||
+            itemClass.findFieldByName(expectedMemberName, true) != null ||
+            itemClass.findInnerClassByName(expectedMemberName, true) != null) {
+          return ExpectedTypeMatching.expected;
+        }
+      }
+    }
+
     return ExpectedTypeMatching.normal;
   }
 
@@ -429,14 +445,28 @@ public class JavaCompletionSorting {
     private final boolean myConstructorPossible;
     private final ExpectedTypeInfo[] myExpectedTypes;
     private final List<PsiType> myExpectedClasses = new SmartList<PsiType>();
+    private final String myExpectedMemberName;
 
-    public PreferExpected(boolean constructorPossible, ExpectedTypeInfo[] expectedTypes) {
+    public PreferExpected(boolean constructorPossible, ExpectedTypeInfo[] expectedTypes, PsiElement position) {
       super("expectedType");
       myConstructorPossible = constructorPossible;
       myExpectedTypes = expectedTypes;
       for (ExpectedTypeInfo info : expectedTypes) {
         ContainerUtil.addIfNotNull(myExpectedClasses, PsiUtil.substituteTypeParameter(info.getDefaultType(), CommonClassNames.JAVA_LANG_CLASS, 0, false));
       }
+
+      myExpectedMemberName = calcExpectedMemberName(position);
+    }
+
+    @Nullable
+    private static String calcExpectedMemberName(PsiElement position) {
+      if (position.getParent() instanceof PsiJavaCodeReferenceElement) {
+        PsiElement grand = position.getParent().getParent();
+        if (grand instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)grand).getQualifier() == position.getParent()) {
+          return ((PsiJavaCodeReferenceElement)grand).getReferenceName();
+        }
+      }
+      return null;
     }
 
     @NotNull
@@ -451,10 +481,10 @@ public class JavaCompletionSorting {
             }
           }
         }
-        return ExpectedTypeMatching.normal;
+        return preferByMemberName(myExpectedMemberName, itemType);
       }
 
-      return getExpectedTypeMatching(item, myExpectedTypes);
+      return getExpectedTypeMatching(item, myExpectedTypes, myExpectedMemberName);
     }
   }
 
index 24b1b4a897ae8153d876ec6c4f23d4e5b680c058..dc12d45ad3fee0c3b92fe378a81346cb98bbc691 100644 (file)
@@ -274,7 +274,7 @@ public class JavaCompletionUtil {
     if (runtimeQualifier != null) {
       PsiType composite = qualifierType == null ? runtimeQualifier : PsiIntersectionType.createIntersection(qualifierType, runtimeQualifier);
       PsiElement ctx = createContextWithXxxVariable(element, composite);
-      javaReference = (PsiReferenceExpression) JavaPsiFacade.getElementFactory(element.getProject()).createExpressionFromText("xxx.xxx", ctx);
+      javaReference = createReference("xxx.xxx", ctx);
       qualifierType = runtimeQualifier;
       processor.setQualifierType(qualifierType);
     }
@@ -306,21 +306,32 @@ public class JavaCompletionUtil {
       }
     }
 
-    if (javaReference instanceof PsiJavaCodeReferenceElement && !((PsiJavaCodeReferenceElement)javaReference).isQualified()) {
-      final StaticMemberProcessor memberProcessor = new JavaStaticMemberProcessor(parameters);
-      memberProcessor.processMembersOfRegisteredClasses(matcher, new PairConsumer<PsiMember, PsiClass>() {
-        @Override
-        public void consume(PsiMember member, PsiClass psiClass) {
-          if (!mentioned.contains(member) && processor.satisfies(member, ResolveState.initial())) {
-            set.add(memberProcessor.createLookupElement(member, psiClass, true));
+    if (javaReference instanceof PsiJavaCodeReferenceElement) {
+      PsiElement refQualifier = ((PsiJavaCodeReferenceElement)javaReference).getQualifier();
+      if (refQualifier == null) {
+        final StaticMemberProcessor memberProcessor = new JavaStaticMemberProcessor(parameters);
+        memberProcessor.processMembersOfRegisteredClasses(matcher, new PairConsumer<PsiMember, PsiClass>() {
+          @Override
+          public void consume(PsiMember member, PsiClass psiClass) {
+            if (!mentioned.contains(member) && processor.satisfies(member, ResolveState.initial())) {
+              set.add(memberProcessor.createLookupElement(member, psiClass, true));
+            }
           }
-        }
-      });
+        });
+      }
+      else if (refQualifier instanceof PsiSuperExpression && ((PsiSuperExpression)refQualifier).getQualifier() == null) {
+        set.addAll(SuperCalls.suggestQualifyingSuperCalls(element, javaReference, elementFilter, options, nameCondition));
+      }
     }
 
     return set;
   }
 
+  @NotNull
+  static PsiReferenceExpression createReference(@NotNull String text, @NotNull PsiElement context) {
+    return (PsiReferenceExpression) JavaPsiFacade.getElementFactory(context.getProject()).createExpressionFromText(text, context);
+  }
+
   @Nullable
   private static PsiType getQualifierCastType(PsiJavaReference javaReference, CompletionParameters parameters) {
     if (javaReference instanceof PsiReferenceExpression) {
@@ -480,7 +491,7 @@ public class JavaCompletionUtil {
     return false;
   }
 
-  private static List<? extends LookupElement> createLookupElements(CompletionElement completionElement, PsiJavaReference reference) {
+  static List<? extends LookupElement> createLookupElements(CompletionElement completionElement, PsiJavaReference reference) {
     Object completion = completionElement.getElement();
     assert !(completion instanceof LookupElement);
 
index 1f8d88ae665f5ae8cf053c95fe8fe8b4b29cb997..969dfdbcd6b75efcd75a35a533339ca3cfb72b14 100644 (file)
@@ -42,8 +42,10 @@ import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import static com.intellij.openapi.util.Conditions.notInstanceOf;
 import static com.intellij.patterns.PsiJavaPatterns.*;
 import static com.intellij.patterns.StandardPatterns.not;
+import static com.intellij.psi.SyntaxTraverser.psiApi;
 
 public class JavaKeywordCompletion {
   public static final ElementPattern<PsiElement> AFTER_DOT = psiElement().afterLeaf(".");
@@ -668,6 +670,10 @@ public class JavaKeywordCompletion {
     if (psiElement().inside(PsiSwitchStatement.class).accepts(position)) {
       result.consume(br);
     }
+
+    for (PsiLabeledStatement labeled : psiApi().parents(position).takeWhile(notInstanceOf(PsiMember.class)).filter(PsiLabeledStatement.class)) {
+      result.consume(TailTypeDecorator.withTail(LookupElementBuilder.create("break " + labeled.getName()).bold(), TailType.SEMICOLON));
+    }
   }
 
   private static boolean isStatementPosition(PsiElement position) {
index 7db3f1e6a1abfeff80e0f9768b3a7746d0c77be5..aae7f356b6d9e24ddc13f358a037e624b52c841b 100644 (file)
@@ -17,30 +17,18 @@ package com.intellij.codeInsight.completion;
 
 import com.intellij.codeInsight.lookup.ExpressionLookupItem;
 import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.featureStatistics.FeatureUsageTracker;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Iconable;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.patterns.ElementPattern;
-import com.intellij.patterns.PsiMethodPattern;
 import com.intellij.patterns.StandardPatterns;
 import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.filters.*;
 import com.intellij.psi.filters.element.ModifierFilter;
 import com.intellij.psi.filters.types.AssignableFromFilter;
 import com.intellij.psi.infos.CandidateInfo;
-import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiUtil;
-import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.Consumer;
 import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.PlatformIcons;
 import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -49,33 +37,17 @@ import java.util.LinkedHashSet;
 import java.util.Set;
 
 import static com.intellij.patterns.PsiJavaPatterns.psiElement;
-import static com.intellij.patterns.PsiJavaPatterns.psiMethod;
 
 /**
  * @author peter
  */
 public class ReferenceExpressionCompletionContributor {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor");
-  private static final PsiMethodPattern OBJECT_METHOD_PATTERN = psiMethod().withName(
-    StandardPatterns.string().oneOf("hashCode", "equals", "finalize", "wait", "notify", "notifyAll", "getClass", "clone", "toString")).
-      definedInClass(CommonClassNames.JAVA_LANG_OBJECT);
-  private static final PrefixMatcher TRUE_MATCHER = new PrefixMatcher("") {
-    @Override
-    public boolean prefixMatches(@NotNull String name) {
-      return true;
-    }
-
-    @NotNull
-    @Override
-    public PrefixMatcher cloneWithPrefix(@NotNull String prefix) {
-      return this;
-    }
-  };
   public static final ElementPattern<PsiElement> IN_SWITCH_LABEL =
     psiElement().withSuperParent(2, psiElement(PsiSwitchLabelStatement.class).withSuperParent(2, PsiSwitchStatement.class));
 
   @NotNull 
-  private static ElementFilter getReferenceFilter(PsiElement element, boolean allowRecursion) {
+  static ElementFilter getReferenceFilter(PsiElement element, boolean allowRecursion) {
     //throw foo
     if (psiElement().withParent(psiElement(PsiReferenceExpression.class).withParent(PsiThrowStatement.class)).accepts(element)) {
       return TrueFilter.INSTANCE;
@@ -136,7 +108,7 @@ public class ReferenceExpressionCompletionContributor {
       final Set<LookupElement> base =
         JavaSmartCompletionContributor.completeReference(element, reference, filter, false, true, parameters.getParameters(), PrefixMatcher.ALWAYS_TRUE);
       for (final LookupElement item : new LinkedHashSet<LookupElement>(base)) {
-        ExpressionLookupItem access = getSingleArrayElementAccess(element, item);
+        ExpressionLookupItem access = ArrayMemberAccess.accessFirstElement(element, item);
         if (access != null) {
           base.add(access);
           PsiType type = access.getType();
@@ -147,28 +119,13 @@ public class ReferenceExpressionCompletionContributor {
       }
 
       if (secondTime) {
-        return new Runnable() {
-          @Override
-          public void run() {
-            for (final LookupElement item : base) {
-              addSecondCompletionVariants(element, reference, item, parameters, result);
-            }
-            if (!psiElement().afterLeaf(".").accepts(element)) {
-              BasicExpressionCompletionContributor.processDataflowExpressionTypes(element, null, TRUE_MATCHER, new Consumer<LookupElement>() {
-                @Override
-                public void consume(LookupElement baseItem) {
-                  addSecondCompletionVariants(element, reference, baseItem, parameters, result);
-                }
-              });
-            }
-          }
-        };
+        return new SlowerTypeConversions(base, element, reference, parameters, result);
       }
     }
     return null;
   }
 
-  private static Set<LookupElement> completeFinalReference(final PsiElement element, PsiJavaCodeReferenceElement reference, ElementFilter filter,
+  static Set<LookupElement> completeFinalReference(final PsiElement element, PsiJavaCodeReferenceElement reference, ElementFilter filter,
                                                            final JavaSmartCompletionParameters parameters) {
     final Set<PsiField> used = parameters.getParameters().getInvocationCount() < 2 ? findConstantsUsedInSwitch(element) : Collections.<PsiField>emptySet();
 
@@ -239,229 +196,14 @@ public class ReferenceExpressionCompletionContributor {
     return Collections.emptySet();
   }
 
-  @Nullable
-  private static ExpressionLookupItem getSingleArrayElementAccess(PsiElement element, LookupElement item) {
-    if (item.getObject() instanceof PsiLocalVariable) {
-      final PsiLocalVariable variable = (PsiLocalVariable)item.getObject();
-      final PsiType type = variable.getType();
-      final PsiExpression expression = variable.getInitializer();
-      if (type instanceof PsiArrayType && expression instanceof PsiNewExpression) {
-        final PsiNewExpression newExpression = (PsiNewExpression)expression;
-        final PsiExpression[] dimensions = newExpression.getArrayDimensions();
-        if (dimensions.length == 1 && "1".equals(dimensions[0].getText()) && newExpression.getArrayInitializer() == null) {
-          final String text = variable.getName() + "[0]";
-          return new ExpressionLookupItem(createExpression(text, element), variable.getIcon(Iconable.ICON_FLAG_VISIBILITY), text, text);
-        }
-      }
-    }
-    return null;
-  }
-
-  private static PsiExpression createExpression(String text, PsiElement element) {
+  static PsiExpression createExpression(String text, PsiElement element) {
     return JavaPsiFacade.getInstance(element.getProject()).getElementFactory().createExpressionFromText(text, element);
   }
 
-  private static void addSecondCompletionVariants(PsiElement element, PsiReference reference, LookupElement baseItem,
-                                                  JavaSmartCompletionParameters parameters, Consumer<LookupElement> result) {
-    final Object object = baseItem.getObject();
-
-    try {
-      PsiType itemType = JavaCompletionUtil.getLookupElementType(baseItem);
-      if (itemType instanceof PsiWildcardType) {
-        itemType = ((PsiWildcardType)itemType).getExtendsBound();
-      }
-      if (itemType == null) return;
-      assert itemType.isValid() : baseItem + "; " + baseItem.getClass();
-
-      final PsiElement element1 = reference.getElement();
-      final PsiElement qualifier =
-        element1 instanceof PsiJavaCodeReferenceElement ? ((PsiJavaCodeReferenceElement)element1).getQualifier() : null;
-      final PsiType expectedType = parameters.getExpectedType();
-      if (!OBJECT_METHOD_PATTERN.accepts(object) || allowGetClass(object, parameters)) {
-        if (parameters.getParameters().getInvocationCount() >= 3 || !itemType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
-          if (!(object instanceof PsiMethod && ((PsiMethod)object).getParameterList().getParametersCount() > 0)) {
-            addChainedCallVariants(element, baseItem, result, itemType, expectedType, parameters);
-          }
-        }
-      }
-
-      final String prefix = getItemText(object);
-      if (prefix == null) return;
-
-      addConversionsToArray(element, prefix, itemType, result, qualifier, expectedType);
-
-      addToArrayConversions(element, object, prefix, itemType, result, qualifier, expectedType);
-
-      addArrayMemberAccessors(element, prefix, itemType, qualifier, result, (PsiModifierListOwner)object, expectedType);
-    }
-    catch (IncorrectOperationException ignored) {
-    }
-  }
-
-  private static void addArrayMemberAccessors(final PsiElement element, final String prefix, final PsiType itemType,
-                                              final PsiElement qualifier, final Consumer<LookupElement> result, PsiModifierListOwner object,
-                                              final PsiType expectedType)
-      throws IncorrectOperationException {
-    if (itemType instanceof PsiArrayType && expectedType.isAssignableFrom(((PsiArrayType)itemType).getComponentType())) {
-      final PsiExpression conversion = createExpression(getQualifierText(qualifier) + prefix + "[0]", element);
-      result.consume(new ExpressionLookupItem(conversion, object.getIcon(Iconable.ICON_FLAG_VISIBILITY), prefix + "[...]", prefix) {
-        @Override
-        public void handleInsert(InsertionContext context) {
-          FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_ARRAY_MEMBER);
-
-          final int tailOffset = context.getTailOffset();
-          final String callSpace = getSpace(CodeStyleSettingsManager.getSettings(element.getProject()).SPACE_WITHIN_BRACKETS);
-          context.getDocument().insertString(tailOffset, "[" + callSpace + callSpace + "]");
-          context.getEditor().getCaretModel().moveToOffset(tailOffset + 1 + callSpace.length());
-        }
-      });
-    }
-  }
-
-  private static boolean allowGetClass(final Object object, final JavaSmartCompletionParameters parameters) {
-    if (!"getClass".equals(((PsiMethod)object).getName())) return false;
-
-    final PsiType type = parameters.getDefaultType();
-    @NonNls final String canonicalText = type.getCanonicalText();
-    if ("java.lang.ClassLoader".equals(canonicalText)) return true;
-    if (canonicalText.startsWith("java.lang.reflect.")) return true;
-    return false;
-  }
-
-  private static void addConversionsToArray(final PsiElement element,
-                                            final String prefix,
-                                            final PsiType itemType,
-                                            final Consumer<LookupElement> result,
-                                            @Nullable PsiElement qualifier,
-                                            final PsiType expectedType) throws IncorrectOperationException {
-    final String methodName = getArraysConversionMethod(itemType, expectedType);
-    if (methodName == null) return;
-    
-    final String qualifierText = getQualifierText(qualifier);
-    final PsiExpression conversion = createExpression("java.util.Arrays." + methodName + "(" + qualifierText + prefix + ")", element);
-    final String presentable = "Arrays." + methodName + "(" + qualifierText + prefix + ")";
-    String[] lookupStrings = {StringUtil.isEmpty(qualifierText) ? presentable : prefix, prefix, presentable, methodName + "(" + prefix + ")"};
-    result.consume(new ExpressionLookupItem(conversion, PlatformIcons.METHOD_ICON, presentable, lookupStrings) {
-      @Override
-      public void handleInsert(InsertionContext context) {
-        FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_ASLIST);
-
-        int startOffset = context.getStartOffset() - qualifierText.length();
-        final Project project = element.getProject();
-        final String callSpace = getSpace(CodeStyleSettingsManager.getSettings(project).SPACE_WITHIN_METHOD_CALL_PARENTHESES);
-        final String newText = "java.util.Arrays." + methodName + "(" + callSpace + qualifierText + prefix + callSpace + ")";
-        context.getDocument().replaceString(startOffset, context.getTailOffset(), newText);
-
-        context.commitDocument();
-        JavaCodeStyleManager.getInstance(project).shortenClassReferences(context.getFile(), startOffset, startOffset + CommonClassNames.JAVA_UTIL_ARRAYS.length());
-      }
-    });
-  }
-
-  @Nullable
-  private static String getArraysConversionMethod(PsiType itemType, PsiType expectedType) {
-    String methodName = "asList";
-    PsiType componentType = PsiUtil.extractIterableTypeParameter(expectedType, true);
-    if (componentType == null) {
-      methodName = "stream";
-      componentType = getStreamComponentType(expectedType);
-      PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(componentType);
-      if (unboxedType != null) {
-        componentType = unboxedType;
-      }
-    }
-
-    if (componentType == null ||
-        !(itemType instanceof PsiArrayType) ||
-        !componentType.isAssignableFrom(((PsiArrayType)itemType).getComponentType())) {
-      return null;
-
-    }
-    return methodName;
-  }
-
-  private static PsiType getStreamComponentType(PsiType expectedType) {
-    return PsiUtil.substituteTypeParameter(expectedType, CommonClassNames.JAVA_UTIL_STREAM_BASE_STREAM, 0, true);
-  }
-
-  private static void addToArrayConversions(final PsiElement element, final Object object, final String prefix, final PsiType itemType,
-                                            final Consumer<LookupElement> result, @Nullable final PsiElement qualifier,
-                                            final PsiType expectedType) {
-    final String callSpace = getSpace(CodeStyleSettingsManager.getSettings(element.getProject()).SPACE_WITHIN_METHOD_CALL_PARENTHESES);
-    final PsiType componentType = PsiUtil.extractIterableTypeParameter(itemType, true);
-    if (componentType == null || !(expectedType instanceof PsiArrayType)) return;
-
-    final PsiArrayType type = (PsiArrayType)expectedType;
-    if (!type.getComponentType().isAssignableFrom(componentType) ||
-        componentType instanceof PsiClassType && ((PsiClassType) componentType).hasParameters()) {
-      return;
-    }
-
-    final String bracketSpace = getSpace(CodeStyleSettingsManager.getSettings(element.getProject()).SPACE_WITHIN_BRACKETS);
-    if (object instanceof PsiVariable && !JavaCompletionUtil.mayHaveSideEffects(qualifier)) {
-      final PsiVariable variable = (PsiVariable)object;
-      addToArrayConversion(element, prefix,
-                           "new " + componentType.getCanonicalText() +
-                           "[" + bracketSpace + getQualifierText(qualifier) + variable.getName() + ".size(" + callSpace + ")" + bracketSpace + "]",
-                           "new " + getQualifierText(qualifier) + componentType.getPresentableText() + "[" + variable.getName() + ".size()]", result, qualifier);
-    } else {
-      boolean hasEmptyArrayField = false;
-      final PsiClass psiClass = PsiUtil.resolveClassInType(type);
-      if (psiClass != null) {
-        for (final PsiField field : psiClass.getAllFields()) {
-          if (field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.FINAL) &&
-              JavaPsiFacade.getInstance(field.getProject()).getResolveHelper().isAccessible(field, element, null) &&
-              type.isAssignableFrom(field.getType()) && isEmptyArrayInitializer(field.getInitializer())) {
-            boolean needQualify;
-            try {
-              needQualify = !field.isEquivalentTo(((PsiReferenceExpression)createExpression(field.getName(), element)).resolve());
-            }
-            catch (IncorrectOperationException e) {
-              continue;
-            }
-
-            addToArrayConversion(element, prefix,
-                                 (needQualify ? field.getContainingClass().getQualifiedName() + "." : "") + field.getName(),
-                                 (needQualify ? field.getContainingClass().getName() + "." : "") + field.getName(), result, qualifier);
-            hasEmptyArrayField = true;
-          }
-        }
-      }
-      if (!hasEmptyArrayField) {
-        addToArrayConversion(element, prefix,
-                             "new " + componentType.getCanonicalText() + "[" + bracketSpace + "0" + bracketSpace + "]",
-                             "new " + componentType.getPresentableText() + "[0]", result, qualifier);
-      }
-    }
-  }
-
-  private static String getQualifierText(@Nullable final PsiElement qualifier) {
+  static String getQualifierText(@Nullable final PsiElement qualifier) {
     return qualifier == null ? "" : qualifier.getText() + ".";
   }
 
-  private static void addChainedCallVariants(final PsiElement place, LookupElement qualifierItem,
-                                             final Consumer<LookupElement> result,
-                                             PsiType qualifierType,
-                                             final PsiType expectedType, JavaSmartCompletionParameters parameters) throws IncorrectOperationException {
-    final PsiReferenceExpression mockRef = createMockReference(place, qualifierType, qualifierItem);
-    if (mockRef == null) {
-      return;
-    }
-
-    final ElementFilter filter = getReferenceFilter(place, true);
-    for (final LookupElement item : completeFinalReference(place, mockRef, filter, parameters)) {
-      if (shouldChain(place, qualifierType, expectedType, item)) {
-        result.consume(new JavaChainLookupElement(qualifierItem, item) {
-          @Override
-          public void handleInsert(InsertionContext context) {
-            FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_CHAIN);
-            super.handleInsert(context);
-          }
-        });
-      }
-    }
-  }
-
   @Nullable
   public static PsiReferenceExpression createMockReference(final PsiElement place, @NotNull PsiType qualifierType, LookupElement qualifierItem) {
     PsiElementFactory factory = JavaPsiFacade.getElementFactory(place.getProject());
@@ -487,112 +229,7 @@ public class ReferenceExpressionCompletionContributor {
       .createContextWithXxxVariable(place, qualifierType));
   }
 
-  private static boolean shouldChain(PsiElement element, PsiType qualifierType, PsiType expectedType, LookupElement item) {
-    Object object = item.getObject();
-    if (object instanceof PsiModifierListOwner && ((PsiModifierListOwner)object).hasModifierProperty(PsiModifier.STATIC)) {
-      return false;
-    }
-
-    if (object instanceof PsiMethod) {
-      final PsiMethod method = (PsiMethod)object;
-      if (psiMethod().withName("toArray").withParameterCount(1)
-                     .definedInClass(CommonClassNames.JAVA_UTIL_COLLECTION).accepts(method)) {
-        return false;
-      }
-      final PsiMethod parentMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
-      if (isUselessObjectMethod(method, parentMethod, qualifierType)) {
-        return false;
-      }
-
-      final PsiType type = method.getReturnType();
-      if (type instanceof PsiClassType) {
-        final PsiClassType classType = (PsiClassType)type;
-        final PsiClass psiClass = classType.resolve();
-        if (psiClass instanceof PsiTypeParameter && method.getTypeParameterList() == psiClass.getParent()) {
-          final PsiTypeParameter typeParameter = (PsiTypeParameter)psiClass;
-          if (typeParameter.getExtendsListTypes().length == 0) return false;
-          if (!expectedType.isAssignableFrom(TypeConversionUtil.typeParameterErasure(typeParameter))) return false;
-        }
-      }
-    }
-    return true;
-  }
-
-  private static boolean isUselessObjectMethod(PsiMethod method, PsiMethod parentMethod, PsiType qualifierType) {
-    if (!OBJECT_METHOD_PATTERN.accepts(method)) {
-      return false;
-    }
-
-    if (OBJECT_METHOD_PATTERN.accepts(parentMethod) && method.getName().equals(parentMethod.getName())) {
-      return false;
-    }
-
-    if ("toString".equals(method.getName())) {
-      if (qualifierType.equalsToText(CommonClassNames.JAVA_LANG_STRING_BUFFER) ||
-          InheritanceUtil.isInheritor(qualifierType, CommonClassNames.JAVA_LANG_ABSTRACT_STRING_BUILDER)) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-  private static void addToArrayConversion(final PsiElement element, final String prefix, @NonNls final String expressionString, @NonNls String presentableString, final Consumer<LookupElement> result, PsiElement qualifier) {
-    final boolean callSpace = CodeStyleSettingsManager.getSettings(element.getProject()).SPACE_WITHIN_METHOD_CALL_PARENTHESES;
-    final PsiExpression conversion;
-    try {
-      conversion = createExpression(
-        getQualifierText(qualifier) + prefix + ".toArray(" + getSpace(callSpace) + expressionString + getSpace(callSpace) + ")", element);
-    }
-    catch (IncorrectOperationException e) {
-      return;
-    }
-
-    String[] lookupStrings = {prefix + ".toArray(" + getSpace(callSpace) + expressionString + getSpace(callSpace) + ")", presentableString};
-    result.consume(new ExpressionLookupItem(conversion, PlatformIcons.METHOD_ICON, prefix + ".toArray(" + presentableString + ")", lookupStrings) {
-        @Override
-        public void handleInsert(InsertionContext context) {
-          FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_TOAR);
-
-          context.commitDocument();
-          JavaCodeStyleManager.getInstance(context.getProject()).shortenClassReferences(context.getFile(), context.getStartOffset(), context.getTailOffset());
-        }
-      });
-  }
-
-  private static boolean isEmptyArrayInitializer(@Nullable PsiElement element) {
-    if (element instanceof PsiNewExpression) {
-      final PsiNewExpression expression = (PsiNewExpression)element;
-      final PsiExpression[] dimensions = expression.getArrayDimensions();
-      for (final PsiExpression dimension : dimensions) {
-        if (!(dimension instanceof PsiLiteralExpression) || !"0".equals(dimension.getText())) {
-          return false;
-        }
-      }
-      final PsiArrayInitializerExpression initializer = expression.getArrayInitializer();
-      if (initializer != null && initializer.getInitializers().length > 0) return false;
-
-      return true;
-    }
-    return false;
-  }
-
-  @Nullable
-  private static String getItemText(Object o) {
-    if (o instanceof PsiMethod) {
-      final PsiMethod method = (PsiMethod)o;
-      final PsiType type = method.getReturnType();
-      if (PsiType.VOID.equals(type) || PsiType.NULL.equals(type)) return null;
-      if (method.getParameterList().getParametersCount() > 0) return null;
-      return method.getName() + "(" + getSpace(CodeStyleSettingsManager.getSettings(method.getProject()).SPACE_WITHIN_METHOD_CALL_PARENTHESES) + ")"; }
-    else if (o instanceof PsiVariable) {
-      return ((PsiVariable)o).getName();
-    }
-    return null;
-  }
-
-  private static String getSpace(boolean needSpace) {
+  static String getSpace(boolean needSpace) {
     return needSpace ? " " : "";
   }
-
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SlowerTypeConversions.java b/java/java-impl/src/com/intellij/codeInsight/completion/SlowerTypeConversions.java
new file mode 100644 (file)
index 0000000..982cf2c
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * 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 com.intellij.codeInsight.completion;
+
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.openapi.util.Pair;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.util.Consumer;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Set;
+
+import static com.intellij.codeInsight.completion.ReferenceExpressionCompletionContributor.getSpace;
+import static com.intellij.patterns.PsiJavaPatterns.psiElement;
+
+/**
+ * @author peter
+ */
+class SlowerTypeConversions implements Runnable {
+  private static final PrefixMatcher TRUE_MATCHER = new PrefixMatcher("") {
+    @Override
+    public boolean prefixMatches(@NotNull String name) {
+      return true;
+    }
+
+    @NotNull
+    @Override
+    public PrefixMatcher cloneWithPrefix(@NotNull String prefix) {
+      return this;
+    }
+  };
+  private final Set<LookupElement> myBase;
+  private final PsiElement myElement;
+  private final PsiJavaCodeReferenceElement myReference;
+  private final JavaSmartCompletionParameters myParameters;
+  private final Consumer<LookupElement> myResult;
+
+  SlowerTypeConversions(Set<LookupElement> base,
+                        PsiElement element,
+                        PsiJavaCodeReferenceElement reference,
+                        JavaSmartCompletionParameters parameters, Consumer<LookupElement> result) {
+    myBase = base;
+    myElement = element;
+    myReference = reference;
+    myParameters = parameters;
+    myResult = result;
+  }
+
+  @Override
+  public void run() {
+    final Set<Pair<LookupElement, String>> processedChains = ContainerUtil.newHashSet();
+    for (final LookupElement item : myBase) {
+      addSecondCompletionVariants(myElement, myReference, item, myParameters, new Consumer<LookupElement>() {
+        @Override
+        public void consume(LookupElement lookupElement) {
+          ContainerUtil.addIfNotNull(processedChains, chainInfo(lookupElement));
+          myResult.consume(lookupElement);
+        }
+      });
+    }
+    if (!psiElement().afterLeaf(".").accepts(myElement)) {
+      BasicExpressionCompletionContributor.processDataflowExpressionTypes(myElement, null, TRUE_MATCHER, new Consumer<LookupElement>() {
+        @Override
+        public void consume(LookupElement baseItem) {
+          addSecondCompletionVariants(myElement, myReference, baseItem, myParameters, new Consumer<LookupElement>() {
+            @Override
+            public void consume(LookupElement lookupElement) {
+              if (!processedChains.contains(chainInfo(lookupElement))) {
+                myResult.consume(lookupElement);
+              }
+            }
+          });
+        }
+      });
+    }
+  }
+
+  private static void addSecondCompletionVariants(PsiElement element, PsiReference reference, LookupElement baseItem,
+                                                  JavaSmartCompletionParameters parameters, Consumer<LookupElement> result) {
+    final Object object = baseItem.getObject();
+
+    try {
+      PsiType itemType = JavaCompletionUtil.getLookupElementType(baseItem);
+      if (itemType instanceof PsiWildcardType) {
+        itemType = ((PsiWildcardType)itemType).getExtendsBound();
+      }
+      if (itemType == null) return;
+      assert itemType.isValid() : baseItem + "; " + baseItem.getClass();
+
+      final PsiElement element1 = reference.getElement();
+      final PsiElement qualifier =
+        element1 instanceof PsiJavaCodeReferenceElement ? ((PsiJavaCodeReferenceElement)element1).getQualifier() : null;
+      final PsiType expectedType = parameters.getExpectedType();
+      ChainedCallCompletion.addChains(element, baseItem, result, itemType, expectedType, parameters);
+
+      final String prefix = getItemText(object);
+      if (prefix == null) return;
+
+      FromArrayConversion.addConversions(element, prefix, itemType, result, qualifier, expectedType);
+
+      ToArrayConversion.addConversions(element, object, prefix, itemType, result, qualifier, expectedType);
+
+      ArrayMemberAccess.addMemberAccessors(element, prefix, itemType, qualifier, result, (PsiModifierListOwner)object, expectedType);
+    }
+    catch (IncorrectOperationException ignored) {
+    }
+  }
+
+  @Nullable
+  private static String getItemText(Object o) {
+    if (o instanceof PsiMethod) {
+      final PsiMethod method = (PsiMethod)o;
+      final PsiType type = method.getReturnType();
+      if (PsiType.VOID.equals(type) || PsiType.NULL.equals(type)) return null;
+      if (method.getParameterList().getParametersCount() > 0) return null;
+      return method.getName() + "(" +
+             getSpace(CodeStyleSettingsManager.getSettings(method.getProject()).SPACE_WITHIN_METHOD_CALL_PARENTHESES) + ")"; }
+    else if (o instanceof PsiVariable) {
+      return ((PsiVariable)o).getName();
+    }
+    return null;
+  }
+
+  @Nullable
+  private static Pair<LookupElement, String> chainInfo(LookupElement lookupElement) {
+    if (lookupElement instanceof JavaChainLookupElement) {
+      Object object = lookupElement.getObject();
+      if (object instanceof PsiMember) {
+        LookupElement qualifier = ((JavaChainLookupElement)lookupElement).getQualifier();
+        if (qualifier instanceof CastingLookupElementDecorator) {
+          qualifier = ((CastingLookupElementDecorator)qualifier).getDelegate();
+        }
+        return Pair.create(qualifier, lookupElement.getLookupString());
+      }
+    }
+    return null;
+  }
+
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java b/java/java-impl/src/com/intellij/codeInsight/completion/SuperCalls.java
new file mode 100644 (file)
index 0000000..dcd34bf
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * 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 com.intellij.codeInsight.completion;
+
+import com.intellij.codeInsight.completion.scope.CompletionElement;
+import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.lookup.LookupElementDecorator;
+import com.intellij.codeInsight.lookup.LookupElementPresentation;
+import com.intellij.openapi.util.Condition;
+import com.intellij.psi.*;
+import com.intellij.psi.filters.ElementFilter;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.ObjectUtils;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Set;
+
+/**
+ * @author peter
+ */
+class SuperCalls {
+  static Set<LookupElement> suggestQualifyingSuperCalls(PsiElement element,
+                                          PsiJavaReference javaReference,
+                                          ElementFilter elementFilter,
+                                          JavaCompletionProcessor.Options options,
+                                          Condition<String> nameCondition) {
+    Set<LookupElement> set = ContainerUtil.newLinkedHashSet();
+    for (final String className : getContainingClassNames(element)) {
+      PsiReferenceExpression fakeSuper = JavaCompletionUtil.createReference(className + ".super.rulez", element);
+      PsiElement leaf = ObjectUtils.assertNotNull(fakeSuper.getReferenceNameElement());
+
+      JavaCompletionProcessor superProcessor = new JavaCompletionProcessor(leaf, elementFilter, options, nameCondition);
+      fakeSuper.processVariants(superProcessor);
+
+      for (CompletionElement completionElement : superProcessor.getResults()) {
+        for (LookupElement item : JavaCompletionUtil.createLookupElements(completionElement, javaReference)) {
+          set.add(withQualifiedSuper(className, item));
+        }
+      }
+    }
+    return set;
+  }
+
+  @NotNull
+  private static LookupElement withQualifiedSuper(final String className, LookupElement item) {
+    return PrioritizedLookupElement.withExplicitProximity(new LookupElementDecorator<LookupElement>(item) {
+
+      @Override
+      public void renderElement(LookupElementPresentation presentation) {
+        super.renderElement(presentation);
+        presentation.setItemText(className + ".super." + presentation.getItemText());
+      }
+
+      @Override
+      public void handleInsert(InsertionContext context) {
+        context.commitDocument();
+        PsiJavaCodeReferenceElement ref = PsiTreeUtil
+